about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-12-29 16:36:55 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-12-29 16:36:55 -0800
commit021c2f3712312d3170b1dbd27a3bd92360b541d3 (patch)
treefde5600d21f58198322b0c435a634fdb1cee49b0 /src
parent731fcfc2892d0aa45af22cc9eaa23c804cd9cefa (diff)
parent808945c21c5128e4db2b23c4107c8b9d7e3382e1 (diff)
downloadrust-021c2f3712312d3170b1dbd27a3bd92360b541d3.tar.gz
rust-021c2f3712312d3170b1dbd27a3bd92360b541d3.zip
rollup merge of #20310: fhahn/issue-15877-model-lexer-range
This patch for #15877 uses Antlr's input lookahead (`_input.LA(1) != '.'`) to solve the conflict between the LIT_FLOAT and the range syntax.

Note that in order to execute the grammar tests, #20245 should land first.
Diffstat (limited to 'src')
-rw-r--r--src/grammar/RustLexer.g43
1 files changed, 2 insertions, 1 deletions
diff --git a/src/grammar/RustLexer.g4 b/src/grammar/RustLexer.g4
index 0ff9af7aca1..00af6d358e5 100644
--- a/src/grammar/RustLexer.g4
+++ b/src/grammar/RustLexer.g4
@@ -112,7 +112,8 @@ LIT_INTEGER
   ;
 
 LIT_FLOAT
-  : [0-9][0-9_]* ('.' | ('.' [0-9][0-9_]*)? ([eE] [-+]? [0-9][0-9_]*)? SUFFIX?)
+  : [0-9][0-9_]* ( '.' {_input.LA(1) != '.'}?
+                 | ('.' [0-9][0-9_]*)? ([eE] [-+]? [0-9][0-9_]*)? SUFFIX?)
   ;
 
 LIT_STR