summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--parser.l4
-rw-r--r--txr.17
3 files changed, 15 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 42165e0c..76ce0d5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2012-02-25 Kaz Kylheku <kaz@kylheku.com>
+ * parser.l (num_esc): Skip octal indicator 'o' if present.
+ This is needed for character constants.
+ (CHRLIT): Fix broken hex constants, being treated as octal.
+
+ * txr.1: Document octal character constants.
+
+2012-02-25 Kaz Kylheku <kaz@kylheku.com>
+
Version 58
* txr.c (version): Bumped.
diff --git a/parser.l b/parser.l
index 3c09aabc..a53f8514 100644
--- a/parser.l
+++ b/parser.l
@@ -134,6 +134,8 @@ static wchar_t num_esc(char *num)
yyerror("too many digits in hex character escape");
return strtol(num + 1, 0, 16);
} else {
+ if (num[0] == 'o')
+ num++;
if (strlen(num) > 8)
yyerror("too many digits in octal character escape");
return strtol(num, 0, 8);
@@ -609,7 +611,7 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
}
<CHRLIT>(x{HEX}+|o{OCT}+) {
- yylval.chr = num_esc(yytext+1);
+ yylval.chr = num_esc(yytext);
return LITCHAR;
}
diff --git a/txr.1 b/txr.1
index 7adeee9b..275a6e8a 100644
--- a/txr.1
+++ b/txr.1
@@ -1033,9 +1033,10 @@ useful for labeling information and situations.
Character literals are introduced by the #\e syntax, which is either
followed by a character name, the letter x followed by hex digits,
-or a single character. Valid character names are: nul, alarm, backspace, tab,
-linefeed, newline, vtab, page, return, esc, space. This convention
-for character literals is similar to that of the Scheme language.
+the letter o followed by octal digits, or a single character. Valid character
+names are: nul, alarm, backspace, tab, linefeed, newline, vtab, page, return,
+esc, space. This convention for character literals is similar to that of the
+Scheme language.
.SS String Literals