Skip to content

Commit f3e8746

Browse files
committed
Fix (I think!) the ACTUALLY expr parsing situation.
1 parent bf88ff5 commit f3e8746

File tree

1 file changed

+4
-32
lines changed

1 file changed

+4
-32
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -101,24 +101,7 @@ type item_info = (ident, item_, option<~[attribute]>);
101101

102102
fn dummy() {
103103

104-
/* We need to position the macros to capture the ACTUALLY tokens before they
105-
get bumped away. So two bumps in a row is bad. (the first lookahead also
106-
counts as a bump).
107-
108-
Events happen L to R; 'B' indicates a bump before hand:
109-
._____________________________.________________________.
110-
↓ B| |
111-
parse_expr -> parse_expr_res -> parse_assign_expr |
112-
↓ |
113-
parse_binops -> parse_more_binops |
114-
↓ B↓ B|
115-
parse_prefix_expr B-> parse_dot_or_call_expr
116-
B|_↑ ↓
117-
parse_bottom_expr
118-
B↓
119-
⋯->parse_ident
120-
...so we've hit parse_prefix_expr, parse_more_binops, and parse_bottom_expr.
121-
*/
104+
122105

123106
#macro[[#maybe_whole_item[p],
124107
alt copy p.token {
@@ -136,18 +119,9 @@ Events happen L to R; 'B' indicates a bump before hand:
136119
alt copy p.token {
137120
ACTUALLY(token::w_pat(pt)) { p.bump(); ret pt; }
138121
_ {} }]];
139-
#macro[[#maybe_whole_expr[p],
140-
alt copy p.token {
141-
ACTUALLY(token::w_expr(e)) {
142-
p.bump();
143-
ret e;
144-
}
145-
ACTUALLY(token::w_path(pt)) {
146-
p.bump();
147-
ret p.mk_expr(p.span.lo, p.span.lo,
148-
expr_path(pt));
149-
}
150-
_ {} }]];
122+
/* The expr situation is not as complex as I thought it would be.
123+
The important thing is to make sure that lookahead doesn't balk
124+
at ACTUALLY tokens */
151125
#macro[[#maybe_whole_expr_pexpr[p], /* ack! */
152126
alt copy p.token {
153127
ACTUALLY(token::w_expr(e)) {
@@ -1302,7 +1276,6 @@ class parser {
13021276

13031277

13041278
fn parse_prefix_expr() -> pexpr {
1305-
#maybe_whole_expr_pexpr[self];
13061279
let lo = self.span.lo;
13071280
let mut hi;
13081281

@@ -1380,7 +1353,6 @@ class parser {
13801353

13811354
fn parse_more_binops(plhs: pexpr, min_prec: uint) ->
13821355
@expr {
1383-
#maybe_whole_expr[self];
13841356
let lhs = self.to_expr(plhs);
13851357
if self.expr_is_complete(plhs) { ret lhs; }
13861358
let peeked = self.token;

0 commit comments

Comments
 (0)