summaryrefslogtreecommitdiffstats
path: root/parse.cxx
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2010-02-19 17:45:50 -0500
committerFrank Ch. Eigler <fche@elastic.org>2010-02-19 17:45:50 -0500
commit489e3d510e3ed9bf4e3388084cc4de6e2749576a (patch)
tree3c9f0cc91b584e138ce39f37cfd15d5b62b0f43a /parse.cxx
parent83b38ce6107fc90de79e14edc0fea29d6dec7724 (diff)
downloadsystemtap-steved-489e3d510e3ed9bf4e3388084cc4de6e2749576a.tar.gz
systemtap-steved-489e3d510e3ed9bf4e3388084cc4de6e2749576a.tar.xz
systemtap-steved-489e3d510e3ed9bf4e3388084cc4de6e2749576a.zip
PR11208: glue adjacent string literals together.
* parse.cxx (lexer::scan): Glue adjacent strings together. * testsuite/parseko/twentyseven.stp, semok/thirtyfive.stp: New tests.
Diffstat (limited to 'parse.cxx')
-rw-r--r--parse.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/parse.cxx b/parse.cxx
index ad4f93f0..f99a440b 100644
--- a/parse.cxx
+++ b/parse.cxx
@@ -885,6 +885,7 @@ skip:
else if (c == '\"')
{
n->type = tok_string;
+ another_string:
while (1)
{
c = input_get ();
@@ -924,6 +925,19 @@ skip:
else
n->content.push_back(c);
}
+ // PR11208: check if the next token is also a string literal; auto-concatenate it
+ // This is complicated to the extent that we need to skip intermediate whitespace.
+ // XXX: but not comments
+ unsigned nspace = 0;
+ do {
+ c = input_peek(nspace++);
+ if (c == '\"') // new string literal?
+ {
+ // consume all whitespace plus the opening quote
+ while (nspace-- > 0) input_get();
+ goto another_string; // and append the rest to this token
+ }
+ } while (isspace(c));
return n;
}