Skip to content

Commit b41a24f

Browse files
committed
Handle function calls to integers in model lexer correctly
closes #15877
1 parent d2368c3 commit b41a24f

File tree

1 file changed

+58
-2
lines changed

1 file changed

+58
-2
lines changed

src/grammar/RustLexer.g4

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

114114
LIT_FLOAT
115-
: [0-9][0-9_]* ( '.' {_input.LA(1) != '.'}?
116-
| ('.' [0-9][0-9_]*)? ([eE] [-+]? [0-9][0-9_]*)? SUFFIX?)
115+
: [0-9][0-9_]* ('.' {
116+
/* dot followed by another dot is a range, no float */
117+
_input.LA(1) != '.' &&
118+
/* dot followed by an identifier is an integer with a function call, no float */
119+
_input.LA(1) != '_' &&
120+
_input.LA(1) != 'a' &&
121+
_input.LA(1) != 'b' &&
122+
_input.LA(1) != 'c' &&
123+
_input.LA(1) != 'd' &&
124+
_input.LA(1) != 'e' &&
125+
_input.LA(1) != 'f' &&
126+
_input.LA(1) != 'g' &&
127+
_input.LA(1) != 'h' &&
128+
_input.LA(1) != 'i' &&
129+
_input.LA(1) != 'j' &&
130+
_input.LA(1) != 'k' &&
131+
_input.LA(1) != 'l' &&
132+
_input.LA(1) != 'm' &&
133+
_input.LA(1) != 'n' &&
134+
_input.LA(1) != 'o' &&
135+
_input.LA(1) != 'p' &&
136+
_input.LA(1) != 'q' &&
137+
_input.LA(1) != 'r' &&
138+
_input.LA(1) != 's' &&
139+
_input.LA(1) != 't' &&
140+
_input.LA(1) != 'u' &&
141+
_input.LA(1) != 'v' &&
142+
_input.LA(1) != 'w' &&
143+
_input.LA(1) != 'x' &&
144+
_input.LA(1) != 'y' &&
145+
_input.LA(1) != 'z' &&
146+
_input.LA(1) != 'A' &&
147+
_input.LA(1) != 'B' &&
148+
_input.LA(1) != 'C' &&
149+
_input.LA(1) != 'D' &&
150+
_input.LA(1) != 'E' &&
151+
_input.LA(1) != 'F' &&
152+
_input.LA(1) != 'G' &&
153+
_input.LA(1) != 'H' &&
154+
_input.LA(1) != 'I' &&
155+
_input.LA(1) != 'J' &&
156+
_input.LA(1) != 'K' &&
157+
_input.LA(1) != 'L' &&
158+
_input.LA(1) != 'M' &&
159+
_input.LA(1) != 'N' &&
160+
_input.LA(1) != 'O' &&
161+
_input.LA(1) != 'P' &&
162+
_input.LA(1) != 'Q' &&
163+
_input.LA(1) != 'R' &&
164+
_input.LA(1) != 'S' &&
165+
_input.LA(1) != 'T' &&
166+
_input.LA(1) != 'U' &&
167+
_input.LA(1) != 'V' &&
168+
_input.LA(1) != 'W' &&
169+
_input.LA(1) != 'X' &&
170+
_input.LA(1) != 'Y' &&
171+
_input.LA(1) != 'Z'
172+
}? | ('.' [0-9][0-9_]*)? ([eE] [-+]? [0-9][0-9_]*)? SUFFIX?)
117173
;
118174

119175
LIT_STR

0 commit comments

Comments
 (0)