Skip to content

Commit 021c2f3

Browse files
committed
rollup merge of rust-lang#20310: fhahn/issue-15877-model-lexer-range
This patch for rust-lang#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, rust-lang#20245 should land first.
2 parents 731fcfc + 808945c commit 021c2f3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/grammar/RustLexer.g4

+2-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ LIT_INTEGER
112112
;
113113

114114
LIT_FLOAT
115-
: [0-9][0-9_]* ('.' | ('.' [0-9][0-9_]*)? ([eE] [-+]? [0-9][0-9_]*)? SUFFIX?)
115+
: [0-9][0-9_]* ( '.' {_input.LA(1) != '.'}?
116+
| ('.' [0-9][0-9_]*)? ([eE] [-+]? [0-9][0-9_]*)? SUFFIX?)
116117
;
117118

118119
LIT_STR

0 commit comments

Comments
 (0)