summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@khw-desktop.(none)>2010-07-15 17:28:28 -0600
committerDavid Golden <dagolden@cpan.org>2010-07-17 21:50:48 -0400
commitf0a2b745ce6c03aec6412d79ce0b782f20eddce4 (patch)
treed1786b1a4a80f6b848dca1ab4eba6e3ffd5dc5d1 /toke.c
parent8e4698ef1ed0da722532bfcc769ba22fe85c4b47 (diff)
downloadperl-f0a2b745ce6c03aec6412d79ce0b782f20eddce4.tar.gz
Add \o{} escape
This commit adds the new construct \o{} to express a character constant by its octal ordinal value, along with ancillary tests and documentation. A function to handle this is added to util.c, and it is called from the 3 parsing places it could occur. The function is a candidate for in-lining, though I doubt that it will ever be used frequently.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/toke.c b/toke.c
index b7b33e87b1..75fb327148 100644
--- a/toke.c
+++ b/toke.c
@@ -2879,6 +2879,20 @@ S_scan_const(pTHX_ char *start)
}
goto NUM_ESCAPE_INSERT;
+ /* eg. \o{24} indicates the octal constant \024 */
+ case 'o':
+ {
+ STRLEN len;
+
+ char* error = grok_bslash_o(s, &uv, &len, 1);
+ s += len;
+ if (error) {
+ yyerror(error);
+ continue;
+ }
+ goto NUM_ESCAPE_INSERT;
+ }
+
/* eg. \x24 indicates the hex constant 0x24 */
case 'x':
++s;