diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | parser.l | 4 | ||||
-rw-r--r-- | txr.1 | 7 |
3 files changed, 15 insertions, 4 deletions
@@ -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. @@ -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; } @@ -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 |