summaryrefslogtreecommitdiffstats
path: root/parse.cxx
diff options
context:
space:
mode:
authorgraydon <graydon>2005-08-26 19:41:31 +0000
committergraydon <graydon>2005-08-26 19:41:31 +0000
commit7d46afb81a090ee76708497377539fdb8829e236 (patch)
treebd9a15f70c2a5bdbf3330a5377bfcc170415d888 /parse.cxx
parent7e5c9a7acc6de7faf0fd409918a510080b95bac0 (diff)
downloadsystemtap-steved-7d46afb81a090ee76708497377539fdb8829e236.tar.gz
systemtap-steved-7d46afb81a090ee76708497377539fdb8829e236.tar.xz
systemtap-steved-7d46afb81a090ee76708497377539fdb8829e236.zip
2005-08-26 Graydon Hoare <graydon@redhat.com>
* parse.cxx (scan): Preserve basic C-ish escapes. * translate.cxx (c_tmpcounter::declaring): New flag. (c_tmpcounter::declare_or_init): New helper method. (c_tmpcounter::visit_*): Use declare_or_init. (c_unparser::emit_function): Run a tmpcounter to initialize tmps. (c_unparser::emit_probe): Likewise. (c_unparser::c_strcpy): Use strlcpy. (c_unparser::c_strcat): Use strlcat.
Diffstat (limited to 'parse.cxx')
-rw-r--r--parse.cxx28
1 files changed, 26 insertions, 2 deletions
diff --git a/parse.cxx b/parse.cxx
index 5b25a9c0..4a4b973f 100644
--- a/parse.cxx
+++ b/parse.cxx
@@ -332,8 +332,32 @@ lexer::scan ()
if (c == '\"') // closing double-quotes
break;
else if (c == '\\')
- {
- // XXX: handle escape sequences
+ {
+ c = input_get ();
+ switch (c)
+ {
+ case 'a':
+ case 'b':
+ case 't':
+ case 'n':
+ case 'v':
+ case 'f':
+ case 'r':
+ case '\\':
+
+ // Pass these escapes through to the string value
+ // beign parsed; it will "likely" be emitted into
+ // a C literal.
+ //
+ // XXX: verify this assumption.
+
+ n->content.push_back('\\');
+
+ default:
+
+ n->content.push_back(c);
+ break;
+ }
}
else
n->content.push_back(c);