diff options
author | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-10-20 20:41:10 +0000 |
---|---|---|
committer | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-10-20 20:41:10 +0000 |
commit | 4af7ae6c56153347035656a2596254c1a8a17668 (patch) | |
tree | 3722478f2d678b63feefe9faa3e3ddbb0225c80c /src/parser | |
parent | 93e8bc35db891c6041f9690366be933433a0ad52 (diff) |
Fixing minor whitespace bug in the parser
Diffstat (limited to 'src/parser')
-rw-r--r-- | src/parser/bounded_token_buffer.h | 5 | ||||
-rw-r--r-- | src/parser/cvc/Cvc.g | 4 | ||||
-rw-r--r-- | src/parser/smt/Smt.g | 4 | ||||
-rw-r--r-- | src/parser/smt2/Smt2.g | 4 |
4 files changed, 11 insertions, 6 deletions
diff --git a/src/parser/bounded_token_buffer.h b/src/parser/bounded_token_buffer.h index fad5edc1e..a29462687 100644 --- a/src/parser/bounded_token_buffer.h +++ b/src/parser/bounded_token_buffer.h @@ -18,6 +18,11 @@ ** an exception. Only use this factory if you *know* that the grammar ** has bounded lookahead (e.g., if you've set the k parameter in the ** parser. + ** + ** NOTE: ANTLR3 puts "hidden" tokens into this buffer too, so + ** pathological inputs can exceed the k token lookahead, even if + ** your grammar really is LL(k). Be sure that irrelevant tokens + ** are SKIP()'d and not "hidden". **/ #ifndef __CVC4__PARSER__BOUNDED_TOKEN_BUFFER_H diff --git a/src/parser/cvc/Cvc.g b/src/parser/cvc/Cvc.g index 979f2a7c3..8fa1ca55a 100644 --- a/src/parser/cvc/Cvc.g +++ b/src/parser/cvc/Cvc.g @@ -555,10 +555,10 @@ fragment DIGIT : '0'..'9'; /** * Matches and skips whitespace in the input and ignores it. */ -WHITESPACE : (' ' | '\t' | '\f' | '\r' | '\n') { $channel = HIDDEN;; }; +WHITESPACE : (' ' | '\t' | '\f' | '\r' | '\n')+ { SKIP();; }; /** * Matches the comments and ignores them */ -COMMENT : '%' (~('\n' | '\r'))* { $channel = HIDDEN;; }; +COMMENT : '%' (~('\n' | '\r'))* { SKIP();; }; diff --git a/src/parser/smt/Smt.g b/src/parser/smt/Smt.g index 8bbbbe0be..f125826d3 100644 --- a/src/parser/smt/Smt.g +++ b/src/parser/smt/Smt.g @@ -646,7 +646,7 @@ USER_VALUE * Matches and skips whitespace in the input. */ WHITESPACE - : (' ' | '\t' | '\f' | '\r' | '\n')+ { $channel = HIDDEN;; } + : (' ' | '\t' | '\f' | '\r' | '\n')+ { SKIP();; } ; /** @@ -672,7 +672,7 @@ STRING_LITERAL * Matches the comments and ignores them */ COMMENT - : ';' (~('\n' | '\r'))* { $channel = HIDDEN;; } + : ';' (~('\n' | '\r'))* { SKIP();; } ; diff --git a/src/parser/smt2/Smt2.g b/src/parser/smt2/Smt2.g index f549d2148..705eee4d4 100644 --- a/src/parser/smt2/Smt2.g +++ b/src/parser/smt2/Smt2.g @@ -661,7 +661,7 @@ fragment SIMPLE_SYMBOL * Matches and skips whitespace in the input. */ WHITESPACE - : (' ' | '\t' | '\f' | '\r' | '\n')+ { $channel = HIDDEN; } + : (' ' | '\t' | '\f' | '\r' | '\n')+ { SKIP(); } ; /** @@ -727,7 +727,7 @@ STRING_LITERAL * Matches the comments and ignores them */ COMMENT - : ';' (~('\n' | '\r'))* { $channel = HIDDEN; } + : ';' (~('\n' | '\r'))* { SKIP(); } ; |