aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-12-09 17:11:52 -0800
committerGraydon Hoare <[email protected]>2010-12-09 17:11:52 -0800
commite04c24769e4d25c6d639869a26f19c52493fa582 (patch)
tree085b4a0d6c6e385c2a4e38ba92b23018f159d59b /src
parentFix token span tracking in lexer. (diff)
downloadrust-e04c24769e4d25c6d639869a26f19c52493fa582.tar.xz
rust-e04c24769e4d25c6d639869a26f19c52493fa582.zip
Add 'unexpected' fn to parser.
Diffstat (limited to 'src')
-rw-r--r--src/comp/front/parser.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index 8cf088e4..ee797e29 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -68,6 +68,12 @@ impure fn new_parser(session.session sess,
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) {
if (p.peek() == t) {
p.bump();