summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-05-11 06:22:32 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-05-11 06:22:32 -0700
commitcd79ce1098f433b5451f9550c659c502c2df8d18 (patch)
tree7da3eb718fe1d524660bb17fe5231794f14ade5f
parenta5b59aabe9e194b1519d8595fe82d1746a9a005e (diff)
downloadtxr-cd79ce1098f433b5451f9550c659c502c2df8d18.tar.gz
txr-cd79ce1098f433b5451f9550c659c502c2df8d18.tar.bz2
txr-cd79ce1098f433b5451f9550c659c502c2df8d18.zip
lexer: eliminate regex alias used in one place.
* parser.l (SYM, TOK): These are just aliases for the same pattern. SYM is referenced only in one place; TOK in multiple places, so let's remove SYM and replace that one reference by TOK.
-rw-r--r--parser.l5
1 files changed, 2 insertions, 3 deletions
diff --git a/parser.l b/parser.l
index 6c68b280..5fd70a51 100644
--- a/parser.l
+++ b/parser.l
@@ -190,7 +190,7 @@ static wchar_t num_esc(scanner_t *scn, char *num)
%option stack noinput reentrant bison-bridge extra-type="parser_t *"
-SYM [a-zA-Z0-9_]+
+TOK [a-zA-Z0-9_]+
SGN [+\-]
EXP [eE][+\-]?[0-9]+
DIG [0-9]
@@ -206,7 +206,6 @@ BSCHR [a-zA-Z0-9!$%&*+\-<=>?\\_~]
NSCHR [a-zA-Z0-9!$%&*+\-<=>?\\_~/]
ID_END [^a-zA-Z0-9!$%&*+\-<=>?\\_~/]
EXTRA [#^]
-TOK {SYM}
BT0 {BSCHR}({BSCHR}|{EXTRA})*
BT1 @{BT0}+
BT2 ({BSCHR}|{EXTRA})+
@@ -960,7 +959,7 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
return LITCHAR;
}
-<CHRLIT>{SYM} {
+<CHRLIT>{TOK} {
yylval->lexeme = utf8_dup_from(yytext);
return SYMTOK;
}