Add 'unexpected' fn to parser.
This commit is contained in:
parent
8383b1c435
commit
e04c24769e
1 changed files with 6 additions and 0 deletions
|
@ -68,6 +68,12 @@ impure fn new_parser(session.session sess,
|
||||||
npos, npos, 0, crate, rdr);
|
npos, npos, 0, crate, rdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impure fn unexpected(parser p, token.token t) {
|
||||||
|
let str s = "unexpected token: ";
|
||||||
|
s += token.to_str(t);
|
||||||
|
p.err(s);
|
||||||
|
}
|
||||||
|
|
||||||
impure fn expect(parser p, token.token t) {
|
impure fn expect(parser p, token.token t) {
|
||||||
if (p.peek() == t) {
|
if (p.peek() == t) {
|
||||||
p.bump();
|
p.bump();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue