Commit b7da23d0 authored by Geoffry Song's avatar Geoffry Song Committed by GitHub

Merge pull request #25 from dskyle/master

Fix for nightly as of 2017-10-05
parents a5c72da7 06f5bfc5
...@@ -38,7 +38,7 @@ pub fn dfa_fn<T>(cx: &base::ExtCtxt, dfa: &Dfa<char, T>, state_enum: Ident, stat ...@@ -38,7 +38,7 @@ pub fn dfa_fn<T>(cx: &base::ExtCtxt, dfa: &Dfa<char, T>, state_enum: Ident, stat
cx.pat(DUMMY_SP, ast::PatKind::Range( cx.pat(DUMMY_SP, ast::PatKind::Range(
cx.expr_lit(DUMMY_SP, ast::LitKind::Char(ch)), cx.expr_lit(DUMMY_SP, ast::LitKind::Char(ch)),
cx.expr_lit(DUMMY_SP, ast::LitKind::Char(end)), cx.expr_lit(DUMMY_SP, ast::LitKind::Char(end)),
ast::RangeEnd::Included ast::RangeEnd::Included(ast::RangeSyntax::DotDotDot)
)) ))
}; };
subarms.push(ast::Arm { subarms.push(ast::Arm {
...@@ -46,6 +46,7 @@ pub fn dfa_fn<T>(cx: &base::ExtCtxt, dfa: &Dfa<char, T>, state_enum: Ident, stat ...@@ -46,6 +46,7 @@ pub fn dfa_fn<T>(cx: &base::ExtCtxt, dfa: &Dfa<char, T>, state_enum: Ident, stat
pats: vec![pat], pats: vec![pat],
guard: None, guard: None,
body: cx.expr_path(state_paths[target as usize].clone()), body: cx.expr_path(state_paths[target as usize].clone()),
beginning_vert: None,
}); });
} }
subarms.push(cx.arm(DUMMY_SP, vec![quote_pat!(cx, _)], cx.expr_path(state_paths[tr.default as usize].clone()))); subarms.push(cx.arm(DUMMY_SP, vec![quote_pat!(cx, _)], cx.expr_path(state_paths[tr.default as usize].clone())));
...@@ -59,7 +60,7 @@ pub fn dfa_fn<T>(cx: &base::ExtCtxt, dfa: &Dfa<char, T>, state_enum: Ident, stat ...@@ -59,7 +60,7 @@ pub fn dfa_fn<T>(cx: &base::ExtCtxt, dfa: &Dfa<char, T>, state_enum: Ident, stat
fn parse_str_interior<'a>(parser: &mut parser::Parser<'a>) -> PResult<'a, String> { fn parse_str_interior<'a>(parser: &mut parser::Parser<'a>) -> PResult<'a, String> {
let (re_str, style) = try!(parser.parse_str()); let (re_str, style) = try!(parser.parse_str());
Ok(match style { Ok(match style {
ast::StrStyle::Cooked => parse::str_lit(&re_str.as_str()), ast::StrStyle::Cooked => parse::str_lit(&re_str.as_str(), None),
ast::StrStyle::Raw(_) => parse::raw_str_lit(&re_str.as_str()), ast::StrStyle::Raw(_) => parse::raw_str_lit(&re_str.as_str()),
}) })
} }
...@@ -156,7 +157,7 @@ fn parse_lexer<'a>(cx: &mut base::ExtCtxt<'a>, sp: codemap::Span, args: &[TokenT ...@@ -156,7 +157,7 @@ fn parse_lexer<'a>(cx: &mut base::ExtCtxt<'a>, sp: codemap::Span, args: &[TokenT
try!(parser.expect(&token::FatArrow)); try!(parser.expect(&token::FatArrow));
// start parsing the expr // start parsing the expr
let expr = try!(parser.parse_expr_res(parser::RESTRICTION_STMT_EXPR, None)); let expr = try!(parser.parse_expr_res(parser::Restrictions::STMT_EXPR, None));
let optional_comma = let optional_comma =
// don't need a comma for blocks... // don't need a comma for blocks...
!classify::expr_requires_semi_to_be_stmt(&*expr) !classify::expr_requires_semi_to_be_stmt(&*expr)
......
...@@ -523,7 +523,7 @@ fn parse_parser<'a>( ...@@ -523,7 +523,7 @@ fn parse_parser<'a>(
cx.arg(DUMMY_SP, gensym("_b"), span_ty.clone()), cx.arg(DUMMY_SP, gensym("_b"), span_ty.clone()),
], span_ty.clone(), cx.block_expr(cx.expr_tuple(DUMMY_SP, vec![]))) ], span_ty.clone(), cx.block_expr(cx.expr_tuple(DUMMY_SP, vec![])))
} else { } else {
let lo = parser.span.lo; let lo = parser.span.lo();
try!(parser.expect(&token::OpenDelim(token::Paren))); try!(parser.expect(&token::OpenDelim(token::Paren)));
let p1_sp = parser.span; let p1_sp = parser.span;
let p1 = try!(parser.parse_ident()); let p1 = try!(parser.parse_ident());
...@@ -532,7 +532,7 @@ fn parse_parser<'a>( ...@@ -532,7 +532,7 @@ fn parse_parser<'a>(
let p2 = try!(parser.parse_ident()); let p2 = try!(parser.parse_ident());
try!(parser.expect(&token::CloseDelim(token::Paren))); try!(parser.expect(&token::CloseDelim(token::Paren)));
let body = try!(parser.parse_block()); let body = try!(parser.parse_block());
cx.item_fn(codemap::Span{ lo: lo, ..parser.prev_span }, range_fn_id, vec![ cx.item_fn(parser.prev_span.with_lo(lo), range_fn_id, vec![
cx.arg(p1_sp, p1, span_ty.clone()), cx.arg(p1_sp, p1, span_ty.clone()),
cx.arg(p2_sp, p2, span_ty.clone()), cx.arg(p2_sp, p2, span_ty.clone()),
], span_ty.clone(), body) ], span_ty.clone(), body)
...@@ -588,10 +588,10 @@ fn parse_parser<'a>( ...@@ -588,10 +588,10 @@ fn parse_parser<'a>(
_ => parser.span_err(attr.span, "unknown attribute"), _ => parser.span_err(attr.span, "unknown attribute"),
} }
} }
let lo = parser.span.lo; let lo = parser.span.lo();
let (mut rule, mut binds) = (vec![], vec![]); let (mut rule, mut binds) = (vec![], vec![]);
while !parser.check(&token::FatArrow) { while !parser.check(&token::FatArrow) {
let lo = parser.span.lo; let lo = parser.span.lo();
let name = UnhygienicIdent(try!(parser.parse_ident())); let name = UnhygienicIdent(try!(parser.parse_ident()));
let bind = if parser.eat(&token::OpenDelim(token::Bracket)) { let bind = if parser.eat(&token::OpenDelim(token::Bracket)) {
let r = try!(parser.parse_pat()); let r = try!(parser.parse_pat());
...@@ -606,7 +606,7 @@ fn parse_parser<'a>( ...@@ -606,7 +606,7 @@ fn parse_parser<'a>(
break; break;
} }
} }
Binding::Enum(codemap::Span{ lo: lo, ..parser.prev_span }, pats) Binding::Enum(parser.prev_span.with_lo(lo), pats)
} else { } else {
Binding::None Binding::None
}; };
...@@ -618,7 +618,7 @@ fn parse_parser<'a>( ...@@ -618,7 +618,7 @@ fn parse_parser<'a>(
try!(parser.expect(&token::FatArrow)); try!(parser.expect(&token::FatArrow));
// start parsing the expr // start parsing the expr
let expr = try!(parser.parse_expr_res(parser::RESTRICTION_STMT_EXPR, None)); let expr = try!(parser.parse_expr_res(parser::Restrictions::STMT_EXPR, None));
let optional_comma = let optional_comma =
// don't need a comma for blocks... // don't need a comma for blocks...
!classify::expr_requires_semi_to_be_stmt(&*expr) !classify::expr_requires_semi_to_be_stmt(&*expr)
...@@ -632,7 +632,7 @@ fn parse_parser<'a>( ...@@ -632,7 +632,7 @@ fn parse_parser<'a>(
// comma required // comma required
try!(parser.expect_one_of(&[token::Comma], &[token::CloseDelim(token::Brace)])); try!(parser.expect_one_of(&[token::Comma], &[token::CloseDelim(token::Brace)]));
} }
let sp = codemap::Span{ lo: lo, ..parser.prev_span }; let sp = parser.prev_span.with_lo(lo);
rhss.push((rule, Action { rhss.push((rule, Action {
binds: binds, binds: binds,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment