Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kucera2009-01-07 16:08:35 +0000
committerMike Kucera2009-01-07 16:08:35 +0000
commitdd2b180f1e6cdd10cf8590e48f7f8ff821f839f8 (patch)
tree570f4b9ba9780bf7241e5641d7a7221f1e6e5801 /lrparser/org.eclipse.cdt.core.lrparser/grammar
parente0cd7f1c94c5c26340ac5a9080f8f42a6fb665e3 (diff)
downloadorg.eclipse.cdt-dd2b180f1e6cdd10cf8590e48f7f8ff821f839f8.tar.gz
org.eclipse.cdt-dd2b180f1e6cdd10cf8590e48f7f8ff821f839f8.tar.xz
org.eclipse.cdt-dd2b180f1e6cdd10cf8590e48f7f8ff821f839f8.zip
several fixes to parsing of declarations in LR C++ parser
Diffstat (limited to 'lrparser/org.eclipse.cdt.core.lrparser/grammar')
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g36
1 files changed, 20 insertions, 16 deletions
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g
index d78bcb23616..27cad1c9588 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g
@@ -422,12 +422,15 @@ dcolon_opt
qualified_id_name
::= dcolon_opt nested_name_specifier template_opt unqualified_id_name
/. $Build consumeQualifiedId(true); $EndBuild ./
- | '::' identifier_name
- /. $Build consumeGlobalQualifiedId(); $EndBuild ./
- | '::' operator_function_id_name
- /. $Build consumeGlobalQualifiedId(); $EndBuild ./
- | '::' template_id_name
+ | '::' unqualified_id_name
/. $Build consumeGlobalQualifiedId(); $EndBuild ./
+
+ --| '::' identifier_name
+ -- /. $Build consumeGlobalQualifiedId(); $EndBuild ./
+ --| '::' operator_function_id_name
+ -- /. $Build consumeGlobalQualifiedId(); $EndBuild ./
+ --| '::' template_id_name
+ -- /. $Build consumeGlobalQualifiedId(); $EndBuild ./
@@ -959,9 +962,9 @@ declaration_specifiers
declaration_specifiers_opt
- ::=? $empty -- this option must come first for constructors to parse correctly
+ ::= declaration_specifiers
+ | $empty
/. $Build consumeEmpty(); $EndBuild ./
- | declaration_specifiers
@@ -1189,6 +1192,7 @@ namespace_alias_definition
-- | 'using' '::' unqualified_id_name ';'
+-- TODO why not just check if the second token is 'typename'?
using_declaration
::= 'using' typename_opt dcolon_opt nested_name_specifier_opt unqualified_id_name ';'
/. $Build consumeUsingDeclaration(); $EndBuild ./
@@ -1317,15 +1321,15 @@ cv_qualifier
/. $Build consumeDeclSpecToken(); $EndBuild ./
---declarator_id_name
--- ::= qualified_or_unqualified_name
--- | dcolon_opt nested_name_specifier_opt type_name
--- /. $Build consumeQualifiedId(false); $EndBuild ./
-
declarator_id_name
- ::= unqualified_id_name
- | <empty> nested_name_specifier template_opt unqualified_id_name
- /. $Build consumeQualifiedId(true); $EndBuild ./
+ ::= qualified_or_unqualified_name
+ | dcolon_opt nested_name_specifier_opt type_name
+ /. $Build consumeQualifiedId(false); $EndBuild ./
+
+--declarator_id_name
+-- ::= unqualified_id_name
+-- | <empty> nested_name_specifier template_opt unqualified_id_name
+-- /. $Build consumeQualifiedId(true); $EndBuild ./
type_id
@@ -1749,11 +1753,11 @@ template_argument_list_opt
template_argument
::= assignment_expression
+ /. $Build consumeTemplateArgumentExpression(); $EndBuild ./
| type_id
/. $Build consumeTemplateArgumentTypeId(); $EndBuild ./
--| qualified_or_unqualified_name -- accessible through assignment_expression
-
explicit_instantiation
::= 'template' declaration
/. $Build consumeTemplateExplicitInstantiation(); $EndBuild ./

Back to the top