Skip to content

Commit b5e0630

Browse files
committed
Improved scanner by removing reundant rules
1 parent a50dd9e commit b5e0630

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

parser/scanner.re

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ int xx_get_token(xx_scanner_state *s, xx_scanner_token *token) {
3131
re2c:indent:top = 2;
3232
re2c:yyfill:enable = 0;
3333
34-
INTEGER = ([\-]?[0-9]+)|([\-]?[0][x][0-9A-Fa-f]+);
34+
INTEGER = ("-"?[0-9]+)|("-"?[0][x][0-9A-Fa-f]+);
3535
INTEGER {
3636
token->opcode = XX_T_INTEGER;
3737
token->value = estrndup(start, YYCURSOR - start);
@@ -41,7 +41,7 @@ int xx_get_token(xx_scanner_state *s, xx_scanner_token *token) {
4141
return 0;
4242
}
4343
44-
DOUBLE = ([\-]?[0-9]+[\.][0-9]+);
44+
DOUBLE = ("-"?[0-9]+"."[0-9]+);
4545
DOUBLE {
4646
token->opcode = XX_T_DOUBLE;
4747
token->value = estrndup(start, YYCURSOR - start);
@@ -584,7 +584,7 @@ int xx_get_token(xx_scanner_state *s, xx_scanner_token *token) {
584584
}
585585

586586
/* We have to remove this and define constants in compiler */
587-
IDENTIFIER = [\\_\$]?[_a-zA-Z\\][a-zA-Z0-9_\\]*;
587+
IDENTIFIER = [\\_$]?[_a-zA-Z\\][a-zA-Z0-9_\\]*;
588588
IDENTIFIER {
589589

590590
if (start[0] == '$') {

0 commit comments

Comments
 (0)