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
commit5bb5391fd3ad9874fdb266dd5b6d57f084626d13 (patch)
tree7da3eb718fe1d524660bb17fe5231794f14ade5f
parente633b4b961165c1a2b9d9e926bfccd9f62c645e7 (diff)
downloadtxr-5bb5391fd3ad9874fdb266dd5b6d57f084626d13.tar.gz
txr-5bb5391fd3ad9874fdb266dd5b6d57f084626d13.tar.bz2
txr-5bb5391fd3ad9874fdb266dd5b6d57f084626d13.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;
}