summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-12-07 09:05:38 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-12-07 09:05:38 -0800
commit46dea2737dcd5d74585878459999f230f2d002bc (patch)
treed944afa3d26f8a6445939770a17e83526ec332ab
parentb3540d10efec1c3d27d0206d67635eaeb39141ec (diff)
downloadtxr-46dea2737dcd5d74585878459999f230f2d002bc.tar.gz
txr-46dea2737dcd5d74585878459999f230f2d002bc.tar.bz2
txr-46dea2737dcd5d74585878459999f230f2d002bc.zip
* parser.l: In the CHRLIT state, return a nonblank character as an
IDENT token. This allows for character literals like #\$.
-rw-r--r--ChangeLog5
-rw-r--r--parser.l5
2 files changed, 10 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 0ff4650a..4dc6b703 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2011-12-07 Kaz Kylheku <kaz@kylheku.com>
+ * parser.l: In the CHRLIT state, return a nonblank character as an
+ IDENT token. This allows for character literals like #\$.
+
+2011-12-07 Kaz Kylheku <kaz@kylheku.com>
+
* eval.c (eval_init): New character functions registered.
* lib.c (c_num): Generalized to convert characters to numbers also.
diff --git a/parser.l b/parser.l
index e22c6d74..53644a03 100644
--- a/parser.l
+++ b/parser.l
@@ -585,6 +585,11 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
return IDENT;
}
+<CHRLIT>[^ \t\n] {
+ yylval.lexeme = utf8_dup_from(yytext);
+ return IDENT; /* hack */
+ }
+
<STRLIT>\n {
yyerrprepf(lit("newline in string literal"), nao);
lineno++;