Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kucera2008-05-13 20:25:16 +0000
committerMike Kucera2008-05-13 20:25:16 +0000
commit8a429794475be20b5689a5a6855ad5067a546160 (patch)
treee6146c8cc321f431ad066c3a3ea542f1ca86f0f3 /lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g
parent4e2a3b2bfc1daa9f36fd7aa0e40d738eac6f115f (diff)
downloadorg.eclipse.cdt-8a429794475be20b5689a5a6855ad5067a546160.tar.gz
org.eclipse.cdt-8a429794475be20b5689a5a6855ad5067a546160.tar.xz
org.eclipse.cdt-8a429794475be20b5689a5a6855ad5067a546160.zip
added support for namespaces nested inside classes
Diffstat (limited to 'lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g')
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g39
1 files changed, 6 insertions, 33 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 84cd6551dc9..60b3c26c8e3 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g
@@ -1190,36 +1190,15 @@ namespace_name
::= identifier_name
---namespace_name
--- ::= original_namespace_name
--- | namespace_alias
-
-
---original_namespace_name
--- ::= identifier_name
-
-
---namespace_alias
--- ::= identifier_token
-
-
namespace_definition
::= named_namespace_definition
| unnamed_namespace_definition
+-- In the spec grammar this is broken down into original_namespace_definition and extension_namespace_definition.
+-- But since we are not tracking identifiers it becomes the same thing, so its simplified here.
named_namespace_definition
- ::= original_namespace_definition
- | extension_namespace_definition
-
-
-original_namespace_definition
- ::= 'namespace' identifier_name '{' <openscope-ast> declaration_seq_opt '}'
- /. $Build consumeNamespaceDefinition(true); $EndBuild ./
-
-
-extension_namespace_definition
- ::= 'namespace' original_namespace_name '{' <openscope-ast> declaration_seq_opt '}'
+ ::= 'namespace' namespace_name '{' <openscope-ast> declaration_seq_opt '}'
/. $Build consumeNamespaceDefinition(true); $EndBuild ./
@@ -1228,18 +1207,11 @@ unnamed_namespace_definition
/. $Build consumeNamespaceDefinition(false); $EndBuild ./
-
-
-
namespace_alias_definition
::= 'namespace' identifier_token '=' dcolon_opt nested_name_specifier_opt namespace_name ';'
/. $Build consumeNamespaceAliasDefinition(); $EndBuild ./
---qualified_namespace_specifier
--- ::= dcolon_opt nested_name_specifier_opt namespace_name
-
-
-- make more lenient!
-- using_declaration
-- ::= 'using' typename_opt dcolon_opt nested_name_specifier unqualified_id_name ';'
@@ -1579,7 +1551,8 @@ member_declaration
/. $Build consumeMemberDeclarationQualifiedId(); $EndBuild ./
| using_declaration
| template_declaration
- | explicit_specialization -- is this spec?
+ | explicit_specialization -- not spec
+ | namespace_definition -- not spec
| visibility_label
| ERROR_TOKEN
/. $Build consumeDeclarationProblem(); $EndBuild ./
@@ -1840,7 +1813,7 @@ handler
exception_declaration
::= type_specifier_seq <openscope-ast> declarator
/. $Build consumeDeclarationSimple(true); $EndBuild ./
- | type_specifier_seq <openscope-ast> abstract_declarator -- TODO might need to be abstract_declarator_without_function, might be too lenient, what exactly can you catch?
+ | type_specifier_seq <openscope-ast> abstract_declarator
/. $Build consumeDeclarationSimple(true); $EndBuild ./
| type_specifier_seq
/. $Build consumeDeclarationSimple(false); $EndBuild ./

Back to the top