summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--parse.cxx20
-rw-r--r--parse.h3
-rwxr-xr-xtestsuite/parseok/seventeen.stp8
4 files changed, 44 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d7ff74c1..3b07b4c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-07-13 David Smith <dsmith@redhat.com>
+
+ * parse.cxx (parser::expect_unknown2): New function that looks for
+ 2 possible token types.
+ * parse.cxx (parser::expect_ident_or_keyword): New function that
+ calls parser::expect_unknown2.
+ * parse.cxx (parser::parse_symbol): Calls
+ parser::expect_ident_or_keyword to allow keywords to appear when
+ expanding target symbols (Bugzilla #2913).
+ * parse.h: Added prototypes for parser::expect_unknown2 and
+ parser::expect_ident_or_keyword.
+ * testsuite/parseok/seventeen.stp: New test to check for allowing
+ keywords when expanding target symbols.
+
2006-06-30 Josh Stone <joshua.i.stone@intel.com>
* tapsets.cxx (hrtimer_builder::build): Enable hrtimers on >=2.6.17.
diff --git a/parse.cxx b/parse.cxx
index 6a565cf4..76c1003f 100644
--- a/parse.cxx
+++ b/parse.cxx
@@ -375,6 +375,17 @@ parser::expect_unknown (token_type tt, string & target)
const token*
+parser::expect_unknown2 (token_type tt1, token_type tt2, string & target)
+{
+ const token *t = next();
+ if (!(t && (t->type == tt1 || t->type == tt2)))
+ throw parse_error ("expected " + tt2str(tt1) + " or " + tt2str(tt2));
+ target = t->content;
+ return t;
+}
+
+
+const token*
parser::expect_op (std::string const & expected)
{
return expect_known (tok_operator, expected);
@@ -405,6 +416,13 @@ parser::expect_ident (std::string & target)
}
+const token*
+parser::expect_ident_or_keyword (std::string & target)
+{
+ return expect_unknown2 (tok_identifier, tok_keyword, target);
+}
+
+
bool
parser::peek_op (std::string const & op)
{
@@ -2172,7 +2190,7 @@ parser::parse_symbol ()
if (peek_op ("->"))
{
next();
- expect_ident (c);
+ expect_ident_or_keyword (c);
tsym->components.push_back
(make_pair (target_symbol::comp_struct_member, c));
}
diff --git a/parse.h b/parse.h
index 0dcf30a2..a3b337c1 100644
--- a/parse.h
+++ b/parse.h
@@ -112,12 +112,15 @@ private:
// expectations
const token* expect_known (token_type tt, std::string const & expected);
const token* expect_unknown (token_type tt, std::string & target);
+ const token* expect_unknown2 (token_type tt1, token_type tt2,
+ std::string & target);
// convenience forms
const token* expect_op (std::string const & expected);
const token* expect_kw (std::string const & expected);
const token* expect_number (int64_t & expected);
const token* expect_ident (std::string & target);
+ const token* expect_ident_or_keyword (std::string & target);
bool peek_op (std::string const & op);
bool peek_kw (std::string const & kw);
diff --git a/testsuite/parseok/seventeen.stp b/testsuite/parseok/seventeen.stp
new file mode 100755
index 00000000..395b29aa
--- /dev/null
+++ b/testsuite/parseok/seventeen.stp
@@ -0,0 +1,8 @@
+#! stap -p1
+
+# Make sure you can use keywords in target symbol structure
+# references (Bugzilla 2193).
+
+probe kernel.function("add_timer_on") {
+ printf("%x\n", $timer->function)
+}