diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-01-27 22:55:14 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-01-27 22:55:14 -0800 |
commit | cdc64fd7a30d68dbd930ded963a804089821d08e (patch) | |
tree | f1aef2ba7ffa512537cec183745398494662dcca | |
parent | 076313321ca0d780cfedd06ca3faa8e192cab130 (diff) | |
download | txr-cdc64fd7a30d68dbd930ded963a804089821d08e.tar.gz txr-cdc64fd7a30d68dbd930ded963a804089821d08e.tar.bz2 txr-cdc64fd7a30d68dbd930ded963a804089821d08e.zip |
* parser.l: Support hex and octal escapes in string and quasiliterals,
as the documentation says. Also support an optional trailing ;
delimiter in hex escapes.
* txr.1: Documented.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | parser.l | 5 | ||||
-rw-r--r-- | txr.1 | 9 |
3 files changed, 20 insertions, 2 deletions
@@ -1,5 +1,13 @@ 2012-01-27 Kaz Kylheku <kaz@kylheku.com> + * parser.l: Support hex and octal escapes in string and quasiliterals, + as the documentation says. Also support an optional trailing ; + delimiter in hex escapes. + + * txr.1: Documented. + +2012-01-27 Kaz Kylheku <kaz@kylheku.com> + * txr.vim: Properly show @[...] inside quasiliteral. 2012-01-27 Kaz Kylheku <kaz@kylheku.com> @@ -584,6 +584,11 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} lineno++; } +<STRLIT,QSILIT>[\\](x{HEX}+;?|o{OCT}+) { + yylval.chr = num_esc(yytext+1); + return LITCHAR; + } + <CHRLIT>(x{HEX}+|o{OCT}+) { yylval.chr = num_esc(yytext); return LITCHAR; @@ -1034,8 +1034,13 @@ for character literals is similar to that of the Scheme language. String literals are delimited by double respectively, and may not span multiple lines. A double quote within a string literal is encoded using \e" and a backslash is encoded as \e\e. Backslash escapes like \en and \et -are recognized, as are hexadecimal escapes like \exFF and octal -escapes like \e123. +are recognized, as are hexadecimal escapes like \exFF or \exxabc and octal +escapes like \e123. Ambiguity between a hex escape and subsequent +text can be resolved by using trailing semicolon delimiter: "\exabc;d" is a +string consisting of the character U+0ABC followed by "d". The semicolon +delimiter disappears. To write a literal semicolon immediately after a hex +escape, write two semicolons, the first of which will be interpreted as a +delimiter. Thus, "\ex21;;" represents "!;". .SS String Quasiliterals |