1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Added ability to pass ILanguage options to LR parser, refactored ParseHelper, partial fix for bug 253690

This commit is contained in:
Mike Kucera 2009-01-02 14:58:24 +00:00
parent 60d92373d0
commit cfa1a4f42e
69 changed files with 19408 additions and 18805 deletions

View file

@ -5775,7 +5775,7 @@ public class AST2Tests extends AST2BaseTest {
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// }; // };
public void testScalabilityOfLargeTrivialInitializer_Bug252970() throws Exception { public void testScalabilityOfLargeTrivialInitializer_Bug253690() throws Exception {
final StringBuffer[] input = getContents(3); final StringBuffer[] input = getContents(3);
StringBuilder buf= new StringBuilder(); StringBuilder buf= new StringBuilder();
buf.append(input[0].toString()); buf.append(input[0].toString());

View file

@ -1,10 +1,10 @@
#Wed Jun 18 09:56:19 CEST 2008 #Fri Jan 02 09:55:15 EST 2009
ANNOTATION_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error ANNOTATION_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Error ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Error
ANNOTATION_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error ANNOTATION_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
ANNOTATION_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error ANNOTATION_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error
ANNOTATION_ELEMENT_TYPE_ADDED_METHOD=Error ANNOTATION_ELEMENT_TYPE_ADDED_METHOD=Error
ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Warning
ANNOTATION_ELEMENT_TYPE_ADDED_TYPE_MEMBER=Error ANNOTATION_ELEMENT_TYPE_ADDED_TYPE_MEMBER=Error
ANNOTATION_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error ANNOTATION_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
ANNOTATION_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error ANNOTATION_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
@ -15,108 +15,120 @@ ANNOTATION_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error
ANNOTATION_ELEMENT_TYPE_CHANGED_TO_CLASS=Error ANNOTATION_ELEMENT_TYPE_CHANGED_TO_CLASS=Error
ANNOTATION_ELEMENT_TYPE_CHANGED_TO_ENUM=Error ANNOTATION_ELEMENT_TYPE_CHANGED_TO_ENUM=Error
ANNOTATION_ELEMENT_TYPE_CHANGED_TO_INTERFACE=Error ANNOTATION_ELEMENT_TYPE_CHANGED_TO_INTERFACE=Error
ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Warning
ANNOTATION_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error ANNOTATION_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Warning
ANNOTATION_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error ANNOTATION_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Warning
ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD_WITHOUT_DEFAULT_VALUE=Error ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD_WITHOUT_DEFAULT_VALUE=Error
ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD_WITH_DEFAULT_VALUE=Error ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD_WITH_DEFAULT_VALUE=Error
ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Warning
ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error
API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Warning
API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Warning
CLASS_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error CLASS_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
CLASS_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error CLASS_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
CLASS_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error CLASS_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error
CLASS_ELEMENT_TYPE_ADDED_METHOD=Error CLASS_ELEMENT_TYPE_ADDED_METHOD=Warning
CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Warning
CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Warning
CLASS_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error CLASS_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERCLASS_SET=Error CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERCLASS_SET=Error
CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Warning
CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Warning
CLASS_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error CLASS_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Warning
CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Warning
CLASS_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error CLASS_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error
CLASS_ELEMENT_TYPE_CHANGED_SUPERCLASS=Error CLASS_ELEMENT_TYPE_CHANGED_SUPERCLASS=Error
CLASS_ELEMENT_TYPE_CHANGED_TO_ANNOTATION=Error CLASS_ELEMENT_TYPE_CHANGED_TO_ANNOTATION=Error
CLASS_ELEMENT_TYPE_CHANGED_TO_ENUM=Error CLASS_ELEMENT_TYPE_CHANGED_TO_ENUM=Error
CLASS_ELEMENT_TYPE_CHANGED_TO_INTERFACE=Error CLASS_ELEMENT_TYPE_CHANGED_TO_INTERFACE=Error
CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Warning
CLASS_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error CLASS_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Warning
CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error CLASS_ELEMENT_TYPE_REMOVED_FIELD=Warning
CLASS_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error CLASS_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
CLASS_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error CLASS_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error
CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error CLASS_ELEMENT_TYPE_REMOVED_METHOD=Warning
CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Warning
CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Warning
CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Warning
CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error
CONSTRUCTOR_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error CONSTRUCTOR_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
CONSTRUCTOR_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error CONSTRUCTOR_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
CONSTRUCTOR_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error CONSTRUCTOR_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error
CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Warning
CONSTRUCTOR_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error CONSTRUCTOR_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Warning
CONSTRUCTOR_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error CONSTRUCTOR_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
CONSTRUCTOR_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error CONSTRUCTOR_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
CONSTRUCTOR_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error CONSTRUCTOR_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
CONSTRUCTOR_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error CONSTRUCTOR_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
CONSTRUCTOR_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error CONSTRUCTOR_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
CONSTRUCTOR_ELEMENT_TYPE_CHANGED_TYPE_PARAMETER=Error CONSTRUCTOR_ELEMENT_TYPE_CHANGED_TYPE_PARAMETER=Error
CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Warning
CONSTRUCTOR_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error CONSTRUCTOR_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
CONSTRUCTOR_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error CONSTRUCTOR_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
CONSTRUCTOR_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error CONSTRUCTOR_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
CONSTRUCTOR_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error CONSTRUCTOR_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error
CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Warning
CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error
ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Warning
ENUM_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error ENUM_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error
ENUM_ELEMENT_TYPE_CHANGED_TO_ANNOTATION=Error ENUM_ELEMENT_TYPE_CHANGED_TO_ANNOTATION=Error
ENUM_ELEMENT_TYPE_CHANGED_TO_CLASS=Error ENUM_ELEMENT_TYPE_CHANGED_TO_CLASS=Error
ENUM_ELEMENT_TYPE_CHANGED_TO_INTERFACE=Error ENUM_ELEMENT_TYPE_CHANGED_TO_INTERFACE=Error
ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Warning
ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Warning
ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error ENUM_ELEMENT_TYPE_REMOVED_FIELD=Warning
ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error ENUM_ELEMENT_TYPE_REMOVED_METHOD=Warning
FIELD_ELEMENT_TYPE_ADDED_VALUE=Error ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Warning
FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error FIELD_ELEMENT_TYPE_ADDED_VALUE=Warning
FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Warning
FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Warning
FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Warning
FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Warning
FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Warning
FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error FIELD_ELEMENT_TYPE_CHANGED_TYPE=Warning
FIELD_ELEMENT_TYPE_CHANGED_VALUE=Warning
FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Warning
FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENTS=Error FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENTS=Error
FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error FIELD_ELEMENT_TYPE_REMOVED_VALUE=Warning
ILLEGAL_EXTEND=Warning ILLEGAL_EXTEND=Warning
ILLEGAL_IMPLEMENT=Warning ILLEGAL_IMPLEMENT=Warning
ILLEGAL_INSTANTIATE=Warning ILLEGAL_INSTANTIATE=Warning
ILLEGAL_OVERRIDE=Warning ILLEGAL_OVERRIDE=Warning
ILLEGAL_REFERENCE=Warning ILLEGAL_REFERENCE=Warning
INTERFACE_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error INTERFACE_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Warning
INTERFACE_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error INTERFACE_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
INTERFACE_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error INTERFACE_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error
INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Warning
INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Warning
INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Warning
INTERFACE_ELEMENT_TYPE_ADDED_TYPE_MEMBER=Error INTERFACE_ELEMENT_TYPE_ADDED_TYPE_MEMBER=Error
INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Warning
INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETERS=Error INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETERS=Error
INTERFACE_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error INTERFACE_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Warning
INTERFACE_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error INTERFACE_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
INTERFACE_ELEMENT_TYPE_CHANGED_INTERFACE_BOUNDS=Error INTERFACE_ELEMENT_TYPE_CHANGED_INTERFACE_BOUNDS=Error
INTERFACE_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error INTERFACE_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error
INTERFACE_ELEMENT_TYPE_CHANGED_TO_ANNOTATION=Error INTERFACE_ELEMENT_TYPE_CHANGED_TO_ANNOTATION=Error
INTERFACE_ELEMENT_TYPE_CHANGED_TO_CLASS=Error INTERFACE_ELEMENT_TYPE_CHANGED_TO_CLASS=Error
INTERFACE_ELEMENT_TYPE_CHANGED_TO_ENUM=Error INTERFACE_ELEMENT_TYPE_CHANGED_TO_ENUM=Error
INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Warning
INTERFACE_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error INTERFACE_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Warning
INTERFACE_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error INTERFACE_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
INTERFACE_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error INTERFACE_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error
INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Warning
INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Warning
INVALID_JAVADOC_TAG=Ignore INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Warning
INVALID_JAVADOC_TAG=Warning
INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
LEAK_EXTEND=Warning LEAK_EXTEND=Warning
LEAK_FIELD_DECL=Warning LEAK_FIELD_DECL=Warning
LEAK_IMPLEMENT=Warning LEAK_IMPLEMENT=Warning
@ -125,26 +137,36 @@ LEAK_METHOD_RETURN_TYPE=Warning
METHOD_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error METHOD_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
METHOD_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error METHOD_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
METHOD_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error METHOD_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error
METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Warning
METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Warning
METHOD_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error METHOD_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Warning
METHOD_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error METHOD_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Warning
METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Warning
METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Warning
METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Warning
METHOD_ELEMENT_TYPE_CHANGED_TYPE_PARAMETER=Error METHOD_ELEMENT_TYPE_CHANGED_TYPE_PARAMETER=Error
METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Warning
METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Warning
METHOD_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error METHOD_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
METHOD_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error METHOD_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
METHOD_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error METHOD_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error
METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Warning
METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error
TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Warning
TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Warning
TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Warning
TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Warning
TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Warning
TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Warning
UNUSED_PROBLEM_FILTERS=Warning
eclipse.preferences.version=1 eclipse.preferences.version=1
incompatible_api_component_version=Error incompatible_api_component_version=Warning
incompatible_api_component_version_include_major_without_breaking_change=Disabled incompatible_api_component_version_include_major_without_breaking_change=Disabled
incompatible_api_component_version_include_minor_without_api_change=Disabled incompatible_api_component_version_include_minor_without_api_change=Disabled
invalid_since_tag_version=Error invalid_since_tag_version=Warning
malformed_since_tag=Error malformed_since_tag=Warning
missing_since_tag=Error missing_since_tag=Warning
report_api_breakage_when_major_version_incremented=Disabled
report_resolution_errors_api_component=Warning

View file

@ -41,13 +41,18 @@ public class LRCPPSpecFailingTest extends AST2CPPSpecFailingTest {
@Override @Override
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean checkBindings, int expectedProblemBindings ) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean checkBindings, int expectedProblemBindings ) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getCLanguage(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getCLanguage();
return ParseHelper.parse(code, language, true, checkBindings, expectedProblemBindings ); ParseHelper.Options options = new ParseHelper.Options();
options.setCheckBindings(checkBindings);
options.setExpectedProblemBindings(expectedProblemBindings);
return ParseHelper.parse(code, language, options);
} }
@Override @Override
protected IASTTranslationUnit parse(String code, ParserLanguage lang, String[] problems) throws ParserException { protected IASTTranslationUnit parse(String code, ParserLanguage lang, String[] problems) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getCLanguage(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getCLanguage();
return ParseHelper.parse(code, language, problems); ParseHelper.Options options = new ParseHelper.Options();
options.setProblems(problems);
return ParseHelper.parse(code, language, options);
} }

View file

@ -38,16 +38,22 @@ public class LRCPPSpecTest extends AST2CPPSpecTest {
parse(code, ParserLanguage.CPP, checkBindings, expectedProblemBindings); parse(code, ParserLanguage.CPP, checkBindings, expectedProblemBindings);
} }
@Override @Override
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean checkBindings, int expectedProblemBindings ) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean checkBindings, int expectedProblemBindings ) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getCLanguage(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getCLanguage();
return ParseHelper.parse(code, language, true, checkBindings, expectedProblemBindings ); ParseHelper.Options options = new ParseHelper.Options();
options.setCheckBindings(checkBindings);
options.setExpectedProblemBindings(expectedProblemBindings);
return ParseHelper.parse(code, language, options);
} }
@Override @Override
protected IASTTranslationUnit parse(String code, ParserLanguage lang, String[] problems) throws ParserException { protected IASTTranslationUnit parse(String code, ParserLanguage lang, String[] problems) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getCLanguage(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getCLanguage();
return ParseHelper.parse(code, language, problems); ParseHelper.Options options = new ParseHelper.Options();
options.setProblems(problems);
return ParseHelper.parse(code, language, options);
} }
protected BaseExtensibleLanguage getCLanguage() { protected BaseExtensibleLanguage getCLanguage() {

View file

@ -39,9 +39,13 @@ public class LRCPPTests extends AST2CPPTests {
@Override @Override
protected IASTTranslationUnit parse( String code, ParserLanguage lang, @SuppressWarnings("unused") boolean useGNUExtensions, boolean expectNoProblems, @SuppressWarnings("unused") boolean parseComments) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, @SuppressWarnings("unused") boolean useGNUExtensions, boolean expectNoProblems, boolean skipTrivialInitializers) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
return ParseHelper.parse(code, language, expectNoProblems); ParseHelper.Options options = new ParseHelper.Options();
options.setCheckSyntaxProblems(expectNoProblems);
options.setCheckPreprocessorProblems(expectNoProblems);
options.setSkipTrivialInitializers(skipTrivialInitializers);
return ParseHelper.parse(code, language, options);
} }
protected ILanguage getC99Language() { protected ILanguage getC99Language() {

View file

@ -41,13 +41,22 @@ public class LRCSpecTests extends AST2CSpecTest {
@Override @Override
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean checkBindings, int expectedProblemBindings ) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean checkBindings, int expectedProblemBindings ) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getCLanguage(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getCLanguage();
return ParseHelper.parse(code, language, true, checkBindings, expectedProblemBindings ); ParseHelper.Options options = new ParseHelper.Options();
options.setCheckSyntaxProblems(true);
options.setCheckPreprocessorProblems(true);
options.setCheckBindings(checkBindings);
options.setExpectedProblemBindings(expectedProblemBindings);
return ParseHelper.parse(code, language, options);
} }
@Override @Override
protected IASTTranslationUnit parse(String code, ParserLanguage lang, String[] problems) throws ParserException { protected IASTTranslationUnit parse(String code, ParserLanguage lang, String[] problems) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getCLanguage(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getCLanguage();
return ParseHelper.parse(code, language, problems); ParseHelper.Options options = new ParseHelper.Options();
options.setProblems(problems);
options.setCheckSyntaxProblems(true);
options.setCheckPreprocessorProblems(true);
return ParseHelper.parse(code, language, options);
} }
protected ILanguage getCLanguage() { protected ILanguage getCLanguage() {

View file

@ -42,9 +42,13 @@ public class LRCommentTests extends CommentTests {
@SuppressWarnings("unused") @SuppressWarnings("unused")
protected IASTTranslationUnit parse(String code, ParserLanguage lang, protected IASTTranslationUnit parse(String code, ParserLanguage lang,
boolean useGNUExtensions, boolean expectNoProblems, boolean useGNUExtensions, boolean expectNoProblems,
boolean parseComments) throws ParserException { boolean skipTrivialInitializers) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
ParseHelper.Options options = new ParseHelper.Options();
options.setCheckSyntaxProblems(expectNoProblems);
options.setCheckPreprocessorProblems(expectNoProblems);
options.setSkipTrivialInitializers(skipTrivialInitializers);
return ParseHelper.commentParse(code, language); return ParseHelper.commentParse(code, language);
} }

View file

@ -35,7 +35,8 @@ public class LRDOMLocationMacroTests extends DOMLocationMacroTests {
@SuppressWarnings("unused") @SuppressWarnings("unused")
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
return ParseHelper.parse(code, language, expectNoProblems); ParseHelper.Options options = new ParseHelper.Options().setCheckSyntaxProblems(expectNoProblems).setCheckPreprocessorProblems(expectNoProblems);
return ParseHelper.parse(code, language, options);
} }

View file

@ -35,7 +35,8 @@ public class LRDOMLocationTests extends DOMLocationTests {
@SuppressWarnings("unused") @SuppressWarnings("unused")
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
return ParseHelper.parse(code, language, expectNoProblems); ParseHelper.Options options = new ParseHelper.Options().setCheckSyntaxProblems(expectNoProblems).setCheckPreprocessorProblems(expectNoProblems);
return ParseHelper.parse(code, language, options);
} }
protected ILanguage getC99Language() { protected ILanguage getC99Language() {

View file

@ -31,7 +31,8 @@ public class LRDOMPreprocessorInformationTest extends DOMPreprocessorInformation
@SuppressWarnings("unused") @SuppressWarnings("unused")
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
return ParseHelper.parse(code, language, expectNoProblems); ParseHelper.Options options = new ParseHelper.Options().setCheckSyntaxProblems(expectNoProblems).setCheckPreprocessorProblems(expectNoProblems);
return ParseHelper.parse(code, language, options);
} }

View file

@ -52,7 +52,10 @@ public class LRDigraphTrigraphTests extends TestCase {
protected IASTTranslationUnit parse(String code) { protected IASTTranslationUnit parse(String code) {
return ParseHelper.parse(code, getCLanguage(), true); ParseHelper.Options options = new ParseHelper.Options();
options.setCheckSyntaxProblems(true);
options.setCheckPreprocessorProblems(true);
return ParseHelper.parse(code, getCLanguage(), options);
} }

View file

@ -35,7 +35,8 @@ public class LRGCCTests extends GCCTests {
@SuppressWarnings("unused") @SuppressWarnings("unused")
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
return ParseHelper.parse(code, language, expectNoProblems); ParseHelper.Options options = new ParseHelper.Options().setCheckSyntaxProblems(expectNoProblems).setCheckPreprocessorProblems(expectNoProblems);
return ParseHelper.parse(code, language, options);
} }

View file

@ -32,9 +32,13 @@ public class LRImageLocationTests extends ImageLocationTests {
@Override @Override
@SuppressWarnings("unused") @SuppressWarnings("unused")
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions,
boolean expectNoProblems, boolean parseComments) throws ParserException { boolean expectNoProblems, boolean skipTrivialInitializers) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
return ParseHelper.parse(code, language, expectNoProblems); ParseHelper.Options options = new ParseHelper.Options();
options.setCheckSyntaxProblems(expectNoProblems);
options.setCheckPreprocessorProblems(expectNoProblems);
options.setSkipTrivialInitializers(skipTrivialInitializers);
return ParseHelper.parse(code, language, options);
} }
protected ILanguage getC99Language() { protected ILanguage getC99Language() {

View file

@ -34,9 +34,13 @@ public class LRNodeSelectorTest extends ASTNodeSelectorTest {
@Override @Override
protected IASTTranslationUnit parse( String code, ParserLanguage lang, @SuppressWarnings("unused") boolean useGNUExtensions, boolean expectNoProblems, @SuppressWarnings("unused") boolean parseComments) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, @SuppressWarnings("unused") boolean useGNUExtensions, boolean expectNoProblems, boolean skipTrivialInitializer) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
return ParseHelper.parse(code, language, expectNoProblems); ParseHelper.Options options = new ParseHelper.Options();
options.setCheckSyntaxProblems(expectNoProblems);
options.setCheckPreprocessorProblems(expectNoProblems);
options.setSkipTrivialInitializers(skipTrivialInitializer);
return ParseHelper.parse(code, language, options);
} }
@Override @Override

View file

@ -13,11 +13,8 @@ import junit.framework.AssertionFailedError;
import org.eclipse.cdt.core.dom.lrparser.c99.C99Language; import org.eclipse.cdt.core.dom.lrparser.c99.C99Language;
import org.eclipse.cdt.core.dom.lrparser.cpp.ISOCPPLanguage; import org.eclipse.cdt.core.dom.lrparser.cpp.ISOCPPLanguage;
import org.eclipse.cdt.core.model.ILanguage; import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.parser.CodeReader;
import org.eclipse.cdt.core.parser.ParserLanguage; import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.core.parser.ScannerInfo;
import org.eclipse.cdt.core.parser.tests.ast2.QuickParser2Tests; import org.eclipse.cdt.core.parser.tests.ast2.QuickParser2Tests;
import org.eclipse.cdt.core.parser.tests.scanner.FileCodeReaderFactory;
public class LRQuickParser2Tests extends QuickParser2Tests { public class LRQuickParser2Tests extends QuickParser2Tests {
@ -29,9 +26,11 @@ public class LRQuickParser2Tests extends QuickParser2Tests {
protected void parse(String code, boolean expectedToPass, protected void parse(String code, boolean expectedToPass,
ParserLanguage lang, @SuppressWarnings("unused") boolean gcc) throws Exception { ParserLanguage lang, @SuppressWarnings("unused") boolean gcc) throws Exception {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
CodeReader reader = new CodeReader(code.toCharArray());
// don't check preprocessor problems for this test suite (causes tons of failures) // don't check preprocessor problems for this test suite (causes tons of failures)
ParseHelper.parse(reader, language, new ScannerInfo(), FileCodeReaderFactory.getInstance(), expectedToPass, false, 0, null, false); ParseHelper.Options options = new ParseHelper.Options();
options.setCheckSyntaxProblems(expectedToPass);
options.setCheckPreprocessorProblems(false);
ParseHelper.parse(code, language, options);
} }

View file

@ -56,8 +56,10 @@ public class LRSelectionParseTest extends AST2SelectionParseTest {
@Override @Override
protected IASTNode parse(String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems, int offset, int length) throws ParserException { protected IASTNode parse(String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems, int offset, int length) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
ParseHelper.Options options = new ParseHelper.Options();
IASTTranslationUnit tu = ParseHelper.parse(code, language, useGNUExtensions, expectNoProblems, 0); options.setCheckPreprocessorProblems(expectNoProblems);
options.setCheckSyntaxProblems(expectNoProblems);
IASTTranslationUnit tu = ParseHelper.parse(code, language, options);
return tu.selectNodeForLocation(tu.getFilePath(), offset, length); return tu.selectNodeForLocation(tu.getFilePath(), offset, length);
} }
@ -68,7 +70,13 @@ public class LRSelectionParseTest extends AST2SelectionParseTest {
String fileName = file.getLocation().toOSString(); String fileName = file.getLocation().toOSString();
ICodeReaderFactory fileCreator = SavedCodeReaderFactory.getInstance(); ICodeReaderFactory fileCreator = SavedCodeReaderFactory.getInstance();
CodeReader reader = fileCreator.createCodeReaderForTranslationUnit(fileName); CodeReader reader = fileCreator.createCodeReaderForTranslationUnit(fileName);
return ParseHelper.parse(reader, language, scanInfo, fileCreator, expectNoProblems, true, 0, null, true);
ParseHelper.Options options = new ParseHelper.Options();
options.setCheckPreprocessorProblems(expectNoProblems);
options.setCheckSyntaxProblems(expectNoProblems);
options.setCheckBindings(true);
return ParseHelper.parse(reader, language, scanInfo, fileCreator, options);
} }
@Override @Override

View file

@ -32,9 +32,13 @@ public class LRSemanticsTests extends SemanticsTests {
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Override @Override
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions,
boolean expectNoProblems, boolean parseComments) throws ParserException { boolean expectNoProblems, boolean skipTrivialInitializers) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
return ParseHelper.parse(code, language, expectNoProblems); ParseHelper.Options options = new ParseHelper.Options();
options.setCheckSyntaxProblems(expectNoProblems);
options.setCheckPreprocessorProblems(expectNoProblems);
options.setSkipTrivialInitializers(skipTrivialInitializers);
return ParseHelper.parse(code, language, options);
} }
protected ILanguage getC99Language() { protected ILanguage getC99Language() {

View file

@ -30,14 +30,17 @@ public class LRTaskParserTest extends TaskParserTest {
@Override @Override
@SuppressWarnings("unused") @SuppressWarnings("unused")
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); return parse(code, lang, useGNUExtensions, expectNoProblems, false);
return ParseHelper.parse(code, language, expectNoProblems);
} }
@Override @Override
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems, @SuppressWarnings("unused") boolean parseComments) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems, boolean skipTrivialInitializers) throws ParserException {
return parse(code,lang, useGNUExtensions, expectNoProblems ); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
ParseHelper.Options options = new ParseHelper.Options();
options.setCheckSyntaxProblems(expectNoProblems);
options.setCheckPreprocessorProblems(expectNoProblems);
options.setSkipTrivialInitializers(skipTrivialInitializers);
return ParseHelper.parse(code, language, options);
} }
protected ILanguage getC99Language() { protected ILanguage getC99Language() {

View file

@ -31,9 +31,13 @@ public class LRTemplateTests extends AST2TemplateTests {
@Override @Override
@SuppressWarnings("unused") @SuppressWarnings("unused")
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems, boolean parseComments) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems, boolean skipTrivialInitializers) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
return ParseHelper.parse(code, language, expectNoProblems); ParseHelper.Options options = new ParseHelper.Options();
options.setCheckSyntaxProblems(expectNoProblems);
options.setCheckPreprocessorProblems(expectNoProblems);
options.setSkipTrivialInitializers(skipTrivialInitializers);
return ParseHelper.parse(code, language, options);
} }
protected ILanguage getC99Language() { protected ILanguage getC99Language() {

View file

@ -42,14 +42,18 @@ public class LRTests extends AST2Tests {
@Override @Override
protected IASTTranslationUnit parse( String code, ParserLanguage lang, @SuppressWarnings("unused") boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException {
ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language(); return parse(code, lang, useGNUExtensions, expectNoProblems, false);
return ParseHelper.parse(code, language, expectNoProblems);
} }
@Override @Override
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems, @SuppressWarnings("unused") boolean parseComments) throws ParserException { protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems, boolean skipTrivialInitializers) throws ParserException {
return parse(code,lang, useGNUExtensions, expectNoProblems ); ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
ParseHelper.Options options = new ParseHelper.Options();
options.setCheckSyntaxProblems(expectNoProblems);
options.setCheckPreprocessorProblems(expectNoProblems);
options.setSkipTrivialInitializers(skipTrivialInitializers);
return ParseHelper.parse(code, language, options);
} }
protected ILanguage getC99Language() { protected ILanguage getC99Language() {

View file

@ -76,55 +76,83 @@ public class ParseHelper {
public static IASTTranslationUnit parse(char[] code, ILanguage lang, boolean expectNoProblems, boolean checkBindings, int expectedProblemBindings) { public static class Options {
CodeReader codeReader = new CodeReader(code);
return parse(codeReader, lang, new ScannerInfo(), null, expectNoProblems, checkBindings, expectedProblemBindings, null, expectNoProblems); boolean checkSyntaxProblems = true;
boolean checkPreprocessorProblems = true;
boolean checkBindings = false;
int expectedProblemBindings;
String[] problems;
boolean skipTrivialInitializers;
public Options setCheckSyntaxProblems(boolean checkSyntaxProblems) {
this.checkSyntaxProblems = checkSyntaxProblems;
return this;
}
public Options setCheckBindings(boolean checkBindings) {
this.checkBindings = checkBindings;
return this;
}
public Options setCheckPreprocessorProblems(boolean checkPreprocessorProblems) {
this.checkPreprocessorProblems = checkPreprocessorProblems;
return this;
}
public Options setExpectedProblemBindings(int expectedProblemBindings) {
this.expectedProblemBindings = expectedProblemBindings;
return this;
}
public Options setProblems(String[] problems) {
this.problems = problems;
setExpectedProblemBindings(problems.length);
setCheckBindings(true);
return this;
}
public Options setSkipTrivialInitializers(boolean skipTrivialInitializers) {
this.skipTrivialInitializers = skipTrivialInitializers;
return this;
} }
public static IASTTranslationUnit parse(String code, ILanguage lang, boolean expectNoProblems, boolean checkBindings, int expectedProblemBindings) {
return parse(code.toCharArray(), lang, expectNoProblems, checkBindings, expectedProblemBindings);
} }
public static IASTTranslationUnit parse(String code, ILanguage lang, boolean expectNoProblems) { public static IASTTranslationUnit parse(String code, ILanguage lang, boolean expectNoProblems) {
return parse(code, lang, expectNoProblems, false, 0); Options options = new Options().setCheckSyntaxProblems(expectNoProblems).setCheckPreprocessorProblems(expectNoProblems);
return parse(code.toCharArray(), lang, options);
} }
public static IASTTranslationUnit parse(String code, ILanguage lang, String[] problems) { public static IASTTranslationUnit parse(String code, ILanguage lang, Options options) {
CodeReader codeReader = new CodeReader(code.toCharArray()); return parse(code.toCharArray(), lang, options);
return parse(codeReader, lang, new ScannerInfo(), null, true, true, problems.length, problems, true); }
public static IASTTranslationUnit parse(char[] code, ILanguage lang, Options options) {
CodeReader codeReader = new CodeReader(code);
return parse(codeReader, lang, new ScannerInfo(), null, options);
} }
/** /**
* TODO thats WAY too many parameters, need to use a parameter object, need to refactor the * TODO thats WAY too many parameters, need to use a parameter object, need to refactor the
* DOM parser test suite so that its a lot cleaner. * DOM parser test suite so that its a lot cleaner.
*
* @param codeReader
* @param language
* @param scanInfo
* @param fileCreator
* @param checkSyntaxProblems
* @param checkBindings
* @param expectedProblemBindings
* @param problems
* @param checkPreprocessorProblems
* @return
*/ */
public static IASTTranslationUnit parse(CodeReader codeReader, ILanguage language, IScannerInfo scanInfo, public static IASTTranslationUnit parse(CodeReader codeReader, ILanguage language, IScannerInfo scanInfo,
ICodeReaderFactory fileCreator, boolean checkSyntaxProblems, ICodeReaderFactory fileCreator, Options options) {
boolean checkBindings, int expectedProblemBindings, String[] problems,
boolean checkPreprocessorProblems) {
testsRun++; testsRun++;
IASTTranslationUnit tu; IASTTranslationUnit tu;
try { try {
tu = language.getASTTranslationUnit(codeReader, scanInfo, fileCreator, null, ParserUtil.getParserLogService()); int languageOptions = 0;
if(options.skipTrivialInitializers)
languageOptions |= ILanguage.OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS;
tu = language.getASTTranslationUnit(codeReader, scanInfo, fileCreator, null, languageOptions, ParserUtil.getParserLogService());
} catch (CoreException e) { } catch (CoreException e) {
throw new AssertionFailedError(e.toString()); throw new AssertionFailedError(e.toString());
} }
// should parse correctly first before we look at the bindings // should parse correctly first before we look at the bindings
if(checkSyntaxProblems) { if(options.checkSyntaxProblems) {
// this should work for C++ also, CVisitor.getProblems() and CPPVisitor.getProblems() are exactly the same code! // this should work for C++ also, CVisitor.getProblems() and CPPVisitor.getProblems() are exactly the same code!
if (CVisitor.getProblems(tu).length != 0) { if (CVisitor.getProblems(tu).length != 0) {
@ -132,22 +160,22 @@ public class ParseHelper {
} }
} }
if(checkPreprocessorProblems) { if(options.checkPreprocessorProblems) {
if (tu.getPreprocessorProblems().length != 0) { if (tu.getPreprocessorProblems().length != 0) {
throw new AssertionFailedError(language.getName() + " TranslationUnit has Preprocessor Problems " ); throw new AssertionFailedError(language.getName() + " TranslationUnit has Preprocessor Problems " );
} }
} }
// resolve all bindings // resolve all bindings
if (checkBindings) { if (options.checkBindings) {
NameResolver res = new NameResolver(); NameResolver res = new NameResolver();
tu.accept( res ); tu.accept( res );
if(res.problemBindings.size() != expectedProblemBindings) if(res.problemBindings.size() != options.expectedProblemBindings)
throw new AssertionFailedError("Expected " + expectedProblemBindings + " problem(s), encountered " + res.problemBindings.size()); throw new AssertionFailedError("Expected " + options.expectedProblemBindings + " problem(s), encountered " + res.problemBindings.size());
if(problems != null) { if(options.problems != null) {
for(int i = 0; i < problems.length; i++) { for(int i = 0; i < options.problems.length; i++) {
String expected = problems[i]; String expected = options.problems[i];
String actual = res.problemBindings.get(i); String actual = res.problemBindings.get(i);
if(!expected.equals(actual)) if(!expected.equals(actual))
throw new AssertionFailedError(String.format("Problem binding not equal, expected: %s, got: %s", expected, actual)); throw new AssertionFailedError(String.format("Problem binding not equal, expected: %s, got: %s", expected, actual));

View file

@ -890,8 +890,19 @@ function_direct_abstract_declarator
initializer initializer
::= assignment_expression ::= assignment_expression
/. $Build consumeInitializer(); $EndBuild ./ /. $Build consumeInitializer(); $EndBuild ./
| '{' <openscope-ast> initializer_list comma_opt '}' | start_initializer_list '{' <openscope-ast> initializer_list comma_opt '}' end_initializer_list
/. $Build consumeInitializerList(); $EndBuild ./ /. $Build consumeInitializerList(); $EndBuild ./
| '{' <openscope-ast> '}'
/. $Build consumeInitializerList(); $EndBuild ./
start_initializer_list
::= $empty
/. $Build initializerListStart(); $EndBuild ./
end_initializer_list
::= $empty
/. $Build initializerListEnd(); $EndBuild ./
initializer_list initializer_list

View file

@ -66,8 +66,9 @@ $Headers
public $action_type() { // constructor public $action_type() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new $build_action_class($node_factory_create_expression, this, tu); action = new $build_action_class($node_factory_create_expression, this, tu);
action.setParserOptions(options);
} }
@ -77,10 +78,10 @@ $Headers
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // -1 means full error handling final int errorRepairCount = -1; // -1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse

View file

@ -178,13 +178,15 @@ $Headers
public $action_type() { // constructor public $action_type() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
// binding resolution actions need access to IASTName nodes, temporary // binding resolution actions need access to IASTName nodes, temporary
action = new $action_class(); action = new $action_class();
//action.resolver = new $resolve_action_class(this); //action.resolver = new $resolve_action_class(this);
action.builder = new $build_action_class($node_factory_create_expression, this, tu); action.builder = new $build_action_class($node_factory_create_expression, this, tu);
//action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols); //action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols);
action.builder.setParserOptions(options);
// comment this line to use with backtracking parser // comment this line to use with backtracking parser
//setParserAction(action); //setParserAction(action);
} }
@ -196,10 +198,10 @@ $Headers
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // _1 means full error handling final int errorRepairCount = -1; // _1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -1451,14 +1453,22 @@ initializer
initializer_clause initializer_clause
::= assignment_expression ::= assignment_expression
/. $Build consumeInitializer(); $EndBuild ./ /. $Build consumeInitializer(); $EndBuild ./
| '{' <openscope-ast> initializer_list ',' '}' | start_initializer_list '{' <openscope-ast> initializer_list ',' '}' end_initializer_list
/. $Build consumeInitializerList(); $EndBuild ./ /. $Build consumeInitializerList(); $EndBuild ./
| '{' <openscope-ast> initializer_list '}' | start_initializer_list '{' <openscope-ast> initializer_list '}' end_initializer_list
/. $Build consumeInitializerList(); $EndBuild ./ /. $Build consumeInitializerList(); $EndBuild ./
| '{' <openscope-ast> '}' | '{' <openscope-ast> '}'
/. $Build consumeInitializerList(); $EndBuild ./ /. $Build consumeInitializerList(); $EndBuild ./
start_initializer_list
::= $empty
/. $Build initializerListStart(); $EndBuild ./
end_initializer_list
::= $empty
/. $Build initializerListEnd(); $EndBuild ./
initializer_list initializer_list
::= initializer_clause ::= initializer_clause
| initializer_list ',' initializer_clause | initializer_list ',' initializer_clause

View file

@ -10,11 +10,16 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.lrparser; package org.eclipse.cdt.core.dom.lrparser;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.core.dom.ICodeReaderFactory; import org.eclipse.cdt.core.dom.ICodeReaderFactory;
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode; import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage; import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration; import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration;
import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.model.AbstractLanguage; import org.eclipse.cdt.core.model.AbstractLanguage;
@ -41,8 +46,8 @@ import org.eclipse.core.runtime.CoreException;
public abstract class BaseExtensibleLanguage extends AbstractLanguage { public abstract class BaseExtensibleLanguage extends AbstractLanguage {
private static final boolean DEBUG_PRINT_GCC_AST = false; private static final boolean DEBUG_PRINT_GCC_AST = true;
private static final boolean DEBUG_PRINT_AST = false; private static final boolean DEBUG_PRINT_AST = true;
/** /**
@ -96,8 +101,8 @@ public abstract class BaseExtensibleLanguage extends AbstractLanguage {
IASTTranslationUnit gtu = null; IASTTranslationUnit gtu = null;
if(DEBUG_PRINT_GCC_AST) { if(DEBUG_PRINT_GCC_AST) {
ILanguage gppLanguage = GCCLanguage.getDefault(); ILanguage gppLanguage = getParserLanguage() == ParserLanguage.CPP ? GPPLanguage.getDefault() : GCCLanguage.getDefault();
gtu = gppLanguage.getASTTranslationUnit(reader, scanInfo, fileCreator, index, log); gtu = gppLanguage.getASTTranslationUnit(reader, scanInfo, fileCreator, index, options, log);
System.out.println(); System.out.println();
System.out.println("********************************************************"); System.out.println("********************************************************");
@ -121,7 +126,16 @@ public abstract class BaseExtensibleLanguage extends AbstractLanguage {
IParser parser = getParser(); IParser parser = getParser();
CPreprocessorAdapter.runCPreprocessor(preprocessor, parser, getTokenMap(), tu); CPreprocessorAdapter.runCPreprocessor(preprocessor, parser, getTokenMap(), tu);
parser.parse(tu); // The parser will fill in the rest of the AST Set<IParser.Options> parserOptions = new HashSet<IParser.Options>();
//if((options & OPTION_SKIP_FUNCTION_BODIES) != 0)
// parserOptions.add(IParser.Options.OPTION_SKIP_FUNCTION_BODIES);
if((options & OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS) != 0)
parserOptions.add(IParser.Options.OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS);
if(!parserOptions.isEmpty())
parserOptions = EnumSet.copyOf(parserOptions);
parser.parse(tu, parserOptions); // The parser will fill in the rest of the AST
// the TU is marked as either a source file or a header file // the TU is marked as either a source file or a header file
tu.setIsHeaderUnit((options & OPTION_IS_SOURCE_UNIT) == 0); tu.setIsHeaderUnit((options & OPTION_IS_SOURCE_UNIT) == 0);
@ -172,18 +186,14 @@ public abstract class BaseExtensibleLanguage extends AbstractLanguage {
CPreprocessorAdapter.runCPreprocessor(preprocessor, parser, getTokenMap(), tu); CPreprocessorAdapter.runCPreprocessor(preprocessor, parser, getTokenMap(), tu);
// the parser will fill in the rest of the AST // the parser will fill in the rest of the AST
IASTCompletionNode completionNode = parser.parse(tu); Set<IParser.Options> parserOptions = EnumSet.of(IParser.Options.OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS);
IASTCompletionNode completionNode = parser.parse(tu, parserOptions);
if(DEBUG_PRINT_AST) { if(DEBUG_PRINT_AST) {
System.out.println("Base Extensible Language AST:"); System.out.println("Base Extensible Language AST:");
printCompletionNode(completionNode); printCompletionNode(completionNode);
} }
// List<String> messages = ASTComparer.compare(completionNode.getTranslationUnit(), cn.getTranslationUnit());
// for(String m : messages) {
// System.out.println(m);
// }
return completionNode; return completionNode;
} }

View file

@ -10,9 +10,13 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.lrparser; package org.eclipse.cdt.core.dom.lrparser;
import java.util.EnumSet;
import java.util.Set;
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode; import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.model.ILanguage;
/** /**
@ -22,6 +26,30 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
*/ */
public interface IParser extends ITokenCollector { public interface IParser extends ITokenCollector {
/**
* Options used by implementations of IParser. Some of the options
* may be duplicates of the options in ILanguage.
* @see ILanguage
*/
public enum Options {
/**
* The LR parsers do not actually skip the parsing of function bodies,
* but this option does have the effect of not generating AST nodes
* for function bodies.
*/
//OPTION_SKIP_FUNCTION_BODIES,
/**
* Instructs the parser not to create AST nodes for expressions
* within aggregate initializers when they do not contain names.
*
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=253690
*/
OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS,
}
/** /**
* Performs the actual parse. * Performs the actual parse.
* *
@ -34,10 +62,13 @@ public interface IParser extends ITokenCollector {
* If the parser encounters a completion token then a completion node * If the parser encounters a completion token then a completion node
* is returned, null is returned otherwise. * is returned, null is returned otherwise.
* *
* @param tu An IASTTranslationUnit instance that will have its declarators filled in. * @param tu An IASTTranslationUnit instance that will have its declarations filled in.
* @param options a Set of parser options, use an EnumSet
* @return a completion node if a completion token is encountered during the parser, null otherwise. * @return a completion node if a completion token is encountered during the parser, null otherwise.
* @throws NullPointerException if either parameter is null
* @see EnumSet
*/ */
public IASTCompletionNode parse(IASTTranslationUnit tu); public IASTCompletionNode parse(IASTTranslationUnit tu, Set<Options> options);
/** /**

View file

@ -10,7 +10,9 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.lrparser.action; package org.eclipse.cdt.core.dom.lrparser.action;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set;
import lpg.lpgjavaruntime.IToken; import lpg.lpgjavaruntime.IToken;
@ -71,6 +73,7 @@ import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
import org.eclipse.cdt.core.parser.IProblem; import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.core.parser.util.DebugUtil; import org.eclipse.cdt.core.parser.util.DebugUtil;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
import org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit; import org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression; import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousStatement; import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousStatement;
@ -118,6 +121,9 @@ public abstract class BuildASTParserAction {
/** Abstract factory for creating AST node objects */ /** Abstract factory for creating AST node objects */
private final INodeFactory nodeFactory; private final INodeFactory nodeFactory;
/** Options that change the behavior of the parser actions */
protected Set<IParser.Options> options = EnumSet.noneOf(IParser.Options.class);
/** /**
* Completion tokens are represented by different kinds by different parsers. * Completion tokens are represented by different kinds by different parsers.
@ -171,6 +177,10 @@ public abstract class BuildASTParserAction {
} }
public void setParserOptions(Set<IParser.Options> options) {
this.options = options == null ? EnumSet.noneOf(IParser.Options.class) : options;
}
/** /**
* Creates a completion node if one does not yet exist and adds the * Creates a completion node if one does not yet exist and adds the
* given name to it. * given name to it.
@ -296,7 +306,7 @@ public abstract class BuildASTParserAction {
secondaryParser.setTokens(tokens); secondaryParser.setTokens(tokens);
// need to pass tu because any new completion nodes need to be linked directly to the root // need to pass tu because any new completion nodes need to be linked directly to the root
IASTCompletionNode compNode = secondaryParser.parse(tu); IASTCompletionNode compNode = secondaryParser.parse(tu, options);
addNameToCompletionNode(compNode); addNameToCompletionNode(compNode);
IASTNode result = secondaryParser.getSecondaryParseResult(); IASTNode result = secondaryParser.getSecondaryParseResult();
@ -1389,6 +1399,16 @@ public abstract class BuildASTParserAction {
} }
private int initializerListNestingLevel = 0;
public void initializerListStart() {
initializerListNestingLevel++;
}
public void initializerListEnd() {
initializerListNestingLevel--;
}
/** /**
* initializer ::= assignment_expression * initializer ::= assignment_expression
*/ */
@ -1396,6 +1416,11 @@ public abstract class BuildASTParserAction {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTExpression expr = (IASTExpression) astStack.pop(); IASTExpression expr = (IASTExpression) astStack.pop();
if(discardInitializer(expr)) {
astStack.push(null);
return;
}
IASTInitializerExpression initializer = nodeFactory.newInitializerExpression(expr); IASTInitializerExpression initializer = nodeFactory.newInitializerExpression(expr);
setOffsetAndLength(initializer); setOffsetAndLength(initializer);
astStack.push(initializer); astStack.push(initializer);
@ -1404,6 +1429,14 @@ public abstract class BuildASTParserAction {
} }
private boolean discardInitializer(IASTExpression expression) {
return initializerListNestingLevel > 0
&& options.contains(IParser.Options.OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS)
&& !ASTQueries.canContainName(expression);
}
/** /**
* initializer ::= '{' <openscope> initializer_list '}' * initializer ::= '{' <openscope> initializer_list '}'
* | '{' <openscope> initializer_list ',' '}' * | '{' <openscope> initializer_list ',' '}'
@ -1424,6 +1457,8 @@ public abstract class BuildASTParserAction {
/** /**
* struct_declarator * struct_declarator
* ::= ':' constant_expression * ::= ':' constant_expression

View file

@ -169,8 +169,9 @@ private C99BuildASTParserAction action;
public C99ExpressionParser() { // constructor public C99ExpressionParser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new C99BuildASTParserAction ( CNodeFactory.getDefault() , this, tu); action = new C99BuildASTParserAction ( CNodeFactory.getDefault() , this, tu);
action.setParserOptions(options);
} }
@ -180,10 +181,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // -1 means full error handling final int errorRepairCount = -1; // -1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -1159,99 +1160,117 @@ public C99ExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 279: initializer ::= { <openscope-ast> initializer_list comma_opt } // Rule 279: initializer ::= start_initializer_list { <openscope-ast> initializer_list comma_opt } end_initializer_list
// //
case 279: { action. consumeInitializerList(); break; case 279: { action. consumeInitializerList(); break;
} }
// //
// Rule 284: designated_initializer ::= <openscope-ast> designation = initializer // Rule 280: initializer ::= { <openscope-ast> }
// //
case 284: { action. consumeInitializerDesignated(); break; case 280: { action. consumeInitializerList(); break;
} }
// //
// Rule 288: designator_base ::= [ constant_expression ] // Rule 281: start_initializer_list ::= $Empty
// //
case 288: { action. consumeDesignatorArray(); break; case 281: { action. initializerListStart(); break;
} }
// //
// Rule 289: designator_base ::= . identifier_or_typedefname // Rule 282: end_initializer_list ::= $Empty
// //
case 289: { action. consumeDesignatorField(); break; case 282: { action. initializerListEnd(); break;
} }
// //
// Rule 290: designator ::= [ constant_expression ] // Rule 287: designated_initializer ::= <openscope-ast> designation = initializer
// //
case 290: { action. consumeDesignatorArray(); break; case 287: { action. consumeInitializerDesignated(); break;
} }
// //
// Rule 291: designator ::= . identifier_or_typedefname // Rule 291: designator_base ::= [ constant_expression ]
// //
case 291: { action. consumeDesignatorField(); break; case 291: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 292: translation_unit ::= external_declaration_list // Rule 292: designator_base ::= . identifier_or_typedefname
// //
case 292: { action. consumeTranslationUnit(); break; case 292: { action. consumeDesignatorField(); break;
} }
// //
// Rule 293: translation_unit ::= $Empty // Rule 293: designator ::= [ constant_expression ]
// //
case 293: { action. consumeTranslationUnit(); break; case 293: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 298: external_declaration ::= ; // Rule 294: designator ::= . identifier_or_typedefname
// //
case 298: { action. consumeDeclarationEmpty(); break; case 294: { action. consumeDesignatorField(); break;
} }
// //
// Rule 299: external_declaration ::= ERROR_TOKEN // Rule 295: translation_unit ::= external_declaration_list
// //
case 299: { action. consumeDeclarationProblem(); break; case 295: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 302: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body // Rule 296: translation_unit ::= $Empty
// //
case 302: { action. consumeFunctionDefinition(true); break; case 296: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 303: function_definition ::= <openscope-ast> function_declarator function_body // Rule 301: external_declaration ::= ;
// //
case 303: { action. consumeFunctionDefinition(false); break; case 301: { action. consumeDeclarationEmpty(); break;
} }
// //
// Rule 304: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement // Rule 302: external_declaration ::= ERROR_TOKEN
// //
case 304: { action. consumeFunctionDefinitionKnR(); break; case 302: { action. consumeDeclarationProblem(); break;
} }
// //
// Rule 305: function_body ::= { } // Rule 305: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body
// //
case 305: { action. consumeStatementCompoundStatement(false); break; case 305: { action. consumeFunctionDefinition(true); break;
} }
// //
// Rule 306: function_body ::= { <openscope-ast> block_item_list } // Rule 306: function_definition ::= <openscope-ast> function_declarator function_body
// //
case 306: { action. consumeStatementCompoundStatement(true); break; case 306: { action. consumeFunctionDefinition(false); break;
} }
// //
// Rule 308: expression_parser_start ::= ERROR_TOKEN // Rule 307: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement
// //
case 308: { action. consumeExpressionProblem(); break; case 307: { action. consumeFunctionDefinitionKnR(); break;
}
//
// Rule 308: function_body ::= { }
//
case 308: { action. consumeStatementCompoundStatement(false); break;
}
//
// Rule 309: function_body ::= { <openscope-ast> block_item_list }
//
case 309: { action. consumeStatementCompoundStatement(true); break;
}
//
// Rule 311: expression_parser_start ::= ERROR_TOKEN
//
case 311: { action. consumeExpressionProblem(); break;
} }

View file

@ -15,7 +15,7 @@ package org.eclipse.cdt.internal.core.dom.lrparser.c99;
public interface C99ExpressionParsersym { public interface C99ExpressionParsersym {
public final static int public final static int
TK_auto = 14, TK_auto = 16,
TK_break = 81, TK_break = 81,
TK_case = 82, TK_case = 82,
TK_char = 29, TK_char = 29,
@ -25,26 +25,26 @@ public interface C99ExpressionParsersym {
TK_do = 85, TK_do = 85,
TK_double = 30, TK_double = 30,
TK_else = 86, TK_else = 86,
TK_enum = 42, TK_enum = 43,
TK_extern = 15, TK_extern = 17,
TK_float = 31, TK_float = 31,
TK_for = 87, TK_for = 87,
TK_goto = 88, TK_goto = 88,
TK_if = 89, TK_if = 89,
TK_inline = 16, TK_inline = 18,
TK_int = 32, TK_int = 32,
TK_long = 33, TK_long = 33,
TK_register = 17, TK_register = 19,
TK_restrict = 7, TK_restrict = 7,
TK_return = 90, TK_return = 90,
TK_short = 34, TK_short = 34,
TK_signed = 35, TK_signed = 35,
TK_sizeof = 21, TK_sizeof = 20,
TK_static = 9, TK_static = 11,
TK_struct = 43, TK_struct = 44,
TK_switch = 91, TK_switch = 91,
TK_typedef = 18, TK_typedef = 21,
TK_union = 44, TK_union = 45,
TK_unsigned = 36, TK_unsigned = 36,
TK_void = 37, TK_void = 37,
TK_volatile = 8, TK_volatile = 8,
@ -60,19 +60,19 @@ public interface C99ExpressionParsersym {
TK_Completion = 3, TK_Completion = 3,
TK_EndOfCompletion = 5, TK_EndOfCompletion = 5,
TK_Invalid = 93, TK_Invalid = 93,
TK_LeftBracket = 12, TK_LeftBracket = 13,
TK_LeftParen = 2, TK_LeftParen = 2,
TK_LeftBrace = 28, TK_LeftBrace = 26,
TK_Dot = 52, TK_Dot = 52,
TK_Arrow = 67, TK_Arrow = 67,
TK_PlusPlus = 19, TK_PlusPlus = 14,
TK_MinusMinus = 20, TK_MinusMinus = 15,
TK_And = 13, TK_And = 12,
TK_Star = 4, TK_Star = 4,
TK_Plus = 10, TK_Plus = 9,
TK_Minus = 11, TK_Minus = 10,
TK_Tilde = 26, TK_Tilde = 27,
TK_Bang = 27, TK_Bang = 28,
TK_Slash = 53, TK_Slash = 53,
TK_Percent = 54, TK_Percent = 54,
TK_RightShift = 48, TK_RightShift = 48,
@ -101,10 +101,10 @@ public interface C99ExpressionParsersym {
TK_AndAssign = 77, TK_AndAssign = 77,
TK_CaretAssign = 78, TK_CaretAssign = 78,
TK_OrAssign = 79, TK_OrAssign = 79,
TK_Comma = 45, TK_Comma = 46,
TK_RightBracket = 51, TK_RightBracket = 51,
TK_RightParen = 41, TK_RightParen = 41,
TK_RightBrace = 46, TK_RightBrace = 42,
TK_SemiColon = 66, TK_SemiColon = 66,
TK_ERROR_TOKEN = 47, TK_ERROR_TOKEN = 47,
TK_EOF_TOKEN = 80; TK_EOF_TOKEN = 80;
@ -119,26 +119,26 @@ public interface C99ExpressionParsersym {
"const", "const",
"restrict", "restrict",
"volatile", "volatile",
"static",
"Plus", "Plus",
"Minus", "Minus",
"LeftBracket", "static",
"And", "And",
"LeftBracket",
"PlusPlus",
"MinusMinus",
"auto", "auto",
"extern", "extern",
"inline", "inline",
"register", "register",
"typedef",
"PlusPlus",
"MinusMinus",
"sizeof", "sizeof",
"typedef",
"integer", "integer",
"floating", "floating",
"charconst", "charconst",
"stringlit", "stringlit",
"LeftBrace",
"Tilde", "Tilde",
"Bang", "Bang",
"LeftBrace",
"char", "char",
"double", "double",
"float", "float",
@ -152,11 +152,11 @@ public interface C99ExpressionParsersym {
"_Complex", "_Complex",
"_Imaginary", "_Imaginary",
"RightParen", "RightParen",
"RightBrace",
"enum", "enum",
"struct", "struct",
"union", "union",
"Comma", "Comma",
"RightBrace",
"ERROR_TOKEN", "ERROR_TOKEN",
"RightShift", "RightShift",
"LeftShift", "LeftShift",

View file

@ -169,8 +169,9 @@ private C99BuildASTParserAction action;
public C99NoCastExpressionParser() { // constructor public C99NoCastExpressionParser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new C99BuildASTParserAction ( CNodeFactory.getDefault() , this, tu); action = new C99BuildASTParserAction ( CNodeFactory.getDefault() , this, tu);
action.setParserOptions(options);
} }
@ -180,10 +181,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // -1 means full error handling final int errorRepairCount = -1; // -1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -1153,99 +1154,117 @@ public C99NoCastExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 278: initializer ::= { <openscope-ast> initializer_list comma_opt } // Rule 278: initializer ::= start_initializer_list { <openscope-ast> initializer_list comma_opt } end_initializer_list
// //
case 278: { action. consumeInitializerList(); break; case 278: { action. consumeInitializerList(); break;
} }
// //
// Rule 283: designated_initializer ::= <openscope-ast> designation = initializer // Rule 279: initializer ::= { <openscope-ast> }
// //
case 283: { action. consumeInitializerDesignated(); break; case 279: { action. consumeInitializerList(); break;
} }
// //
// Rule 287: designator_base ::= [ constant_expression ] // Rule 280: start_initializer_list ::= $Empty
// //
case 287: { action. consumeDesignatorArray(); break; case 280: { action. initializerListStart(); break;
} }
// //
// Rule 288: designator_base ::= . identifier_or_typedefname // Rule 281: end_initializer_list ::= $Empty
// //
case 288: { action. consumeDesignatorField(); break; case 281: { action. initializerListEnd(); break;
} }
// //
// Rule 289: designator ::= [ constant_expression ] // Rule 286: designated_initializer ::= <openscope-ast> designation = initializer
// //
case 289: { action. consumeDesignatorArray(); break; case 286: { action. consumeInitializerDesignated(); break;
} }
// //
// Rule 290: designator ::= . identifier_or_typedefname // Rule 290: designator_base ::= [ constant_expression ]
// //
case 290: { action. consumeDesignatorField(); break; case 290: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 291: translation_unit ::= external_declaration_list // Rule 291: designator_base ::= . identifier_or_typedefname
// //
case 291: { action. consumeTranslationUnit(); break; case 291: { action. consumeDesignatorField(); break;
} }
// //
// Rule 292: translation_unit ::= $Empty // Rule 292: designator ::= [ constant_expression ]
// //
case 292: { action. consumeTranslationUnit(); break; case 292: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 297: external_declaration ::= ; // Rule 293: designator ::= . identifier_or_typedefname
// //
case 297: { action. consumeDeclarationEmpty(); break; case 293: { action. consumeDesignatorField(); break;
} }
// //
// Rule 298: external_declaration ::= ERROR_TOKEN // Rule 294: translation_unit ::= external_declaration_list
// //
case 298: { action. consumeDeclarationProblem(); break; case 294: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 301: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body // Rule 295: translation_unit ::= $Empty
// //
case 301: { action. consumeFunctionDefinition(true); break; case 295: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 302: function_definition ::= <openscope-ast> function_declarator function_body // Rule 300: external_declaration ::= ;
// //
case 302: { action. consumeFunctionDefinition(false); break; case 300: { action. consumeDeclarationEmpty(); break;
} }
// //
// Rule 303: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement // Rule 301: external_declaration ::= ERROR_TOKEN
// //
case 303: { action. consumeFunctionDefinitionKnR(); break; case 301: { action. consumeDeclarationProblem(); break;
} }
// //
// Rule 304: function_body ::= { } // Rule 304: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body
// //
case 304: { action. consumeStatementCompoundStatement(false); break; case 304: { action. consumeFunctionDefinition(true); break;
} }
// //
// Rule 305: function_body ::= { <openscope-ast> block_item_list } // Rule 305: function_definition ::= <openscope-ast> function_declarator function_body
// //
case 305: { action. consumeStatementCompoundStatement(true); break; case 305: { action. consumeFunctionDefinition(false); break;
} }
// //
// Rule 307: no_cast_start ::= ERROR_TOKEN // Rule 306: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement
// //
case 307: { action. consumeExpressionProblem(); break; case 306: { action. consumeFunctionDefinitionKnR(); break;
}
//
// Rule 307: function_body ::= { }
//
case 307: { action. consumeStatementCompoundStatement(false); break;
}
//
// Rule 308: function_body ::= { <openscope-ast> block_item_list }
//
case 308: { action. consumeStatementCompoundStatement(true); break;
}
//
// Rule 310: no_cast_start ::= ERROR_TOKEN
//
case 310: { action. consumeExpressionProblem(); break;
} }

View file

@ -15,7 +15,7 @@ package org.eclipse.cdt.internal.core.dom.lrparser.c99;
public interface C99NoCastExpressionParsersym { public interface C99NoCastExpressionParsersym {
public final static int public final static int
TK_auto = 11, TK_auto = 13,
TK_break = 81, TK_break = 81,
TK_case = 82, TK_case = 82,
TK_char = 29, TK_char = 29,
@ -25,26 +25,26 @@ public interface C99NoCastExpressionParsersym {
TK_do = 85, TK_do = 85,
TK_double = 30, TK_double = 30,
TK_else = 86, TK_else = 86,
TK_enum = 42, TK_enum = 43,
TK_extern = 12, TK_extern = 14,
TK_float = 31, TK_float = 31,
TK_for = 87, TK_for = 87,
TK_goto = 88, TK_goto = 88,
TK_if = 89, TK_if = 89,
TK_inline = 13, TK_inline = 15,
TK_int = 32, TK_int = 32,
TK_long = 33, TK_long = 33,
TK_register = 14, TK_register = 16,
TK_restrict = 7, TK_restrict = 7,
TK_return = 90, TK_return = 90,
TK_short = 34, TK_short = 34,
TK_signed = 35, TK_signed = 35,
TK_sizeof = 21, TK_sizeof = 22,
TK_static = 9, TK_static = 9,
TK_struct = 43, TK_struct = 44,
TK_switch = 91, TK_switch = 91,
TK_typedef = 15, TK_typedef = 17,
TK_union = 44, TK_union = 45,
TK_unsigned = 36, TK_unsigned = 36,
TK_void = 37, TK_void = 37,
TK_volatile = 8, TK_volatile = 8,
@ -52,25 +52,25 @@ public interface C99NoCastExpressionParsersym {
TK__Bool = 38, TK__Bool = 38,
TK__Complex = 39, TK__Complex = 39,
TK__Imaginary = 40, TK__Imaginary = 40,
TK_integer = 22, TK_integer = 23,
TK_floating = 23, TK_floating = 24,
TK_charconst = 24, TK_charconst = 25,
TK_stringlit = 25, TK_stringlit = 26,
TK_identifier = 1, TK_identifier = 1,
TK_Completion = 3, TK_Completion = 3,
TK_EndOfCompletion = 5, TK_EndOfCompletion = 5,
TK_Invalid = 93, TK_Invalid = 93,
TK_LeftBracket = 10, TK_LeftBracket = 10,
TK_LeftParen = 2, TK_LeftParen = 2,
TK_LeftBrace = 26, TK_LeftBrace = 19,
TK_Dot = 52, TK_Dot = 52,
TK_Arrow = 67, TK_Arrow = 67,
TK_PlusPlus = 19, TK_PlusPlus = 20,
TK_MinusMinus = 20, TK_MinusMinus = 21,
TK_And = 18, TK_And = 18,
TK_Star = 4, TK_Star = 4,
TK_Plus = 16, TK_Plus = 11,
TK_Minus = 17, TK_Minus = 12,
TK_Tilde = 27, TK_Tilde = 27,
TK_Bang = 28, TK_Bang = 28,
TK_Slash = 53, TK_Slash = 53,
@ -101,10 +101,10 @@ public interface C99NoCastExpressionParsersym {
TK_AndAssign = 77, TK_AndAssign = 77,
TK_CaretAssign = 78, TK_CaretAssign = 78,
TK_OrAssign = 79, TK_OrAssign = 79,
TK_Comma = 45, TK_Comma = 46,
TK_RightBracket = 51, TK_RightBracket = 51,
TK_RightParen = 41, TK_RightParen = 41,
TK_RightBrace = 46, TK_RightBrace = 42,
TK_SemiColon = 66, TK_SemiColon = 66,
TK_ERROR_TOKEN = 47, TK_ERROR_TOKEN = 47,
TK_EOF_TOKEN = 80; TK_EOF_TOKEN = 80;
@ -121,14 +121,15 @@ public interface C99NoCastExpressionParsersym {
"volatile", "volatile",
"static", "static",
"LeftBracket", "LeftBracket",
"Plus",
"Minus",
"auto", "auto",
"extern", "extern",
"inline", "inline",
"register", "register",
"typedef", "typedef",
"Plus",
"Minus",
"And", "And",
"LeftBrace",
"PlusPlus", "PlusPlus",
"MinusMinus", "MinusMinus",
"sizeof", "sizeof",
@ -136,7 +137,6 @@ public interface C99NoCastExpressionParsersym {
"floating", "floating",
"charconst", "charconst",
"stringlit", "stringlit",
"LeftBrace",
"Tilde", "Tilde",
"Bang", "Bang",
"char", "char",
@ -152,11 +152,11 @@ public interface C99NoCastExpressionParsersym {
"_Complex", "_Complex",
"_Imaginary", "_Imaginary",
"RightParen", "RightParen",
"RightBrace",
"enum", "enum",
"struct", "struct",
"union", "union",
"Comma", "Comma",
"RightBrace",
"ERROR_TOKEN", "ERROR_TOKEN",
"RightShift", "RightShift",
"LeftShift", "LeftShift",

View file

@ -169,8 +169,9 @@ private C99BuildASTParserAction action;
public C99Parser() { // constructor public C99Parser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new C99BuildASTParserAction ( CNodeFactory.getDefault() , this, tu); action = new C99BuildASTParserAction ( CNodeFactory.getDefault() , this, tu);
action.setParserOptions(options);
} }
@ -180,10 +181,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // -1 means full error handling final int errorRepairCount = -1; // -1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -1159,93 +1160,111 @@ public C99Parser(String[] mapFrom) { // constructor
} }
// //
// Rule 279: initializer ::= { <openscope-ast> initializer_list comma_opt } // Rule 279: initializer ::= start_initializer_list { <openscope-ast> initializer_list comma_opt } end_initializer_list
// //
case 279: { action. consumeInitializerList(); break; case 279: { action. consumeInitializerList(); break;
} }
// //
// Rule 284: designated_initializer ::= <openscope-ast> designation = initializer // Rule 280: initializer ::= { <openscope-ast> }
// //
case 284: { action. consumeInitializerDesignated(); break; case 280: { action. consumeInitializerList(); break;
} }
// //
// Rule 288: designator_base ::= [ constant_expression ] // Rule 281: start_initializer_list ::= $Empty
// //
case 288: { action. consumeDesignatorArray(); break; case 281: { action. initializerListStart(); break;
} }
// //
// Rule 289: designator_base ::= . identifier_or_typedefname // Rule 282: end_initializer_list ::= $Empty
// //
case 289: { action. consumeDesignatorField(); break; case 282: { action. initializerListEnd(); break;
} }
// //
// Rule 290: designator ::= [ constant_expression ] // Rule 287: designated_initializer ::= <openscope-ast> designation = initializer
// //
case 290: { action. consumeDesignatorArray(); break; case 287: { action. consumeInitializerDesignated(); break;
} }
// //
// Rule 291: designator ::= . identifier_or_typedefname // Rule 291: designator_base ::= [ constant_expression ]
// //
case 291: { action. consumeDesignatorField(); break; case 291: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 292: translation_unit ::= external_declaration_list // Rule 292: designator_base ::= . identifier_or_typedefname
// //
case 292: { action. consumeTranslationUnit(); break; case 292: { action. consumeDesignatorField(); break;
} }
// //
// Rule 293: translation_unit ::= $Empty // Rule 293: designator ::= [ constant_expression ]
// //
case 293: { action. consumeTranslationUnit(); break; case 293: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 298: external_declaration ::= ; // Rule 294: designator ::= . identifier_or_typedefname
// //
case 298: { action. consumeDeclarationEmpty(); break; case 294: { action. consumeDesignatorField(); break;
} }
// //
// Rule 299: external_declaration ::= ERROR_TOKEN // Rule 295: translation_unit ::= external_declaration_list
// //
case 299: { action. consumeDeclarationProblem(); break; case 295: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 302: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body // Rule 296: translation_unit ::= $Empty
// //
case 302: { action. consumeFunctionDefinition(true); break; case 296: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 303: function_definition ::= <openscope-ast> function_declarator function_body // Rule 301: external_declaration ::= ;
// //
case 303: { action. consumeFunctionDefinition(false); break; case 301: { action. consumeDeclarationEmpty(); break;
} }
// //
// Rule 304: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement // Rule 302: external_declaration ::= ERROR_TOKEN
// //
case 304: { action. consumeFunctionDefinitionKnR(); break; case 302: { action. consumeDeclarationProblem(); break;
} }
// //
// Rule 305: function_body ::= { } // Rule 305: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body
// //
case 305: { action. consumeStatementCompoundStatement(false); break; case 305: { action. consumeFunctionDefinition(true); break;
} }
// //
// Rule 306: function_body ::= { <openscope-ast> block_item_list } // Rule 306: function_definition ::= <openscope-ast> function_declarator function_body
// //
case 306: { action. consumeStatementCompoundStatement(true); break; case 306: { action. consumeFunctionDefinition(false); break;
}
//
// Rule 307: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement
//
case 307: { action. consumeFunctionDefinitionKnR(); break;
}
//
// Rule 308: function_body ::= { }
//
case 308: { action. consumeStatementCompoundStatement(false); break;
}
//
// Rule 309: function_body ::= { <openscope-ast> block_item_list }
//
case 309: { action. consumeStatementCompoundStatement(true); break;
} }

View file

@ -19,7 +19,7 @@ public interface C99Parsersym {
TK_break = 43, TK_break = 43,
TK_case = 44, TK_case = 44,
TK_char = 30, TK_char = 30,
TK_const = 10, TK_const = 19,
TK_continue = 45, TK_continue = 45,
TK_default = 46, TK_default = 46,
TK_do = 47, TK_do = 47,
@ -35,11 +35,11 @@ public interface C99Parsersym {
TK_int = 33, TK_int = 33,
TK_long = 34, TK_long = 34,
TK_register = 27, TK_register = 27,
TK_restrict = 11, TK_restrict = 20,
TK_return = 52, TK_return = 52,
TK_short = 35, TK_short = 35,
TK_signed = 36, TK_signed = 36,
TK_sizeof = 15, TK_sizeof = 12,
TK_static = 23, TK_static = 23,
TK_struct = 53, TK_struct = 53,
TK_switch = 54, TK_switch = 54,
@ -47,32 +47,32 @@ public interface C99Parsersym {
TK_union = 55, TK_union = 55,
TK_unsigned = 37, TK_unsigned = 37,
TK_void = 38, TK_void = 38,
TK_volatile = 12, TK_volatile = 21,
TK_while = 39, TK_while = 39,
TK__Bool = 40, TK__Bool = 40,
TK__Complex = 41, TK__Complex = 41,
TK__Imaginary = 42, TK__Imaginary = 42,
TK_integer = 16, TK_integer = 13,
TK_floating = 17, TK_floating = 14,
TK_charconst = 18, TK_charconst = 15,
TK_stringlit = 19, TK_stringlit = 16,
TK_identifier = 1, TK_identifier = 1,
TK_Completion = 4, TK_Completion = 3,
TK_EndOfCompletion = 3, TK_EndOfCompletion = 4,
TK_Invalid = 93, TK_Invalid = 93,
TK_LeftBracket = 56, TK_LeftBracket = 56,
TK_LeftParen = 2, TK_LeftParen = 2,
TK_LeftBrace = 6, TK_LeftBrace = 6,
TK_Dot = 66, TK_Dot = 66,
TK_Arrow = 80, TK_Arrow = 80,
TK_PlusPlus = 13, TK_PlusPlus = 10,
TK_MinusMinus = 14, TK_MinusMinus = 11,
TK_And = 9, TK_And = 9,
TK_Star = 5, TK_Star = 5,
TK_Plus = 7, TK_Plus = 7,
TK_Minus = 8, TK_Minus = 8,
TK_Tilde = 20, TK_Tilde = 17,
TK_Bang = 21, TK_Bang = 18,
TK_Slash = 67, TK_Slash = 67,
TK_Percent = 68, TK_Percent = 68,
TK_RightShift = 62, TK_RightShift = 62,
@ -113,16 +113,13 @@ public interface C99Parsersym {
"", "",
"identifier", "identifier",
"LeftParen", "LeftParen",
"EndOfCompletion",
"Completion", "Completion",
"EndOfCompletion",
"Star", "Star",
"LeftBrace", "LeftBrace",
"Plus", "Plus",
"Minus", "Minus",
"And", "And",
"const",
"restrict",
"volatile",
"PlusPlus", "PlusPlus",
"MinusMinus", "MinusMinus",
"sizeof", "sizeof",
@ -132,6 +129,9 @@ public interface C99Parsersym {
"stringlit", "stringlit",
"Tilde", "Tilde",
"Bang", "Bang",
"const",
"restrict",
"volatile",
"SemiColon", "SemiColon",
"static", "static",
"auto", "auto",

View file

@ -169,8 +169,9 @@ private C99BuildASTParserAction action;
public C99SizeofExpressionParser() { // constructor public C99SizeofExpressionParser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new C99BuildASTParserAction ( CNodeFactory.getDefault() , this, tu); action = new C99BuildASTParserAction ( CNodeFactory.getDefault() , this, tu);
action.setParserOptions(options);
} }
@ -180,10 +181,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // -1 means full error handling final int errorRepairCount = -1; // -1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -1153,99 +1154,117 @@ public C99SizeofExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 278: initializer ::= { <openscope-ast> initializer_list comma_opt } // Rule 278: initializer ::= start_initializer_list { <openscope-ast> initializer_list comma_opt } end_initializer_list
// //
case 278: { action. consumeInitializerList(); break; case 278: { action. consumeInitializerList(); break;
} }
// //
// Rule 283: designated_initializer ::= <openscope-ast> designation = initializer // Rule 279: initializer ::= { <openscope-ast> }
// //
case 283: { action. consumeInitializerDesignated(); break; case 279: { action. consumeInitializerList(); break;
} }
// //
// Rule 287: designator_base ::= [ constant_expression ] // Rule 280: start_initializer_list ::= $Empty
// //
case 287: { action. consumeDesignatorArray(); break; case 280: { action. initializerListStart(); break;
} }
// //
// Rule 288: designator_base ::= . identifier_or_typedefname // Rule 281: end_initializer_list ::= $Empty
// //
case 288: { action. consumeDesignatorField(); break; case 281: { action. initializerListEnd(); break;
} }
// //
// Rule 289: designator ::= [ constant_expression ] // Rule 286: designated_initializer ::= <openscope-ast> designation = initializer
// //
case 289: { action. consumeDesignatorArray(); break; case 286: { action. consumeInitializerDesignated(); break;
} }
// //
// Rule 290: designator ::= . identifier_or_typedefname // Rule 290: designator_base ::= [ constant_expression ]
// //
case 290: { action. consumeDesignatorField(); break; case 290: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 291: translation_unit ::= external_declaration_list // Rule 291: designator_base ::= . identifier_or_typedefname
// //
case 291: { action. consumeTranslationUnit(); break; case 291: { action. consumeDesignatorField(); break;
} }
// //
// Rule 292: translation_unit ::= $Empty // Rule 292: designator ::= [ constant_expression ]
// //
case 292: { action. consumeTranslationUnit(); break; case 292: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 297: external_declaration ::= ; // Rule 293: designator ::= . identifier_or_typedefname
// //
case 297: { action. consumeDeclarationEmpty(); break; case 293: { action. consumeDesignatorField(); break;
} }
// //
// Rule 298: external_declaration ::= ERROR_TOKEN // Rule 294: translation_unit ::= external_declaration_list
// //
case 298: { action. consumeDeclarationProblem(); break; case 294: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 301: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body // Rule 295: translation_unit ::= $Empty
// //
case 301: { action. consumeFunctionDefinition(true); break; case 295: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 302: function_definition ::= <openscope-ast> function_declarator function_body // Rule 300: external_declaration ::= ;
// //
case 302: { action. consumeFunctionDefinition(false); break; case 300: { action. consumeDeclarationEmpty(); break;
} }
// //
// Rule 303: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement // Rule 301: external_declaration ::= ERROR_TOKEN
// //
case 303: { action. consumeFunctionDefinitionKnR(); break; case 301: { action. consumeDeclarationProblem(); break;
} }
// //
// Rule 304: function_body ::= { } // Rule 304: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body
// //
case 304: { action. consumeStatementCompoundStatement(false); break; case 304: { action. consumeFunctionDefinition(true); break;
} }
// //
// Rule 305: function_body ::= { <openscope-ast> block_item_list } // Rule 305: function_definition ::= <openscope-ast> function_declarator function_body
// //
case 305: { action. consumeStatementCompoundStatement(true); break; case 305: { action. consumeFunctionDefinition(false); break;
} }
// //
// Rule 307: no_sizeof_type_name_start ::= ERROR_TOKEN // Rule 306: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement
// //
case 307: { action. consumeExpressionProblem(); break; case 306: { action. consumeFunctionDefinitionKnR(); break;
}
//
// Rule 307: function_body ::= { }
//
case 307: { action. consumeStatementCompoundStatement(false); break;
}
//
// Rule 308: function_body ::= { <openscope-ast> block_item_list }
//
case 308: { action. consumeStatementCompoundStatement(true); break;
}
//
// Rule 310: no_sizeof_type_name_start ::= ERROR_TOKEN
//
case 310: { action. consumeExpressionProblem(); break;
} }

View file

@ -15,7 +15,7 @@ package org.eclipse.cdt.internal.core.dom.lrparser.c99;
public interface C99SizeofExpressionParsersym { public interface C99SizeofExpressionParsersym {
public final static int public final static int
TK_auto = 13, TK_auto = 14,
TK_break = 81, TK_break = 81,
TK_case = 82, TK_case = 82,
TK_char = 29, TK_char = 29,
@ -25,26 +25,26 @@ public interface C99SizeofExpressionParsersym {
TK_do = 85, TK_do = 85,
TK_double = 30, TK_double = 30,
TK_else = 86, TK_else = 86,
TK_enum = 42, TK_enum = 43,
TK_extern = 14, TK_extern = 15,
TK_float = 31, TK_float = 31,
TK_for = 87, TK_for = 87,
TK_goto = 88, TK_goto = 88,
TK_if = 89, TK_if = 89,
TK_inline = 15, TK_inline = 16,
TK_int = 32, TK_int = 32,
TK_long = 33, TK_long = 33,
TK_register = 16, TK_register = 17,
TK_restrict = 7, TK_restrict = 7,
TK_return = 90, TK_return = 90,
TK_short = 34, TK_short = 34,
TK_signed = 35, TK_signed = 35,
TK_sizeof = 21, TK_sizeof = 21,
TK_static = 9, TK_static = 9,
TK_struct = 43, TK_struct = 44,
TK_switch = 91, TK_switch = 91,
TK_typedef = 17, TK_typedef = 18,
TK_union = 44, TK_union = 45,
TK_unsigned = 36, TK_unsigned = 36,
TK_void = 37, TK_void = 37,
TK_volatile = 8, TK_volatile = 8,
@ -60,19 +60,19 @@ public interface C99SizeofExpressionParsersym {
TK_Completion = 3, TK_Completion = 3,
TK_EndOfCompletion = 5, TK_EndOfCompletion = 5,
TK_Invalid = 93, TK_Invalid = 93,
TK_LeftBracket = 10, TK_LeftBracket = 12,
TK_LeftParen = 2, TK_LeftParen = 2,
TK_LeftBrace = 28, TK_LeftBrace = 26,
TK_Dot = 52, TK_Dot = 52,
TK_Arrow = 67, TK_Arrow = 67,
TK_PlusPlus = 19, TK_PlusPlus = 19,
TK_MinusMinus = 20, TK_MinusMinus = 20,
TK_And = 18, TK_And = 13,
TK_Star = 4, TK_Star = 4,
TK_Plus = 11, TK_Plus = 10,
TK_Minus = 12, TK_Minus = 11,
TK_Tilde = 26, TK_Tilde = 27,
TK_Bang = 27, TK_Bang = 28,
TK_Slash = 53, TK_Slash = 53,
TK_Percent = 54, TK_Percent = 54,
TK_RightShift = 48, TK_RightShift = 48,
@ -101,10 +101,10 @@ public interface C99SizeofExpressionParsersym {
TK_AndAssign = 77, TK_AndAssign = 77,
TK_CaretAssign = 78, TK_CaretAssign = 78,
TK_OrAssign = 79, TK_OrAssign = 79,
TK_Comma = 45, TK_Comma = 46,
TK_RightBracket = 51, TK_RightBracket = 51,
TK_RightParen = 41, TK_RightParen = 41,
TK_RightBrace = 46, TK_RightBrace = 42,
TK_SemiColon = 66, TK_SemiColon = 66,
TK_ERROR_TOKEN = 47, TK_ERROR_TOKEN = 47,
TK_EOF_TOKEN = 80; TK_EOF_TOKEN = 80;
@ -120,15 +120,15 @@ public interface C99SizeofExpressionParsersym {
"restrict", "restrict",
"volatile", "volatile",
"static", "static",
"LeftBracket",
"Plus", "Plus",
"Minus", "Minus",
"LeftBracket",
"And",
"auto", "auto",
"extern", "extern",
"inline", "inline",
"register", "register",
"typedef", "typedef",
"And",
"PlusPlus", "PlusPlus",
"MinusMinus", "MinusMinus",
"sizeof", "sizeof",
@ -136,9 +136,9 @@ public interface C99SizeofExpressionParsersym {
"floating", "floating",
"charconst", "charconst",
"stringlit", "stringlit",
"LeftBrace",
"Tilde", "Tilde",
"Bang", "Bang",
"LeftBrace",
"char", "char",
"double", "double",
"float", "float",
@ -152,11 +152,11 @@ public interface C99SizeofExpressionParsersym {
"_Complex", "_Complex",
"_Imaginary", "_Imaginary",
"RightParen", "RightParen",
"RightBrace",
"enum", "enum",
"struct", "struct",
"union", "union",
"Comma", "Comma",
"RightBrace",
"ERROR_TOKEN", "ERROR_TOKEN",
"RightShift", "RightShift",
"LeftShift", "LeftShift",

View file

@ -171,13 +171,15 @@ private CPPParserAction action;
public CPPExpressionParser() { // constructor public CPPExpressionParser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
// binding resolution actions need access to IASTName nodes, temporary // binding resolution actions need access to IASTName nodes, temporary
action = new CPPParserAction (); action = new CPPParserAction ();
//action.resolver = new C99TypedefTrackerParserAction (this); //action.resolver = new C99TypedefTrackerParserAction (this);
action.builder = new CPPBuildASTParserAction ( CPPNodeFactory.getDefault() , this, tu); action.builder = new CPPBuildASTParserAction ( CPPNodeFactory.getDefault() , this, tu);
//action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols); //action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols);
action.builder.setParserOptions(options);
// comment this line to use with backtracking parser // comment this line to use with backtracking parser
//setParserAction(action); //setParserAction(action);
} }
@ -189,10 +191,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // _1 means full error handling final int errorRepairCount = -1; // _1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -1863,14 +1865,14 @@ public CPPExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 383: initializer_clause ::= { <openscope-ast> initializer_list , } // Rule 383: initializer_clause ::= start_initializer_list { <openscope-ast> initializer_list , } end_initializer_list
// //
case 383: { action.builder. case 383: { action.builder.
consumeInitializerList(); break; consumeInitializerList(); break;
} }
// //
// Rule 384: initializer_clause ::= { <openscope-ast> initializer_list } // Rule 384: initializer_clause ::= start_initializer_list { <openscope-ast> initializer_list } end_initializer_list
// //
case 384: { action.builder. case 384: { action.builder.
consumeInitializerList(); break; consumeInitializerList(); break;
@ -1884,380 +1886,394 @@ public CPPExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 390: class_specifier ::= class_head { <openscope-ast> member_declaration_list_opt } // Rule 386: start_initializer_list ::= $Empty
// //
case 390: { action.builder. case 386: { action.builder.
initializerListStart(); break;
}
//
// Rule 387: end_initializer_list ::= $Empty
//
case 387: { action.builder.
initializerListEnd(); break;
}
//
// Rule 392: class_specifier ::= class_head { <openscope-ast> member_declaration_list_opt }
//
case 392: { action.builder.
consumeClassSpecifier(); break; consumeClassSpecifier(); break;
} }
// //
// Rule 391: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt // Rule 393: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt
//
case 391: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 392: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
//
case 392: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 393: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
// //
case 393: { action.builder. case 393: { action.builder.
consumeClassHead(true); break; consumeClassHead(false); break;
} }
// //
// Rule 394: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt // Rule 394: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
// //
case 394: { action.builder. case 394: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 395: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
//
case 395: { action.builder.
consumeClassHead(true); break; consumeClassHead(true); break;
} }
// //
// Rule 396: identifier_name_opt ::= $Empty // Rule 396: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt
// //
case 396: { action.builder. case 396: { action.builder.
consumeClassHead(true); break;
}
//
// Rule 398: identifier_name_opt ::= $Empty
//
case 398: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 400: visibility_label ::= access_specifier_keyword : // Rule 402: visibility_label ::= access_specifier_keyword :
// //
case 400: { action.builder. case 402: { action.builder.
consumeVisibilityLabel(); break; consumeVisibilityLabel(); break;
} }
// //
// Rule 401: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ; // Rule 403: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ;
// //
case 401: { action.builder. case 403: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 402: member_declaration ::= declaration_specifiers_opt ; // Rule 404: member_declaration ::= declaration_specifiers_opt ;
// //
case 402: { action.builder. case 404: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 405: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ; // Rule 407: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ;
// //
case 405: { action.builder. case 407: { action.builder.
consumeMemberDeclarationQualifiedId(); break; consumeMemberDeclarationQualifiedId(); break;
} }
// //
// Rule 411: member_declaration ::= ERROR_TOKEN // Rule 413: member_declaration ::= ERROR_TOKEN
// //
case 411: { action.builder. case 413: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }
// //
// Rule 419: member_declarator ::= declarator constant_initializer // Rule 421: member_declarator ::= declarator constant_initializer
// //
case 419: { action.builder. case 421: { action.builder.
consumeMemberDeclaratorWithInitializer(); break; consumeMemberDeclaratorWithInitializer(); break;
} }
// //
// Rule 420: member_declarator ::= bit_field_declarator : constant_expression // Rule 422: member_declarator ::= bit_field_declarator : constant_expression
// //
case 420: { action.builder. case 422: { action.builder.
consumeBitField(true); break; consumeBitField(true); break;
} }
// //
// Rule 421: member_declarator ::= : constant_expression // Rule 423: member_declarator ::= : constant_expression
// //
case 421: { action.builder. case 423: { action.builder.
consumeBitField(false); break; consumeBitField(false); break;
} }
// //
// Rule 422: bit_field_declarator ::= identifier_name // Rule 424: bit_field_declarator ::= identifier_name
// //
case 422: { action.builder. case 424: { action.builder.
consumeDirectDeclaratorIdentifier(); break; consumeDirectDeclaratorIdentifier(); break;
} }
// //
// Rule 423: constant_initializer ::= = constant_expression // Rule 425: constant_initializer ::= = constant_expression
// //
case 423: { action.builder. case 425: { action.builder.
consumeInitializer(); break; consumeInitializer(); break;
} }
// //
// Rule 429: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name // Rule 431: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 429: { action.builder. case 431: { action.builder.
consumeBaseSpecifier(false, false); break; consumeBaseSpecifier(false, false); break;
} }
// //
// Rule 430: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name // Rule 432: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name
//
case 430: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 431: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
//
case 431: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 432: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
// //
case 432: { action.builder. case 432: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 433: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
//
case 433: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 434: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
//
case 434: { action.builder.
consumeBaseSpecifier(true, false); break; consumeBaseSpecifier(true, false); break;
} }
// //
// Rule 433: access_specifier_keyword ::= private // Rule 435: access_specifier_keyword ::= private
//
case 433: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 434: access_specifier_keyword ::= protected
//
case 434: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 435: access_specifier_keyword ::= public
// //
case 435: { action.builder. case 435: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 437: access_specifier_keyword_opt ::= $Empty // Rule 436: access_specifier_keyword ::= protected
//
case 436: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 437: access_specifier_keyword ::= public
// //
case 437: { action.builder. case 437: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 439: access_specifier_keyword_opt ::= $Empty
//
case 439: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 439: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt > // Rule 441: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt >
// //
case 439: { action.builder. case 441: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 440: conversion_function_id ::= operator conversion_type_id // Rule 442: conversion_function_id ::= operator conversion_type_id
// //
case 440: { action.builder. case 442: { action.builder.
consumeConversionName(); break; consumeConversionName(); break;
} }
// //
// Rule 441: conversion_type_id ::= type_specifier_seq conversion_declarator // Rule 443: conversion_type_id ::= type_specifier_seq conversion_declarator
// //
case 441: { action.builder. case 443: { action.builder.
consumeTypeId(true); break; consumeTypeId(true); break;
} }
// //
// Rule 442: conversion_type_id ::= type_specifier_seq // Rule 444: conversion_type_id ::= type_specifier_seq
// //
case 442: { action.builder. case 444: { action.builder.
consumeTypeId(false); break; consumeTypeId(false); break;
} }
// //
// Rule 443: conversion_declarator ::= <openscope-ast> ptr_operator_seq // Rule 445: conversion_declarator ::= <openscope-ast> ptr_operator_seq
// //
case 443: { action.builder. case 445: { action.builder.
consumeDeclaratorWithPointer(false); break; consumeDeclaratorWithPointer(false); break;
} }
// //
// Rule 449: mem_initializer ::= mem_initializer_name ( expression_list_opt ) // Rule 451: mem_initializer ::= mem_initializer_name ( expression_list_opt )
// //
case 449: { action.builder. case 451: { action.builder.
consumeConstructorChainInitializer(); break; consumeConstructorChainInitializer(); break;
} }
// //
// Rule 450: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name // Rule 452: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 450: { action.builder. case 452: { action.builder.
consumeQualifiedId(false); break; consumeQualifiedId(false); break;
} }
// //
// Rule 453: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt > // Rule 455: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt >
// //
case 453: { action.builder. case 455: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 454: operator_id_name ::= operator overloadable_operator // Rule 456: operator_id_name ::= operator overloadable_operator
// //
case 454: { action.builder. case 456: { action.builder.
consumeOperatorName(); break; consumeOperatorName(); break;
} }
// //
// Rule 497: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration // Rule 499: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration
// //
case 497: { action.builder. case 499: { action.builder.
consumeTemplateDeclaration(); break; consumeTemplateDeclaration(); break;
} }
// //
// Rule 498: export_opt ::= export // Rule 500: export_opt ::= export
// //
case 498: { action.builder. case 500: { action.builder.
consumePlaceHolder(); break; consumePlaceHolder(); break;
} }
// //
// Rule 499: export_opt ::= $Empty // Rule 501: export_opt ::= $Empty
// //
case 499: { action.builder. case 501: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 503: template_parameter ::= parameter_declaration // Rule 505: template_parameter ::= parameter_declaration
// //
case 503: { action.builder. case 505: { action.builder.
consumeTemplateParamterDeclaration(); break; consumeTemplateParamterDeclaration(); break;
} }
// //
// Rule 504: type_parameter ::= class identifier_name_opt // Rule 506: type_parameter ::= class identifier_name_opt
//
case 504: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 505: type_parameter ::= class identifier_name_opt = type_id
//
case 505: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 506: type_parameter ::= typename identifier_name_opt
// //
case 506: { action.builder. case 506: { action.builder.
consumeSimpleTypeTemplateParameter(false); break; consumeSimpleTypeTemplateParameter(false); break;
} }
// //
// Rule 507: type_parameter ::= typename identifier_name_opt = type_id // Rule 507: type_parameter ::= class identifier_name_opt = type_id
// //
case 507: { action.builder. case 507: { action.builder.
consumeSimpleTypeTemplateParameter(true); break; consumeSimpleTypeTemplateParameter(true); break;
} }
// //
// Rule 508: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt // Rule 508: type_parameter ::= typename identifier_name_opt
// //
case 508: { action.builder. case 508: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 509: type_parameter ::= typename identifier_name_opt = type_id
//
case 509: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 510: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt
//
case 510: { action.builder.
consumeTemplatedTypeTemplateParameter(false); break; consumeTemplatedTypeTemplateParameter(false); break;
} }
// //
// Rule 509: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression // Rule 511: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression
// //
case 509: { action.builder. case 511: { action.builder.
consumeTemplatedTypeTemplateParameter(true); break; consumeTemplatedTypeTemplateParameter(true); break;
} }
// //
// Rule 510: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt > // Rule 512: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt >
// //
case 510: { action.builder. case 512: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 516: template_argument ::= type_id // Rule 518: template_argument ::= type_id
// //
case 516: { action.builder. case 518: { action.builder.
consumeTemplateArgumentTypeId(); break; consumeTemplateArgumentTypeId(); break;
} }
// //
// Rule 517: explicit_instantiation ::= template declaration // Rule 519: explicit_instantiation ::= template declaration
// //
case 517: { action.builder. case 519: { action.builder.
consumeTemplateExplicitInstantiation(); break; consumeTemplateExplicitInstantiation(); break;
} }
// //
// Rule 518: explicit_specialization ::= template < > declaration // Rule 520: explicit_specialization ::= template < > declaration
// //
case 518: { action.builder. case 520: { action.builder.
consumeTemplateExplicitSpecialization(); break; consumeTemplateExplicitSpecialization(); break;
} }
// //
// Rule 519: try_block ::= try compound_statement <openscope-ast> handler_seq // Rule 521: try_block ::= try compound_statement <openscope-ast> handler_seq
// //
case 519: { action.builder. case 521: { action.builder.
consumeStatementTryBlock(); break; consumeStatementTryBlock(); break;
} }
// //
// Rule 522: handler ::= catch ( exception_declaration ) compound_statement // Rule 524: handler ::= catch ( exception_declaration ) compound_statement
// //
case 522: { action.builder. case 524: { action.builder.
consumeStatementCatchHandler(false); break; consumeStatementCatchHandler(false); break;
} }
// //
// Rule 523: handler ::= catch ( ... ) compound_statement // Rule 525: handler ::= catch ( ... ) compound_statement
// //
case 523: { action.builder. case 525: { action.builder.
consumeStatementCatchHandler(true); break; consumeStatementCatchHandler(true); break;
} }
// //
// Rule 524: exception_declaration ::= type_specifier_seq <openscope-ast> declarator // Rule 526: exception_declaration ::= type_specifier_seq <openscope-ast> declarator
//
case 524: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 525: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
//
case 525: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 526: exception_declaration ::= type_specifier_seq
// //
case 526: { action.builder. case 526: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 527: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
//
case 527: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 528: exception_declaration ::= type_specifier_seq
//
case 528: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 534: expression_parser_start ::= ERROR_TOKEN // Rule 536: expression_parser_start ::= ERROR_TOKEN
// //
case 534: { action.builder. case 536: { action.builder.
consumeExpressionProblem(); break; consumeExpressionProblem(); break;
} }

View file

@ -118,7 +118,7 @@ public interface CPPExpressionParsersym {
TK_Colon = 73, TK_Colon = 73,
TK_ColonColon = 4, TK_ColonColon = 4,
TK_DotDotDot = 95, TK_DotDotDot = 95,
TK_Assign = 70, TK_Assign = 69,
TK_StarAssign = 104, TK_StarAssign = 104,
TK_SlashAssign = 105, TK_SlashAssign = 105,
TK_PercentAssign = 106, TK_PercentAssign = 106,
@ -129,7 +129,7 @@ public interface CPPExpressionParsersym {
TK_AndAssign = 111, TK_AndAssign = 111,
TK_CaretAssign = 112, TK_CaretAssign = 112,
TK_OrAssign = 113, TK_OrAssign = 113,
TK_Comma = 69, TK_Comma = 70,
TK_RightBracket = 118, TK_RightBracket = 118,
TK_RightParen = 74, TK_RightParen = 74,
TK_RightBrace = 71, TK_RightBrace = 71,
@ -209,8 +209,8 @@ public interface CPPExpressionParsersym {
"enum", "enum",
"struct", "struct",
"union", "union",
"Comma",
"Assign", "Assign",
"Comma",
"RightBrace", "RightBrace",
"ERROR_TOKEN", "ERROR_TOKEN",
"Colon", "Colon",

View file

@ -171,13 +171,15 @@ private CPPParserAction action;
public CPPNoCastExpressionParser() { // constructor public CPPNoCastExpressionParser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
// binding resolution actions need access to IASTName nodes, temporary // binding resolution actions need access to IASTName nodes, temporary
action = new CPPParserAction (); action = new CPPParserAction ();
//action.resolver = new C99TypedefTrackerParserAction (this); //action.resolver = new C99TypedefTrackerParserAction (this);
action.builder = new CPPBuildASTParserAction ( CPPNodeFactory.getDefault() , this, tu); action.builder = new CPPBuildASTParserAction ( CPPNodeFactory.getDefault() , this, tu);
//action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols); //action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols);
action.builder.setParserOptions(options);
// comment this line to use with backtracking parser // comment this line to use with backtracking parser
//setParserAction(action); //setParserAction(action);
} }
@ -189,10 +191,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // _1 means full error handling final int errorRepairCount = -1; // _1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -1856,14 +1858,14 @@ public CPPNoCastExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 382: initializer_clause ::= { <openscope-ast> initializer_list , } // Rule 382: initializer_clause ::= start_initializer_list { <openscope-ast> initializer_list , } end_initializer_list
// //
case 382: { action.builder. case 382: { action.builder.
consumeInitializerList(); break; consumeInitializerList(); break;
} }
// //
// Rule 383: initializer_clause ::= { <openscope-ast> initializer_list } // Rule 383: initializer_clause ::= start_initializer_list { <openscope-ast> initializer_list } end_initializer_list
// //
case 383: { action.builder. case 383: { action.builder.
consumeInitializerList(); break; consumeInitializerList(); break;
@ -1877,380 +1879,394 @@ public CPPNoCastExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 389: class_specifier ::= class_head { <openscope-ast> member_declaration_list_opt } // Rule 385: start_initializer_list ::= $Empty
// //
case 389: { action.builder. case 385: { action.builder.
initializerListStart(); break;
}
//
// Rule 386: end_initializer_list ::= $Empty
//
case 386: { action.builder.
initializerListEnd(); break;
}
//
// Rule 391: class_specifier ::= class_head { <openscope-ast> member_declaration_list_opt }
//
case 391: { action.builder.
consumeClassSpecifier(); break; consumeClassSpecifier(); break;
} }
// //
// Rule 390: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt // Rule 392: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt
//
case 390: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 391: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
//
case 391: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 392: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
// //
case 392: { action.builder. case 392: { action.builder.
consumeClassHead(true); break; consumeClassHead(false); break;
} }
// //
// Rule 393: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt // Rule 393: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
// //
case 393: { action.builder. case 393: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 394: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
//
case 394: { action.builder.
consumeClassHead(true); break; consumeClassHead(true); break;
} }
// //
// Rule 395: identifier_name_opt ::= $Empty // Rule 395: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt
// //
case 395: { action.builder. case 395: { action.builder.
consumeClassHead(true); break;
}
//
// Rule 397: identifier_name_opt ::= $Empty
//
case 397: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 399: visibility_label ::= access_specifier_keyword : // Rule 401: visibility_label ::= access_specifier_keyword :
// //
case 399: { action.builder. case 401: { action.builder.
consumeVisibilityLabel(); break; consumeVisibilityLabel(); break;
} }
// //
// Rule 400: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ; // Rule 402: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ;
// //
case 400: { action.builder. case 402: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 401: member_declaration ::= declaration_specifiers_opt ; // Rule 403: member_declaration ::= declaration_specifiers_opt ;
// //
case 401: { action.builder. case 403: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 404: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ; // Rule 406: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ;
// //
case 404: { action.builder. case 406: { action.builder.
consumeMemberDeclarationQualifiedId(); break; consumeMemberDeclarationQualifiedId(); break;
} }
// //
// Rule 410: member_declaration ::= ERROR_TOKEN // Rule 412: member_declaration ::= ERROR_TOKEN
// //
case 410: { action.builder. case 412: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }
// //
// Rule 418: member_declarator ::= declarator constant_initializer // Rule 420: member_declarator ::= declarator constant_initializer
// //
case 418: { action.builder. case 420: { action.builder.
consumeMemberDeclaratorWithInitializer(); break; consumeMemberDeclaratorWithInitializer(); break;
} }
// //
// Rule 419: member_declarator ::= bit_field_declarator : constant_expression // Rule 421: member_declarator ::= bit_field_declarator : constant_expression
// //
case 419: { action.builder. case 421: { action.builder.
consumeBitField(true); break; consumeBitField(true); break;
} }
// //
// Rule 420: member_declarator ::= : constant_expression // Rule 422: member_declarator ::= : constant_expression
// //
case 420: { action.builder. case 422: { action.builder.
consumeBitField(false); break; consumeBitField(false); break;
} }
// //
// Rule 421: bit_field_declarator ::= identifier_name // Rule 423: bit_field_declarator ::= identifier_name
// //
case 421: { action.builder. case 423: { action.builder.
consumeDirectDeclaratorIdentifier(); break; consumeDirectDeclaratorIdentifier(); break;
} }
// //
// Rule 422: constant_initializer ::= = constant_expression // Rule 424: constant_initializer ::= = constant_expression
// //
case 422: { action.builder. case 424: { action.builder.
consumeInitializer(); break; consumeInitializer(); break;
} }
// //
// Rule 428: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name // Rule 430: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 428: { action.builder. case 430: { action.builder.
consumeBaseSpecifier(false, false); break; consumeBaseSpecifier(false, false); break;
} }
// //
// Rule 429: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name // Rule 431: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name
//
case 429: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 430: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
//
case 430: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 431: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
// //
case 431: { action.builder. case 431: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 432: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
//
case 432: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 433: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
//
case 433: { action.builder.
consumeBaseSpecifier(true, false); break; consumeBaseSpecifier(true, false); break;
} }
// //
// Rule 432: access_specifier_keyword ::= private // Rule 434: access_specifier_keyword ::= private
//
case 432: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 433: access_specifier_keyword ::= protected
//
case 433: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 434: access_specifier_keyword ::= public
// //
case 434: { action.builder. case 434: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 436: access_specifier_keyword_opt ::= $Empty // Rule 435: access_specifier_keyword ::= protected
//
case 435: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 436: access_specifier_keyword ::= public
// //
case 436: { action.builder. case 436: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 438: access_specifier_keyword_opt ::= $Empty
//
case 438: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 438: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt > // Rule 440: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt >
// //
case 438: { action.builder. case 440: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 439: conversion_function_id ::= operator conversion_type_id // Rule 441: conversion_function_id ::= operator conversion_type_id
// //
case 439: { action.builder. case 441: { action.builder.
consumeConversionName(); break; consumeConversionName(); break;
} }
// //
// Rule 440: conversion_type_id ::= type_specifier_seq conversion_declarator // Rule 442: conversion_type_id ::= type_specifier_seq conversion_declarator
// //
case 440: { action.builder. case 442: { action.builder.
consumeTypeId(true); break; consumeTypeId(true); break;
} }
// //
// Rule 441: conversion_type_id ::= type_specifier_seq // Rule 443: conversion_type_id ::= type_specifier_seq
// //
case 441: { action.builder. case 443: { action.builder.
consumeTypeId(false); break; consumeTypeId(false); break;
} }
// //
// Rule 442: conversion_declarator ::= <openscope-ast> ptr_operator_seq // Rule 444: conversion_declarator ::= <openscope-ast> ptr_operator_seq
// //
case 442: { action.builder. case 444: { action.builder.
consumeDeclaratorWithPointer(false); break; consumeDeclaratorWithPointer(false); break;
} }
// //
// Rule 448: mem_initializer ::= mem_initializer_name ( expression_list_opt ) // Rule 450: mem_initializer ::= mem_initializer_name ( expression_list_opt )
// //
case 448: { action.builder. case 450: { action.builder.
consumeConstructorChainInitializer(); break; consumeConstructorChainInitializer(); break;
} }
// //
// Rule 449: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name // Rule 451: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 449: { action.builder. case 451: { action.builder.
consumeQualifiedId(false); break; consumeQualifiedId(false); break;
} }
// //
// Rule 452: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt > // Rule 454: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt >
// //
case 452: { action.builder. case 454: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 453: operator_id_name ::= operator overloadable_operator // Rule 455: operator_id_name ::= operator overloadable_operator
// //
case 453: { action.builder. case 455: { action.builder.
consumeOperatorName(); break; consumeOperatorName(); break;
} }
// //
// Rule 496: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration // Rule 498: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration
// //
case 496: { action.builder. case 498: { action.builder.
consumeTemplateDeclaration(); break; consumeTemplateDeclaration(); break;
} }
// //
// Rule 497: export_opt ::= export // Rule 499: export_opt ::= export
// //
case 497: { action.builder. case 499: { action.builder.
consumePlaceHolder(); break; consumePlaceHolder(); break;
} }
// //
// Rule 498: export_opt ::= $Empty // Rule 500: export_opt ::= $Empty
// //
case 498: { action.builder. case 500: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 502: template_parameter ::= parameter_declaration // Rule 504: template_parameter ::= parameter_declaration
// //
case 502: { action.builder. case 504: { action.builder.
consumeTemplateParamterDeclaration(); break; consumeTemplateParamterDeclaration(); break;
} }
// //
// Rule 503: type_parameter ::= class identifier_name_opt // Rule 505: type_parameter ::= class identifier_name_opt
//
case 503: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 504: type_parameter ::= class identifier_name_opt = type_id
//
case 504: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 505: type_parameter ::= typename identifier_name_opt
// //
case 505: { action.builder. case 505: { action.builder.
consumeSimpleTypeTemplateParameter(false); break; consumeSimpleTypeTemplateParameter(false); break;
} }
// //
// Rule 506: type_parameter ::= typename identifier_name_opt = type_id // Rule 506: type_parameter ::= class identifier_name_opt = type_id
// //
case 506: { action.builder. case 506: { action.builder.
consumeSimpleTypeTemplateParameter(true); break; consumeSimpleTypeTemplateParameter(true); break;
} }
// //
// Rule 507: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt // Rule 507: type_parameter ::= typename identifier_name_opt
// //
case 507: { action.builder. case 507: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 508: type_parameter ::= typename identifier_name_opt = type_id
//
case 508: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 509: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt
//
case 509: { action.builder.
consumeTemplatedTypeTemplateParameter(false); break; consumeTemplatedTypeTemplateParameter(false); break;
} }
// //
// Rule 508: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression // Rule 510: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression
// //
case 508: { action.builder. case 510: { action.builder.
consumeTemplatedTypeTemplateParameter(true); break; consumeTemplatedTypeTemplateParameter(true); break;
} }
// //
// Rule 509: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt > // Rule 511: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt >
// //
case 509: { action.builder. case 511: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 515: template_argument ::= type_id // Rule 517: template_argument ::= type_id
// //
case 515: { action.builder. case 517: { action.builder.
consumeTemplateArgumentTypeId(); break; consumeTemplateArgumentTypeId(); break;
} }
// //
// Rule 516: explicit_instantiation ::= template declaration // Rule 518: explicit_instantiation ::= template declaration
// //
case 516: { action.builder. case 518: { action.builder.
consumeTemplateExplicitInstantiation(); break; consumeTemplateExplicitInstantiation(); break;
} }
// //
// Rule 517: explicit_specialization ::= template < > declaration // Rule 519: explicit_specialization ::= template < > declaration
// //
case 517: { action.builder. case 519: { action.builder.
consumeTemplateExplicitSpecialization(); break; consumeTemplateExplicitSpecialization(); break;
} }
// //
// Rule 518: try_block ::= try compound_statement <openscope-ast> handler_seq // Rule 520: try_block ::= try compound_statement <openscope-ast> handler_seq
// //
case 518: { action.builder. case 520: { action.builder.
consumeStatementTryBlock(); break; consumeStatementTryBlock(); break;
} }
// //
// Rule 521: handler ::= catch ( exception_declaration ) compound_statement // Rule 523: handler ::= catch ( exception_declaration ) compound_statement
// //
case 521: { action.builder. case 523: { action.builder.
consumeStatementCatchHandler(false); break; consumeStatementCatchHandler(false); break;
} }
// //
// Rule 522: handler ::= catch ( ... ) compound_statement // Rule 524: handler ::= catch ( ... ) compound_statement
// //
case 522: { action.builder. case 524: { action.builder.
consumeStatementCatchHandler(true); break; consumeStatementCatchHandler(true); break;
} }
// //
// Rule 523: exception_declaration ::= type_specifier_seq <openscope-ast> declarator // Rule 525: exception_declaration ::= type_specifier_seq <openscope-ast> declarator
//
case 523: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 524: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
//
case 524: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 525: exception_declaration ::= type_specifier_seq
// //
case 525: { action.builder. case 525: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 526: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
//
case 526: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 527: exception_declaration ::= type_specifier_seq
//
case 527: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 533: no_cast_start ::= ERROR_TOKEN // Rule 535: no_cast_start ::= ERROR_TOKEN
// //
case 533: { action.builder. case 535: { action.builder.
consumeExpressionProblem(); break; consumeExpressionProblem(); break;
} }

View file

@ -118,7 +118,7 @@ public interface CPPNoCastExpressionParsersym {
TK_Colon = 73, TK_Colon = 73,
TK_ColonColon = 4, TK_ColonColon = 4,
TK_DotDotDot = 95, TK_DotDotDot = 95,
TK_Assign = 70, TK_Assign = 69,
TK_StarAssign = 104, TK_StarAssign = 104,
TK_SlashAssign = 105, TK_SlashAssign = 105,
TK_PercentAssign = 106, TK_PercentAssign = 106,
@ -129,7 +129,7 @@ public interface CPPNoCastExpressionParsersym {
TK_AndAssign = 111, TK_AndAssign = 111,
TK_CaretAssign = 112, TK_CaretAssign = 112,
TK_OrAssign = 113, TK_OrAssign = 113,
TK_Comma = 69, TK_Comma = 70,
TK_RightBracket = 118, TK_RightBracket = 118,
TK_RightParen = 74, TK_RightParen = 74,
TK_RightBrace = 71, TK_RightBrace = 71,
@ -209,8 +209,8 @@ public interface CPPNoCastExpressionParsersym {
"enum", "enum",
"struct", "struct",
"union", "union",
"Comma",
"Assign", "Assign",
"Comma",
"RightBrace", "RightBrace",
"ERROR_TOKEN", "ERROR_TOKEN",
"Colon", "Colon",

View file

@ -171,13 +171,15 @@ private CPPParserAction action;
public CPPNoFunctionDeclaratorParser() { // constructor public CPPNoFunctionDeclaratorParser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
// binding resolution actions need access to IASTName nodes, temporary // binding resolution actions need access to IASTName nodes, temporary
action = new CPPParserAction (); action = new CPPParserAction ();
//action.resolver = new C99TypedefTrackerParserAction (this); //action.resolver = new C99TypedefTrackerParserAction (this);
action.builder = new CPPBuildASTParserAction ( CPPNodeFactory.getDefault() , this, tu); action.builder = new CPPBuildASTParserAction ( CPPNodeFactory.getDefault() , this, tu);
//action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols); //action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols);
action.builder.setParserOptions(options);
// comment this line to use with backtracking parser // comment this line to use with backtracking parser
//setParserAction(action); //setParserAction(action);
} }
@ -189,10 +191,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // _1 means full error handling final int errorRepairCount = -1; // _1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -1856,14 +1858,14 @@ public CPPNoFunctionDeclaratorParser(String[] mapFrom) { // constructor
} }
// //
// Rule 381: initializer_clause ::= { <openscope-ast> initializer_list , } // Rule 381: initializer_clause ::= start_initializer_list { <openscope-ast> initializer_list , } end_initializer_list
// //
case 381: { action.builder. case 381: { action.builder.
consumeInitializerList(); break; consumeInitializerList(); break;
} }
// //
// Rule 382: initializer_clause ::= { <openscope-ast> initializer_list } // Rule 382: initializer_clause ::= start_initializer_list { <openscope-ast> initializer_list } end_initializer_list
// //
case 382: { action.builder. case 382: { action.builder.
consumeInitializerList(); break; consumeInitializerList(); break;
@ -1877,380 +1879,394 @@ public CPPNoFunctionDeclaratorParser(String[] mapFrom) { // constructor
} }
// //
// Rule 388: class_specifier ::= class_head { <openscope-ast> member_declaration_list_opt } // Rule 384: start_initializer_list ::= $Empty
// //
case 388: { action.builder. case 384: { action.builder.
initializerListStart(); break;
}
//
// Rule 385: end_initializer_list ::= $Empty
//
case 385: { action.builder.
initializerListEnd(); break;
}
//
// Rule 390: class_specifier ::= class_head { <openscope-ast> member_declaration_list_opt }
//
case 390: { action.builder.
consumeClassSpecifier(); break; consumeClassSpecifier(); break;
} }
// //
// Rule 389: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt // Rule 391: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt
//
case 389: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 390: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
//
case 390: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 391: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
// //
case 391: { action.builder. case 391: { action.builder.
consumeClassHead(true); break; consumeClassHead(false); break;
} }
// //
// Rule 392: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt // Rule 392: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
// //
case 392: { action.builder. case 392: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 393: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
//
case 393: { action.builder.
consumeClassHead(true); break; consumeClassHead(true); break;
} }
// //
// Rule 394: identifier_name_opt ::= $Empty // Rule 394: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt
// //
case 394: { action.builder. case 394: { action.builder.
consumeClassHead(true); break;
}
//
// Rule 396: identifier_name_opt ::= $Empty
//
case 396: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 398: visibility_label ::= access_specifier_keyword : // Rule 400: visibility_label ::= access_specifier_keyword :
// //
case 398: { action.builder. case 400: { action.builder.
consumeVisibilityLabel(); break; consumeVisibilityLabel(); break;
} }
// //
// Rule 399: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ; // Rule 401: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ;
// //
case 399: { action.builder. case 401: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 400: member_declaration ::= declaration_specifiers_opt ; // Rule 402: member_declaration ::= declaration_specifiers_opt ;
// //
case 400: { action.builder. case 402: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 403: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ; // Rule 405: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ;
// //
case 403: { action.builder. case 405: { action.builder.
consumeMemberDeclarationQualifiedId(); break; consumeMemberDeclarationQualifiedId(); break;
} }
// //
// Rule 409: member_declaration ::= ERROR_TOKEN // Rule 411: member_declaration ::= ERROR_TOKEN
// //
case 409: { action.builder. case 411: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }
// //
// Rule 417: member_declarator ::= declarator constant_initializer // Rule 419: member_declarator ::= declarator constant_initializer
// //
case 417: { action.builder. case 419: { action.builder.
consumeMemberDeclaratorWithInitializer(); break; consumeMemberDeclaratorWithInitializer(); break;
} }
// //
// Rule 418: member_declarator ::= bit_field_declarator : constant_expression // Rule 420: member_declarator ::= bit_field_declarator : constant_expression
// //
case 418: { action.builder. case 420: { action.builder.
consumeBitField(true); break; consumeBitField(true); break;
} }
// //
// Rule 419: member_declarator ::= : constant_expression // Rule 421: member_declarator ::= : constant_expression
// //
case 419: { action.builder. case 421: { action.builder.
consumeBitField(false); break; consumeBitField(false); break;
} }
// //
// Rule 420: bit_field_declarator ::= identifier_name // Rule 422: bit_field_declarator ::= identifier_name
// //
case 420: { action.builder. case 422: { action.builder.
consumeDirectDeclaratorIdentifier(); break; consumeDirectDeclaratorIdentifier(); break;
} }
// //
// Rule 421: constant_initializer ::= = constant_expression // Rule 423: constant_initializer ::= = constant_expression
// //
case 421: { action.builder. case 423: { action.builder.
consumeInitializer(); break; consumeInitializer(); break;
} }
// //
// Rule 427: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name // Rule 429: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 427: { action.builder. case 429: { action.builder.
consumeBaseSpecifier(false, false); break; consumeBaseSpecifier(false, false); break;
} }
// //
// Rule 428: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name // Rule 430: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name
//
case 428: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 429: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
//
case 429: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 430: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
// //
case 430: { action.builder. case 430: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 431: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
//
case 431: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 432: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
//
case 432: { action.builder.
consumeBaseSpecifier(true, false); break; consumeBaseSpecifier(true, false); break;
} }
// //
// Rule 431: access_specifier_keyword ::= private // Rule 433: access_specifier_keyword ::= private
//
case 431: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 432: access_specifier_keyword ::= protected
//
case 432: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 433: access_specifier_keyword ::= public
// //
case 433: { action.builder. case 433: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 435: access_specifier_keyword_opt ::= $Empty // Rule 434: access_specifier_keyword ::= protected
//
case 434: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 435: access_specifier_keyword ::= public
// //
case 435: { action.builder. case 435: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 437: access_specifier_keyword_opt ::= $Empty
//
case 437: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 437: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt > // Rule 439: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt >
// //
case 437: { action.builder. case 439: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 438: conversion_function_id ::= operator conversion_type_id // Rule 440: conversion_function_id ::= operator conversion_type_id
// //
case 438: { action.builder. case 440: { action.builder.
consumeConversionName(); break; consumeConversionName(); break;
} }
// //
// Rule 439: conversion_type_id ::= type_specifier_seq conversion_declarator // Rule 441: conversion_type_id ::= type_specifier_seq conversion_declarator
// //
case 439: { action.builder. case 441: { action.builder.
consumeTypeId(true); break; consumeTypeId(true); break;
} }
// //
// Rule 440: conversion_type_id ::= type_specifier_seq // Rule 442: conversion_type_id ::= type_specifier_seq
// //
case 440: { action.builder. case 442: { action.builder.
consumeTypeId(false); break; consumeTypeId(false); break;
} }
// //
// Rule 441: conversion_declarator ::= <openscope-ast> ptr_operator_seq // Rule 443: conversion_declarator ::= <openscope-ast> ptr_operator_seq
// //
case 441: { action.builder. case 443: { action.builder.
consumeDeclaratorWithPointer(false); break; consumeDeclaratorWithPointer(false); break;
} }
// //
// Rule 447: mem_initializer ::= mem_initializer_name ( expression_list_opt ) // Rule 449: mem_initializer ::= mem_initializer_name ( expression_list_opt )
// //
case 447: { action.builder. case 449: { action.builder.
consumeConstructorChainInitializer(); break; consumeConstructorChainInitializer(); break;
} }
// //
// Rule 448: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name // Rule 450: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 448: { action.builder. case 450: { action.builder.
consumeQualifiedId(false); break; consumeQualifiedId(false); break;
} }
// //
// Rule 451: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt > // Rule 453: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt >
// //
case 451: { action.builder. case 453: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 452: operator_id_name ::= operator overloadable_operator // Rule 454: operator_id_name ::= operator overloadable_operator
// //
case 452: { action.builder. case 454: { action.builder.
consumeOperatorName(); break; consumeOperatorName(); break;
} }
// //
// Rule 495: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration // Rule 497: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration
// //
case 495: { action.builder. case 497: { action.builder.
consumeTemplateDeclaration(); break; consumeTemplateDeclaration(); break;
} }
// //
// Rule 496: export_opt ::= export // Rule 498: export_opt ::= export
// //
case 496: { action.builder. case 498: { action.builder.
consumePlaceHolder(); break; consumePlaceHolder(); break;
} }
// //
// Rule 497: export_opt ::= $Empty // Rule 499: export_opt ::= $Empty
// //
case 497: { action.builder. case 499: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 501: template_parameter ::= parameter_declaration // Rule 503: template_parameter ::= parameter_declaration
// //
case 501: { action.builder. case 503: { action.builder.
consumeTemplateParamterDeclaration(); break; consumeTemplateParamterDeclaration(); break;
} }
// //
// Rule 502: type_parameter ::= class identifier_name_opt // Rule 504: type_parameter ::= class identifier_name_opt
//
case 502: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 503: type_parameter ::= class identifier_name_opt = type_id
//
case 503: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 504: type_parameter ::= typename identifier_name_opt
// //
case 504: { action.builder. case 504: { action.builder.
consumeSimpleTypeTemplateParameter(false); break; consumeSimpleTypeTemplateParameter(false); break;
} }
// //
// Rule 505: type_parameter ::= typename identifier_name_opt = type_id // Rule 505: type_parameter ::= class identifier_name_opt = type_id
// //
case 505: { action.builder. case 505: { action.builder.
consumeSimpleTypeTemplateParameter(true); break; consumeSimpleTypeTemplateParameter(true); break;
} }
// //
// Rule 506: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt // Rule 506: type_parameter ::= typename identifier_name_opt
// //
case 506: { action.builder. case 506: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 507: type_parameter ::= typename identifier_name_opt = type_id
//
case 507: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 508: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt
//
case 508: { action.builder.
consumeTemplatedTypeTemplateParameter(false); break; consumeTemplatedTypeTemplateParameter(false); break;
} }
// //
// Rule 507: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression // Rule 509: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression
// //
case 507: { action.builder. case 509: { action.builder.
consumeTemplatedTypeTemplateParameter(true); break; consumeTemplatedTypeTemplateParameter(true); break;
} }
// //
// Rule 508: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt > // Rule 510: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt >
// //
case 508: { action.builder. case 510: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 514: template_argument ::= type_id // Rule 516: template_argument ::= type_id
// //
case 514: { action.builder. case 516: { action.builder.
consumeTemplateArgumentTypeId(); break; consumeTemplateArgumentTypeId(); break;
} }
// //
// Rule 515: explicit_instantiation ::= template declaration // Rule 517: explicit_instantiation ::= template declaration
// //
case 515: { action.builder. case 517: { action.builder.
consumeTemplateExplicitInstantiation(); break; consumeTemplateExplicitInstantiation(); break;
} }
// //
// Rule 516: explicit_specialization ::= template < > declaration // Rule 518: explicit_specialization ::= template < > declaration
// //
case 516: { action.builder. case 518: { action.builder.
consumeTemplateExplicitSpecialization(); break; consumeTemplateExplicitSpecialization(); break;
} }
// //
// Rule 517: try_block ::= try compound_statement <openscope-ast> handler_seq // Rule 519: try_block ::= try compound_statement <openscope-ast> handler_seq
// //
case 517: { action.builder. case 519: { action.builder.
consumeStatementTryBlock(); break; consumeStatementTryBlock(); break;
} }
// //
// Rule 520: handler ::= catch ( exception_declaration ) compound_statement // Rule 522: handler ::= catch ( exception_declaration ) compound_statement
// //
case 520: { action.builder. case 522: { action.builder.
consumeStatementCatchHandler(false); break; consumeStatementCatchHandler(false); break;
} }
// //
// Rule 521: handler ::= catch ( ... ) compound_statement // Rule 523: handler ::= catch ( ... ) compound_statement
// //
case 521: { action.builder. case 523: { action.builder.
consumeStatementCatchHandler(true); break; consumeStatementCatchHandler(true); break;
} }
// //
// Rule 522: exception_declaration ::= type_specifier_seq <openscope-ast> declarator // Rule 524: exception_declaration ::= type_specifier_seq <openscope-ast> declarator
//
case 522: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 523: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
//
case 523: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 524: exception_declaration ::= type_specifier_seq
// //
case 524: { action.builder. case 524: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 525: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
//
case 525: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 526: exception_declaration ::= type_specifier_seq
//
case 526: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 532: no_function_declarator_start ::= ERROR_TOKEN // Rule 534: no_function_declarator_start ::= ERROR_TOKEN
// //
case 532: { action.builder. case 534: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }

View file

@ -20,7 +20,7 @@ public interface CPPNoFunctionDeclaratorParsersym {
TK_bool = 15, TK_bool = 15,
TK_break = 77, TK_break = 77,
TK_case = 78, TK_case = 78,
TK_catch = 120, TK_catch = 119,
TK_char = 16, TK_char = 16,
TK_class = 61, TK_class = 61,
TK_const = 45, TK_const = 45,
@ -88,7 +88,7 @@ public interface CPPNoFunctionDeclaratorParsersym {
TK_Invalid = 123, TK_Invalid = 123,
TK_LeftBracket = 59, TK_LeftBracket = 59,
TK_LeftParen = 3, TK_LeftParen = 3,
TK_Dot = 121, TK_Dot = 120,
TK_DotStar = 96, TK_DotStar = 96,
TK_Arrow = 103, TK_Arrow = 103,
TK_ArrowStar = 90, TK_ArrowStar = 90,
@ -96,8 +96,8 @@ public interface CPPNoFunctionDeclaratorParsersym {
TK_MinusMinus = 27, TK_MinusMinus = 27,
TK_And = 9, TK_And = 9,
TK_Star = 6, TK_Star = 6,
TK_Plus = 12, TK_Plus = 11,
TK_Minus = 13, TK_Minus = 12,
TK_Tilde = 5, TK_Tilde = 5,
TK_Bang = 29, TK_Bang = 29,
TK_Slash = 91, TK_Slash = 91,
@ -118,7 +118,7 @@ public interface CPPNoFunctionDeclaratorParsersym {
TK_Colon = 73, TK_Colon = 73,
TK_ColonColon = 4, TK_ColonColon = 4,
TK_DotDotDot = 95, TK_DotDotDot = 95,
TK_Assign = 70, TK_Assign = 69,
TK_StarAssign = 104, TK_StarAssign = 104,
TK_SlashAssign = 105, TK_SlashAssign = 105,
TK_PercentAssign = 106, TK_PercentAssign = 106,
@ -129,15 +129,15 @@ public interface CPPNoFunctionDeclaratorParsersym {
TK_AndAssign = 111, TK_AndAssign = 111,
TK_CaretAssign = 112, TK_CaretAssign = 112,
TK_OrAssign = 113, TK_OrAssign = 113,
TK_Comma = 69, TK_Comma = 70,
TK_RightBracket = 118, TK_RightBracket = 118,
TK_RightParen = 74, TK_RightParen = 74,
TK_RightBrace = 71, TK_RightBrace = 71,
TK_SemiColon = 11, TK_SemiColon = 13,
TK_LeftBrace = 64, TK_LeftBrace = 64,
TK_ERROR_TOKEN = 72, TK_ERROR_TOKEN = 72,
TK_0 = 44, TK_0 = 44,
TK_EOF_TOKEN = 119; TK_EOF_TOKEN = 121;
public final static String orderedTerminalSymbols[] = { public final static String orderedTerminalSymbols[] = {
"", "",
@ -151,9 +151,9 @@ public interface CPPNoFunctionDeclaratorParsersym {
"EndOfCompletion", "EndOfCompletion",
"And", "And",
"typename", "typename",
"SemiColon",
"Plus", "Plus",
"Minus", "Minus",
"SemiColon",
"extern", "extern",
"bool", "bool",
"char", "char",
@ -209,8 +209,8 @@ public interface CPPNoFunctionDeclaratorParsersym {
"enum", "enum",
"struct", "struct",
"union", "union",
"Comma",
"Assign", "Assign",
"Comma",
"RightBrace", "RightBrace",
"ERROR_TOKEN", "ERROR_TOKEN",
"Colon", "Colon",
@ -259,9 +259,9 @@ public interface CPPNoFunctionDeclaratorParsersym {
"public", "public",
"Question", "Question",
"RightBracket", "RightBracket",
"EOF_TOKEN",
"catch", "catch",
"Dot", "Dot",
"EOF_TOKEN",
"else", "else",
"Invalid" "Invalid"
}; };

View file

@ -171,13 +171,15 @@ private CPPParserAction action;
public CPPParser() { // constructor public CPPParser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
// binding resolution actions need access to IASTName nodes, temporary // binding resolution actions need access to IASTName nodes, temporary
action = new CPPParserAction (); action = new CPPParserAction ();
//action.resolver = new C99TypedefTrackerParserAction (this); //action.resolver = new C99TypedefTrackerParserAction (this);
action.builder = new CPPBuildASTParserAction ( CPPNodeFactory.getDefault() , this, tu); action.builder = new CPPBuildASTParserAction ( CPPNodeFactory.getDefault() , this, tu);
//action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols); //action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols);
action.builder.setParserOptions(options);
// comment this line to use with backtracking parser // comment this line to use with backtracking parser
//setParserAction(action); //setParserAction(action);
} }
@ -189,10 +191,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // _1 means full error handling final int errorRepairCount = -1; // _1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -1863,14 +1865,14 @@ public CPPParser(String[] mapFrom) { // constructor
} }
// //
// Rule 383: initializer_clause ::= { <openscope-ast> initializer_list , } // Rule 383: initializer_clause ::= start_initializer_list { <openscope-ast> initializer_list , } end_initializer_list
// //
case 383: { action.builder. case 383: { action.builder.
consumeInitializerList(); break; consumeInitializerList(); break;
} }
// //
// Rule 384: initializer_clause ::= { <openscope-ast> initializer_list } // Rule 384: initializer_clause ::= start_initializer_list { <openscope-ast> initializer_list } end_initializer_list
// //
case 384: { action.builder. case 384: { action.builder.
consumeInitializerList(); break; consumeInitializerList(); break;
@ -1884,373 +1886,387 @@ public CPPParser(String[] mapFrom) { // constructor
} }
// //
// Rule 390: class_specifier ::= class_head { <openscope-ast> member_declaration_list_opt } // Rule 386: start_initializer_list ::= $Empty
// //
case 390: { action.builder. case 386: { action.builder.
initializerListStart(); break;
}
//
// Rule 387: end_initializer_list ::= $Empty
//
case 387: { action.builder.
initializerListEnd(); break;
}
//
// Rule 392: class_specifier ::= class_head { <openscope-ast> member_declaration_list_opt }
//
case 392: { action.builder.
consumeClassSpecifier(); break; consumeClassSpecifier(); break;
} }
// //
// Rule 391: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt // Rule 393: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt
//
case 391: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 392: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
//
case 392: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 393: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
// //
case 393: { action.builder. case 393: { action.builder.
consumeClassHead(true); break; consumeClassHead(false); break;
} }
// //
// Rule 394: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt // Rule 394: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
// //
case 394: { action.builder. case 394: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 395: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
//
case 395: { action.builder.
consumeClassHead(true); break; consumeClassHead(true); break;
} }
// //
// Rule 396: identifier_name_opt ::= $Empty // Rule 396: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt
// //
case 396: { action.builder. case 396: { action.builder.
consumeClassHead(true); break;
}
//
// Rule 398: identifier_name_opt ::= $Empty
//
case 398: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 400: visibility_label ::= access_specifier_keyword : // Rule 402: visibility_label ::= access_specifier_keyword :
// //
case 400: { action.builder. case 402: { action.builder.
consumeVisibilityLabel(); break; consumeVisibilityLabel(); break;
} }
// //
// Rule 401: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ; // Rule 403: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ;
// //
case 401: { action.builder. case 403: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 402: member_declaration ::= declaration_specifiers_opt ; // Rule 404: member_declaration ::= declaration_specifiers_opt ;
// //
case 402: { action.builder. case 404: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 405: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ; // Rule 407: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ;
// //
case 405: { action.builder. case 407: { action.builder.
consumeMemberDeclarationQualifiedId(); break; consumeMemberDeclarationQualifiedId(); break;
} }
// //
// Rule 411: member_declaration ::= ERROR_TOKEN // Rule 413: member_declaration ::= ERROR_TOKEN
// //
case 411: { action.builder. case 413: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }
// //
// Rule 419: member_declarator ::= declarator constant_initializer // Rule 421: member_declarator ::= declarator constant_initializer
// //
case 419: { action.builder. case 421: { action.builder.
consumeMemberDeclaratorWithInitializer(); break; consumeMemberDeclaratorWithInitializer(); break;
} }
// //
// Rule 420: member_declarator ::= bit_field_declarator : constant_expression // Rule 422: member_declarator ::= bit_field_declarator : constant_expression
// //
case 420: { action.builder. case 422: { action.builder.
consumeBitField(true); break; consumeBitField(true); break;
} }
// //
// Rule 421: member_declarator ::= : constant_expression // Rule 423: member_declarator ::= : constant_expression
// //
case 421: { action.builder. case 423: { action.builder.
consumeBitField(false); break; consumeBitField(false); break;
} }
// //
// Rule 422: bit_field_declarator ::= identifier_name // Rule 424: bit_field_declarator ::= identifier_name
// //
case 422: { action.builder. case 424: { action.builder.
consumeDirectDeclaratorIdentifier(); break; consumeDirectDeclaratorIdentifier(); break;
} }
// //
// Rule 423: constant_initializer ::= = constant_expression // Rule 425: constant_initializer ::= = constant_expression
// //
case 423: { action.builder. case 425: { action.builder.
consumeInitializer(); break; consumeInitializer(); break;
} }
// //
// Rule 429: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name // Rule 431: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 429: { action.builder. case 431: { action.builder.
consumeBaseSpecifier(false, false); break; consumeBaseSpecifier(false, false); break;
} }
// //
// Rule 430: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name // Rule 432: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name
//
case 430: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 431: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
//
case 431: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 432: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
// //
case 432: { action.builder. case 432: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 433: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
//
case 433: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 434: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
//
case 434: { action.builder.
consumeBaseSpecifier(true, false); break; consumeBaseSpecifier(true, false); break;
} }
// //
// Rule 433: access_specifier_keyword ::= private // Rule 435: access_specifier_keyword ::= private
//
case 433: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 434: access_specifier_keyword ::= protected
//
case 434: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 435: access_specifier_keyword ::= public
// //
case 435: { action.builder. case 435: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 437: access_specifier_keyword_opt ::= $Empty // Rule 436: access_specifier_keyword ::= protected
//
case 436: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 437: access_specifier_keyword ::= public
// //
case 437: { action.builder. case 437: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 439: access_specifier_keyword_opt ::= $Empty
//
case 439: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 439: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt > // Rule 441: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt >
// //
case 439: { action.builder. case 441: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 440: conversion_function_id ::= operator conversion_type_id // Rule 442: conversion_function_id ::= operator conversion_type_id
// //
case 440: { action.builder. case 442: { action.builder.
consumeConversionName(); break; consumeConversionName(); break;
} }
// //
// Rule 441: conversion_type_id ::= type_specifier_seq conversion_declarator // Rule 443: conversion_type_id ::= type_specifier_seq conversion_declarator
// //
case 441: { action.builder. case 443: { action.builder.
consumeTypeId(true); break; consumeTypeId(true); break;
} }
// //
// Rule 442: conversion_type_id ::= type_specifier_seq // Rule 444: conversion_type_id ::= type_specifier_seq
// //
case 442: { action.builder. case 444: { action.builder.
consumeTypeId(false); break; consumeTypeId(false); break;
} }
// //
// Rule 443: conversion_declarator ::= <openscope-ast> ptr_operator_seq // Rule 445: conversion_declarator ::= <openscope-ast> ptr_operator_seq
// //
case 443: { action.builder. case 445: { action.builder.
consumeDeclaratorWithPointer(false); break; consumeDeclaratorWithPointer(false); break;
} }
// //
// Rule 449: mem_initializer ::= mem_initializer_name ( expression_list_opt ) // Rule 451: mem_initializer ::= mem_initializer_name ( expression_list_opt )
// //
case 449: { action.builder. case 451: { action.builder.
consumeConstructorChainInitializer(); break; consumeConstructorChainInitializer(); break;
} }
// //
// Rule 450: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name // Rule 452: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 450: { action.builder. case 452: { action.builder.
consumeQualifiedId(false); break; consumeQualifiedId(false); break;
} }
// //
// Rule 453: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt > // Rule 455: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt >
// //
case 453: { action.builder. case 455: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 454: operator_id_name ::= operator overloadable_operator // Rule 456: operator_id_name ::= operator overloadable_operator
// //
case 454: { action.builder. case 456: { action.builder.
consumeOperatorName(); break; consumeOperatorName(); break;
} }
// //
// Rule 497: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration // Rule 499: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration
// //
case 497: { action.builder. case 499: { action.builder.
consumeTemplateDeclaration(); break; consumeTemplateDeclaration(); break;
} }
// //
// Rule 498: export_opt ::= export // Rule 500: export_opt ::= export
// //
case 498: { action.builder. case 500: { action.builder.
consumePlaceHolder(); break; consumePlaceHolder(); break;
} }
// //
// Rule 499: export_opt ::= $Empty // Rule 501: export_opt ::= $Empty
// //
case 499: { action.builder. case 501: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 503: template_parameter ::= parameter_declaration // Rule 505: template_parameter ::= parameter_declaration
// //
case 503: { action.builder. case 505: { action.builder.
consumeTemplateParamterDeclaration(); break; consumeTemplateParamterDeclaration(); break;
} }
// //
// Rule 504: type_parameter ::= class identifier_name_opt // Rule 506: type_parameter ::= class identifier_name_opt
//
case 504: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 505: type_parameter ::= class identifier_name_opt = type_id
//
case 505: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 506: type_parameter ::= typename identifier_name_opt
// //
case 506: { action.builder. case 506: { action.builder.
consumeSimpleTypeTemplateParameter(false); break; consumeSimpleTypeTemplateParameter(false); break;
} }
// //
// Rule 507: type_parameter ::= typename identifier_name_opt = type_id // Rule 507: type_parameter ::= class identifier_name_opt = type_id
// //
case 507: { action.builder. case 507: { action.builder.
consumeSimpleTypeTemplateParameter(true); break; consumeSimpleTypeTemplateParameter(true); break;
} }
// //
// Rule 508: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt // Rule 508: type_parameter ::= typename identifier_name_opt
// //
case 508: { action.builder. case 508: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 509: type_parameter ::= typename identifier_name_opt = type_id
//
case 509: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 510: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt
//
case 510: { action.builder.
consumeTemplatedTypeTemplateParameter(false); break; consumeTemplatedTypeTemplateParameter(false); break;
} }
// //
// Rule 509: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression // Rule 511: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression
// //
case 509: { action.builder. case 511: { action.builder.
consumeTemplatedTypeTemplateParameter(true); break; consumeTemplatedTypeTemplateParameter(true); break;
} }
// //
// Rule 510: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt > // Rule 512: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt >
// //
case 510: { action.builder. case 512: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 516: template_argument ::= type_id // Rule 518: template_argument ::= type_id
// //
case 516: { action.builder. case 518: { action.builder.
consumeTemplateArgumentTypeId(); break; consumeTemplateArgumentTypeId(); break;
} }
// //
// Rule 517: explicit_instantiation ::= template declaration // Rule 519: explicit_instantiation ::= template declaration
// //
case 517: { action.builder. case 519: { action.builder.
consumeTemplateExplicitInstantiation(); break; consumeTemplateExplicitInstantiation(); break;
} }
// //
// Rule 518: explicit_specialization ::= template < > declaration // Rule 520: explicit_specialization ::= template < > declaration
// //
case 518: { action.builder. case 520: { action.builder.
consumeTemplateExplicitSpecialization(); break; consumeTemplateExplicitSpecialization(); break;
} }
// //
// Rule 519: try_block ::= try compound_statement <openscope-ast> handler_seq // Rule 521: try_block ::= try compound_statement <openscope-ast> handler_seq
// //
case 519: { action.builder. case 521: { action.builder.
consumeStatementTryBlock(); break; consumeStatementTryBlock(); break;
} }
// //
// Rule 522: handler ::= catch ( exception_declaration ) compound_statement // Rule 524: handler ::= catch ( exception_declaration ) compound_statement
// //
case 522: { action.builder. case 524: { action.builder.
consumeStatementCatchHandler(false); break; consumeStatementCatchHandler(false); break;
} }
// //
// Rule 523: handler ::= catch ( ... ) compound_statement // Rule 525: handler ::= catch ( ... ) compound_statement
// //
case 523: { action.builder. case 525: { action.builder.
consumeStatementCatchHandler(true); break; consumeStatementCatchHandler(true); break;
} }
// //
// Rule 524: exception_declaration ::= type_specifier_seq <openscope-ast> declarator // Rule 526: exception_declaration ::= type_specifier_seq <openscope-ast> declarator
//
case 524: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 525: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
//
case 525: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 526: exception_declaration ::= type_specifier_seq
// //
case 526: { action.builder. case 526: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 527: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
//
case 527: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 528: exception_declaration ::= type_specifier_seq
//
case 528: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }

View file

@ -118,7 +118,7 @@ public interface CPPParsersym {
TK_Colon = 73, TK_Colon = 73,
TK_ColonColon = 4, TK_ColonColon = 4,
TK_DotDotDot = 95, TK_DotDotDot = 95,
TK_Assign = 70, TK_Assign = 69,
TK_StarAssign = 104, TK_StarAssign = 104,
TK_SlashAssign = 105, TK_SlashAssign = 105,
TK_PercentAssign = 106, TK_PercentAssign = 106,
@ -129,13 +129,13 @@ public interface CPPParsersym {
TK_AndAssign = 111, TK_AndAssign = 111,
TK_CaretAssign = 112, TK_CaretAssign = 112,
TK_OrAssign = 113, TK_OrAssign = 113,
TK_Comma = 69, TK_Comma = 70,
TK_RightBracket = 118, TK_RightBracket = 118,
TK_RightParen = 74, TK_RightParen = 74,
TK_RightBrace = 71, TK_RightBrace = 72,
TK_SemiColon = 11, TK_SemiColon = 11,
TK_LeftBrace = 67, TK_LeftBrace = 67,
TK_ERROR_TOKEN = 72, TK_ERROR_TOKEN = 71,
TK_0 = 55, TK_0 = 55,
TK_EOF_TOKEN = 121; TK_EOF_TOKEN = 121;
@ -209,10 +209,10 @@ public interface CPPParsersym {
"union", "union",
"LeftBrace", "LeftBrace",
"GT", "GT",
"Comma",
"Assign", "Assign",
"RightBrace", "Comma",
"ERROR_TOKEN", "ERROR_TOKEN",
"RightBrace",
"Colon", "Colon",
"RightParen", "RightParen",
"try", "try",

View file

@ -171,13 +171,15 @@ private CPPParserAction action;
public CPPSizeofExpressionParser() { // constructor public CPPSizeofExpressionParser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
// binding resolution actions need access to IASTName nodes, temporary // binding resolution actions need access to IASTName nodes, temporary
action = new CPPParserAction (); action = new CPPParserAction ();
//action.resolver = new C99TypedefTrackerParserAction (this); //action.resolver = new C99TypedefTrackerParserAction (this);
action.builder = new CPPBuildASTParserAction ( CPPNodeFactory.getDefault() , this, tu); action.builder = new CPPBuildASTParserAction ( CPPNodeFactory.getDefault() , this, tu);
//action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols); //action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols);
action.builder.setParserOptions(options);
// comment this line to use with backtracking parser // comment this line to use with backtracking parser
//setParserAction(action); //setParserAction(action);
} }
@ -189,10 +191,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // _1 means full error handling final int errorRepairCount = -1; // _1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -1849,14 +1851,14 @@ public CPPSizeofExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 381: initializer_clause ::= { <openscope-ast> initializer_list , } // Rule 381: initializer_clause ::= start_initializer_list { <openscope-ast> initializer_list , } end_initializer_list
// //
case 381: { action.builder. case 381: { action.builder.
consumeInitializerList(); break; consumeInitializerList(); break;
} }
// //
// Rule 382: initializer_clause ::= { <openscope-ast> initializer_list } // Rule 382: initializer_clause ::= start_initializer_list { <openscope-ast> initializer_list } end_initializer_list
// //
case 382: { action.builder. case 382: { action.builder.
consumeInitializerList(); break; consumeInitializerList(); break;
@ -1870,380 +1872,394 @@ public CPPSizeofExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 388: class_specifier ::= class_head { <openscope-ast> member_declaration_list_opt } // Rule 384: start_initializer_list ::= $Empty
// //
case 388: { action.builder. case 384: { action.builder.
initializerListStart(); break;
}
//
// Rule 385: end_initializer_list ::= $Empty
//
case 385: { action.builder.
initializerListEnd(); break;
}
//
// Rule 390: class_specifier ::= class_head { <openscope-ast> member_declaration_list_opt }
//
case 390: { action.builder.
consumeClassSpecifier(); break; consumeClassSpecifier(); break;
} }
// //
// Rule 389: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt // Rule 391: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt
//
case 389: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 390: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
//
case 390: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 391: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
// //
case 391: { action.builder. case 391: { action.builder.
consumeClassHead(true); break; consumeClassHead(false); break;
} }
// //
// Rule 392: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt // Rule 392: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
// //
case 392: { action.builder. case 392: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 393: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
//
case 393: { action.builder.
consumeClassHead(true); break; consumeClassHead(true); break;
} }
// //
// Rule 394: identifier_name_opt ::= $Empty // Rule 394: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt
// //
case 394: { action.builder. case 394: { action.builder.
consumeClassHead(true); break;
}
//
// Rule 396: identifier_name_opt ::= $Empty
//
case 396: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 398: visibility_label ::= access_specifier_keyword : // Rule 400: visibility_label ::= access_specifier_keyword :
// //
case 398: { action.builder. case 400: { action.builder.
consumeVisibilityLabel(); break; consumeVisibilityLabel(); break;
} }
// //
// Rule 399: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ; // Rule 401: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ;
// //
case 399: { action.builder. case 401: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 400: member_declaration ::= declaration_specifiers_opt ; // Rule 402: member_declaration ::= declaration_specifiers_opt ;
// //
case 400: { action.builder. case 402: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 403: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ; // Rule 405: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ;
// //
case 403: { action.builder. case 405: { action.builder.
consumeMemberDeclarationQualifiedId(); break; consumeMemberDeclarationQualifiedId(); break;
} }
// //
// Rule 409: member_declaration ::= ERROR_TOKEN // Rule 411: member_declaration ::= ERROR_TOKEN
// //
case 409: { action.builder. case 411: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }
// //
// Rule 417: member_declarator ::= declarator constant_initializer // Rule 419: member_declarator ::= declarator constant_initializer
// //
case 417: { action.builder. case 419: { action.builder.
consumeMemberDeclaratorWithInitializer(); break; consumeMemberDeclaratorWithInitializer(); break;
} }
// //
// Rule 418: member_declarator ::= bit_field_declarator : constant_expression // Rule 420: member_declarator ::= bit_field_declarator : constant_expression
// //
case 418: { action.builder. case 420: { action.builder.
consumeBitField(true); break; consumeBitField(true); break;
} }
// //
// Rule 419: member_declarator ::= : constant_expression // Rule 421: member_declarator ::= : constant_expression
// //
case 419: { action.builder. case 421: { action.builder.
consumeBitField(false); break; consumeBitField(false); break;
} }
// //
// Rule 420: bit_field_declarator ::= identifier_name // Rule 422: bit_field_declarator ::= identifier_name
// //
case 420: { action.builder. case 422: { action.builder.
consumeDirectDeclaratorIdentifier(); break; consumeDirectDeclaratorIdentifier(); break;
} }
// //
// Rule 421: constant_initializer ::= = constant_expression // Rule 423: constant_initializer ::= = constant_expression
// //
case 421: { action.builder. case 423: { action.builder.
consumeInitializer(); break; consumeInitializer(); break;
} }
// //
// Rule 427: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name // Rule 429: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 427: { action.builder. case 429: { action.builder.
consumeBaseSpecifier(false, false); break; consumeBaseSpecifier(false, false); break;
} }
// //
// Rule 428: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name // Rule 430: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name
//
case 428: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 429: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
//
case 429: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 430: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
// //
case 430: { action.builder. case 430: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 431: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
//
case 431: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 432: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
//
case 432: { action.builder.
consumeBaseSpecifier(true, false); break; consumeBaseSpecifier(true, false); break;
} }
// //
// Rule 431: access_specifier_keyword ::= private // Rule 433: access_specifier_keyword ::= private
//
case 431: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 432: access_specifier_keyword ::= protected
//
case 432: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 433: access_specifier_keyword ::= public
// //
case 433: { action.builder. case 433: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 435: access_specifier_keyword_opt ::= $Empty // Rule 434: access_specifier_keyword ::= protected
//
case 434: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 435: access_specifier_keyword ::= public
// //
case 435: { action.builder. case 435: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 437: access_specifier_keyword_opt ::= $Empty
//
case 437: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 437: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt > // Rule 439: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt >
// //
case 437: { action.builder. case 439: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 438: conversion_function_id ::= operator conversion_type_id // Rule 440: conversion_function_id ::= operator conversion_type_id
// //
case 438: { action.builder. case 440: { action.builder.
consumeConversionName(); break; consumeConversionName(); break;
} }
// //
// Rule 439: conversion_type_id ::= type_specifier_seq conversion_declarator // Rule 441: conversion_type_id ::= type_specifier_seq conversion_declarator
// //
case 439: { action.builder. case 441: { action.builder.
consumeTypeId(true); break; consumeTypeId(true); break;
} }
// //
// Rule 440: conversion_type_id ::= type_specifier_seq // Rule 442: conversion_type_id ::= type_specifier_seq
// //
case 440: { action.builder. case 442: { action.builder.
consumeTypeId(false); break; consumeTypeId(false); break;
} }
// //
// Rule 441: conversion_declarator ::= <openscope-ast> ptr_operator_seq // Rule 443: conversion_declarator ::= <openscope-ast> ptr_operator_seq
// //
case 441: { action.builder. case 443: { action.builder.
consumeDeclaratorWithPointer(false); break; consumeDeclaratorWithPointer(false); break;
} }
// //
// Rule 447: mem_initializer ::= mem_initializer_name ( expression_list_opt ) // Rule 449: mem_initializer ::= mem_initializer_name ( expression_list_opt )
// //
case 447: { action.builder. case 449: { action.builder.
consumeConstructorChainInitializer(); break; consumeConstructorChainInitializer(); break;
} }
// //
// Rule 448: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name // Rule 450: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 448: { action.builder. case 450: { action.builder.
consumeQualifiedId(false); break; consumeQualifiedId(false); break;
} }
// //
// Rule 451: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt > // Rule 453: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt >
// //
case 451: { action.builder. case 453: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 452: operator_id_name ::= operator overloadable_operator // Rule 454: operator_id_name ::= operator overloadable_operator
// //
case 452: { action.builder. case 454: { action.builder.
consumeOperatorName(); break; consumeOperatorName(); break;
} }
// //
// Rule 495: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration // Rule 497: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration
// //
case 495: { action.builder. case 497: { action.builder.
consumeTemplateDeclaration(); break; consumeTemplateDeclaration(); break;
} }
// //
// Rule 496: export_opt ::= export // Rule 498: export_opt ::= export
// //
case 496: { action.builder. case 498: { action.builder.
consumePlaceHolder(); break; consumePlaceHolder(); break;
} }
// //
// Rule 497: export_opt ::= $Empty // Rule 499: export_opt ::= $Empty
// //
case 497: { action.builder. case 499: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 501: template_parameter ::= parameter_declaration // Rule 503: template_parameter ::= parameter_declaration
// //
case 501: { action.builder. case 503: { action.builder.
consumeTemplateParamterDeclaration(); break; consumeTemplateParamterDeclaration(); break;
} }
// //
// Rule 502: type_parameter ::= class identifier_name_opt // Rule 504: type_parameter ::= class identifier_name_opt
//
case 502: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 503: type_parameter ::= class identifier_name_opt = type_id
//
case 503: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 504: type_parameter ::= typename identifier_name_opt
// //
case 504: { action.builder. case 504: { action.builder.
consumeSimpleTypeTemplateParameter(false); break; consumeSimpleTypeTemplateParameter(false); break;
} }
// //
// Rule 505: type_parameter ::= typename identifier_name_opt = type_id // Rule 505: type_parameter ::= class identifier_name_opt = type_id
// //
case 505: { action.builder. case 505: { action.builder.
consumeSimpleTypeTemplateParameter(true); break; consumeSimpleTypeTemplateParameter(true); break;
} }
// //
// Rule 506: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt // Rule 506: type_parameter ::= typename identifier_name_opt
// //
case 506: { action.builder. case 506: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 507: type_parameter ::= typename identifier_name_opt = type_id
//
case 507: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 508: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt
//
case 508: { action.builder.
consumeTemplatedTypeTemplateParameter(false); break; consumeTemplatedTypeTemplateParameter(false); break;
} }
// //
// Rule 507: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression // Rule 509: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression
// //
case 507: { action.builder. case 509: { action.builder.
consumeTemplatedTypeTemplateParameter(true); break; consumeTemplatedTypeTemplateParameter(true); break;
} }
// //
// Rule 508: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt > // Rule 510: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt >
// //
case 508: { action.builder. case 510: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 514: template_argument ::= type_id // Rule 516: template_argument ::= type_id
// //
case 514: { action.builder. case 516: { action.builder.
consumeTemplateArgumentTypeId(); break; consumeTemplateArgumentTypeId(); break;
} }
// //
// Rule 515: explicit_instantiation ::= template declaration // Rule 517: explicit_instantiation ::= template declaration
// //
case 515: { action.builder. case 517: { action.builder.
consumeTemplateExplicitInstantiation(); break; consumeTemplateExplicitInstantiation(); break;
} }
// //
// Rule 516: explicit_specialization ::= template < > declaration // Rule 518: explicit_specialization ::= template < > declaration
// //
case 516: { action.builder. case 518: { action.builder.
consumeTemplateExplicitSpecialization(); break; consumeTemplateExplicitSpecialization(); break;
} }
// //
// Rule 517: try_block ::= try compound_statement <openscope-ast> handler_seq // Rule 519: try_block ::= try compound_statement <openscope-ast> handler_seq
// //
case 517: { action.builder. case 519: { action.builder.
consumeStatementTryBlock(); break; consumeStatementTryBlock(); break;
} }
// //
// Rule 520: handler ::= catch ( exception_declaration ) compound_statement // Rule 522: handler ::= catch ( exception_declaration ) compound_statement
// //
case 520: { action.builder. case 522: { action.builder.
consumeStatementCatchHandler(false); break; consumeStatementCatchHandler(false); break;
} }
// //
// Rule 521: handler ::= catch ( ... ) compound_statement // Rule 523: handler ::= catch ( ... ) compound_statement
// //
case 521: { action.builder. case 523: { action.builder.
consumeStatementCatchHandler(true); break; consumeStatementCatchHandler(true); break;
} }
// //
// Rule 522: exception_declaration ::= type_specifier_seq <openscope-ast> declarator // Rule 524: exception_declaration ::= type_specifier_seq <openscope-ast> declarator
//
case 522: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 523: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
//
case 523: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 524: exception_declaration ::= type_specifier_seq
// //
case 524: { action.builder. case 524: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 525: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
//
case 525: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 526: exception_declaration ::= type_specifier_seq
//
case 526: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 532: no_sizeof_type_name_start ::= ERROR_TOKEN // Rule 534: no_sizeof_type_name_start ::= ERROR_TOKEN
// //
case 532: { action.builder. case 534: { action.builder.
consumeExpressionProblem(); break; consumeExpressionProblem(); break;
} }

View file

@ -118,7 +118,7 @@ public interface CPPSizeofExpressionParsersym {
TK_Colon = 73, TK_Colon = 73,
TK_ColonColon = 4, TK_ColonColon = 4,
TK_DotDotDot = 95, TK_DotDotDot = 95,
TK_Assign = 70, TK_Assign = 69,
TK_StarAssign = 104, TK_StarAssign = 104,
TK_SlashAssign = 105, TK_SlashAssign = 105,
TK_PercentAssign = 106, TK_PercentAssign = 106,
@ -129,7 +129,7 @@ public interface CPPSizeofExpressionParsersym {
TK_AndAssign = 111, TK_AndAssign = 111,
TK_CaretAssign = 112, TK_CaretAssign = 112,
TK_OrAssign = 113, TK_OrAssign = 113,
TK_Comma = 69, TK_Comma = 70,
TK_RightBracket = 118, TK_RightBracket = 118,
TK_RightParen = 74, TK_RightParen = 74,
TK_RightBrace = 71, TK_RightBrace = 71,
@ -209,8 +209,8 @@ public interface CPPSizeofExpressionParsersym {
"enum", "enum",
"struct", "struct",
"union", "union",
"Comma",
"Assign", "Assign",
"Comma",
"RightBrace", "RightBrace",
"ERROR_TOKEN", "ERROR_TOKEN",
"Colon", "Colon",

View file

@ -171,13 +171,15 @@ private CPPParserAction action;
public CPPTemplateTypeParameterParser() { // constructor public CPPTemplateTypeParameterParser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
// binding resolution actions need access to IASTName nodes, temporary // binding resolution actions need access to IASTName nodes, temporary
action = new CPPParserAction (); action = new CPPParserAction ();
//action.resolver = new C99TypedefTrackerParserAction (this); //action.resolver = new C99TypedefTrackerParserAction (this);
action.builder = new CPPBuildASTParserAction ( CPPNodeFactory.getDefault() , this, tu); action.builder = new CPPBuildASTParserAction ( CPPNodeFactory.getDefault() , this, tu);
//action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols); //action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols);
action.builder.setParserOptions(options);
// comment this line to use with backtracking parser // comment this line to use with backtracking parser
//setParserAction(action); //setParserAction(action);
} }
@ -189,10 +191,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // _1 means full error handling final int errorRepairCount = -1; // _1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -1863,14 +1865,14 @@ public CPPTemplateTypeParameterParser(String[] mapFrom) { // constructor
} }
// //
// Rule 383: initializer_clause ::= { <openscope-ast> initializer_list , } // Rule 383: initializer_clause ::= start_initializer_list { <openscope-ast> initializer_list , } end_initializer_list
// //
case 383: { action.builder. case 383: { action.builder.
consumeInitializerList(); break; consumeInitializerList(); break;
} }
// //
// Rule 384: initializer_clause ::= { <openscope-ast> initializer_list } // Rule 384: initializer_clause ::= start_initializer_list { <openscope-ast> initializer_list } end_initializer_list
// //
case 384: { action.builder. case 384: { action.builder.
consumeInitializerList(); break; consumeInitializerList(); break;
@ -1884,380 +1886,394 @@ public CPPTemplateTypeParameterParser(String[] mapFrom) { // constructor
} }
// //
// Rule 390: class_specifier ::= class_head { <openscope-ast> member_declaration_list_opt } // Rule 386: start_initializer_list ::= $Empty
// //
case 390: { action.builder. case 386: { action.builder.
initializerListStart(); break;
}
//
// Rule 387: end_initializer_list ::= $Empty
//
case 387: { action.builder.
initializerListEnd(); break;
}
//
// Rule 392: class_specifier ::= class_head { <openscope-ast> member_declaration_list_opt }
//
case 392: { action.builder.
consumeClassSpecifier(); break; consumeClassSpecifier(); break;
} }
// //
// Rule 391: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt // Rule 393: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt
//
case 391: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 392: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
//
case 392: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 393: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
// //
case 393: { action.builder. case 393: { action.builder.
consumeClassHead(true); break; consumeClassHead(false); break;
} }
// //
// Rule 394: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt // Rule 394: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
// //
case 394: { action.builder. case 394: { action.builder.
consumeClassHead(false); break;
}
//
// Rule 395: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
//
case 395: { action.builder.
consumeClassHead(true); break; consumeClassHead(true); break;
} }
// //
// Rule 396: identifier_name_opt ::= $Empty // Rule 396: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt
// //
case 396: { action.builder. case 396: { action.builder.
consumeClassHead(true); break;
}
//
// Rule 398: identifier_name_opt ::= $Empty
//
case 398: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 400: visibility_label ::= access_specifier_keyword : // Rule 402: visibility_label ::= access_specifier_keyword :
// //
case 400: { action.builder. case 402: { action.builder.
consumeVisibilityLabel(); break; consumeVisibilityLabel(); break;
} }
// //
// Rule 401: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ; // Rule 403: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ;
// //
case 401: { action.builder. case 403: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 402: member_declaration ::= declaration_specifiers_opt ; // Rule 404: member_declaration ::= declaration_specifiers_opt ;
// //
case 402: { action.builder. case 404: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 405: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ; // Rule 407: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ;
// //
case 405: { action.builder. case 407: { action.builder.
consumeMemberDeclarationQualifiedId(); break; consumeMemberDeclarationQualifiedId(); break;
} }
// //
// Rule 411: member_declaration ::= ERROR_TOKEN // Rule 413: member_declaration ::= ERROR_TOKEN
// //
case 411: { action.builder. case 413: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }
// //
// Rule 419: member_declarator ::= declarator constant_initializer // Rule 421: member_declarator ::= declarator constant_initializer
// //
case 419: { action.builder. case 421: { action.builder.
consumeMemberDeclaratorWithInitializer(); break; consumeMemberDeclaratorWithInitializer(); break;
} }
// //
// Rule 420: member_declarator ::= bit_field_declarator : constant_expression // Rule 422: member_declarator ::= bit_field_declarator : constant_expression
// //
case 420: { action.builder. case 422: { action.builder.
consumeBitField(true); break; consumeBitField(true); break;
} }
// //
// Rule 421: member_declarator ::= : constant_expression // Rule 423: member_declarator ::= : constant_expression
// //
case 421: { action.builder. case 423: { action.builder.
consumeBitField(false); break; consumeBitField(false); break;
} }
// //
// Rule 422: bit_field_declarator ::= identifier_name // Rule 424: bit_field_declarator ::= identifier_name
// //
case 422: { action.builder. case 424: { action.builder.
consumeDirectDeclaratorIdentifier(); break; consumeDirectDeclaratorIdentifier(); break;
} }
// //
// Rule 423: constant_initializer ::= = constant_expression // Rule 425: constant_initializer ::= = constant_expression
// //
case 423: { action.builder. case 425: { action.builder.
consumeInitializer(); break; consumeInitializer(); break;
} }
// //
// Rule 429: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name // Rule 431: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 429: { action.builder. case 431: { action.builder.
consumeBaseSpecifier(false, false); break; consumeBaseSpecifier(false, false); break;
} }
// //
// Rule 430: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name // Rule 432: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name
//
case 430: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 431: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
//
case 431: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 432: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
// //
case 432: { action.builder. case 432: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 433: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
//
case 433: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 434: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
//
case 434: { action.builder.
consumeBaseSpecifier(true, false); break; consumeBaseSpecifier(true, false); break;
} }
// //
// Rule 433: access_specifier_keyword ::= private // Rule 435: access_specifier_keyword ::= private
//
case 433: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 434: access_specifier_keyword ::= protected
//
case 434: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 435: access_specifier_keyword ::= public
// //
case 435: { action.builder. case 435: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 437: access_specifier_keyword_opt ::= $Empty // Rule 436: access_specifier_keyword ::= protected
//
case 436: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 437: access_specifier_keyword ::= public
// //
case 437: { action.builder. case 437: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 439: access_specifier_keyword_opt ::= $Empty
//
case 439: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 439: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt > // Rule 441: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt >
// //
case 439: { action.builder. case 441: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 440: conversion_function_id ::= operator conversion_type_id // Rule 442: conversion_function_id ::= operator conversion_type_id
// //
case 440: { action.builder. case 442: { action.builder.
consumeConversionName(); break; consumeConversionName(); break;
} }
// //
// Rule 441: conversion_type_id ::= type_specifier_seq conversion_declarator // Rule 443: conversion_type_id ::= type_specifier_seq conversion_declarator
// //
case 441: { action.builder. case 443: { action.builder.
consumeTypeId(true); break; consumeTypeId(true); break;
} }
// //
// Rule 442: conversion_type_id ::= type_specifier_seq // Rule 444: conversion_type_id ::= type_specifier_seq
// //
case 442: { action.builder. case 444: { action.builder.
consumeTypeId(false); break; consumeTypeId(false); break;
} }
// //
// Rule 443: conversion_declarator ::= <openscope-ast> ptr_operator_seq // Rule 445: conversion_declarator ::= <openscope-ast> ptr_operator_seq
// //
case 443: { action.builder. case 445: { action.builder.
consumeDeclaratorWithPointer(false); break; consumeDeclaratorWithPointer(false); break;
} }
// //
// Rule 449: mem_initializer ::= mem_initializer_name ( expression_list_opt ) // Rule 451: mem_initializer ::= mem_initializer_name ( expression_list_opt )
// //
case 449: { action.builder. case 451: { action.builder.
consumeConstructorChainInitializer(); break; consumeConstructorChainInitializer(); break;
} }
// //
// Rule 450: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name // Rule 452: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 450: { action.builder. case 452: { action.builder.
consumeQualifiedId(false); break; consumeQualifiedId(false); break;
} }
// //
// Rule 453: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt > // Rule 455: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt >
// //
case 453: { action.builder. case 455: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 454: operator_id_name ::= operator overloadable_operator // Rule 456: operator_id_name ::= operator overloadable_operator
// //
case 454: { action.builder. case 456: { action.builder.
consumeOperatorName(); break; consumeOperatorName(); break;
} }
// //
// Rule 497: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration // Rule 499: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration
// //
case 497: { action.builder. case 499: { action.builder.
consumeTemplateDeclaration(); break; consumeTemplateDeclaration(); break;
} }
// //
// Rule 498: export_opt ::= export // Rule 500: export_opt ::= export
// //
case 498: { action.builder. case 500: { action.builder.
consumePlaceHolder(); break; consumePlaceHolder(); break;
} }
// //
// Rule 499: export_opt ::= $Empty // Rule 501: export_opt ::= $Empty
// //
case 499: { action.builder. case 501: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 503: template_parameter ::= parameter_declaration // Rule 505: template_parameter ::= parameter_declaration
// //
case 503: { action.builder. case 505: { action.builder.
consumeTemplateParamterDeclaration(); break; consumeTemplateParamterDeclaration(); break;
} }
// //
// Rule 504: type_parameter ::= class identifier_name_opt // Rule 506: type_parameter ::= class identifier_name_opt
//
case 504: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 505: type_parameter ::= class identifier_name_opt = type_id
//
case 505: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 506: type_parameter ::= typename identifier_name_opt
// //
case 506: { action.builder. case 506: { action.builder.
consumeSimpleTypeTemplateParameter(false); break; consumeSimpleTypeTemplateParameter(false); break;
} }
// //
// Rule 507: type_parameter ::= typename identifier_name_opt = type_id // Rule 507: type_parameter ::= class identifier_name_opt = type_id
// //
case 507: { action.builder. case 507: { action.builder.
consumeSimpleTypeTemplateParameter(true); break; consumeSimpleTypeTemplateParameter(true); break;
} }
// //
// Rule 508: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt // Rule 508: type_parameter ::= typename identifier_name_opt
// //
case 508: { action.builder. case 508: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 509: type_parameter ::= typename identifier_name_opt = type_id
//
case 509: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 510: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt
//
case 510: { action.builder.
consumeTemplatedTypeTemplateParameter(false); break; consumeTemplatedTypeTemplateParameter(false); break;
} }
// //
// Rule 509: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression // Rule 511: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression
// //
case 509: { action.builder. case 511: { action.builder.
consumeTemplatedTypeTemplateParameter(true); break; consumeTemplatedTypeTemplateParameter(true); break;
} }
// //
// Rule 510: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt > // Rule 512: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt >
// //
case 510: { action.builder. case 512: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 516: template_argument ::= type_id // Rule 518: template_argument ::= type_id
// //
case 516: { action.builder. case 518: { action.builder.
consumeTemplateArgumentTypeId(); break; consumeTemplateArgumentTypeId(); break;
} }
// //
// Rule 517: explicit_instantiation ::= template declaration // Rule 519: explicit_instantiation ::= template declaration
// //
case 517: { action.builder. case 519: { action.builder.
consumeTemplateExplicitInstantiation(); break; consumeTemplateExplicitInstantiation(); break;
} }
// //
// Rule 518: explicit_specialization ::= template < > declaration // Rule 520: explicit_specialization ::= template < > declaration
// //
case 518: { action.builder. case 520: { action.builder.
consumeTemplateExplicitSpecialization(); break; consumeTemplateExplicitSpecialization(); break;
} }
// //
// Rule 519: try_block ::= try compound_statement <openscope-ast> handler_seq // Rule 521: try_block ::= try compound_statement <openscope-ast> handler_seq
// //
case 519: { action.builder. case 521: { action.builder.
consumeStatementTryBlock(); break; consumeStatementTryBlock(); break;
} }
// //
// Rule 522: handler ::= catch ( exception_declaration ) compound_statement // Rule 524: handler ::= catch ( exception_declaration ) compound_statement
// //
case 522: { action.builder. case 524: { action.builder.
consumeStatementCatchHandler(false); break; consumeStatementCatchHandler(false); break;
} }
// //
// Rule 523: handler ::= catch ( ... ) compound_statement // Rule 525: handler ::= catch ( ... ) compound_statement
// //
case 523: { action.builder. case 525: { action.builder.
consumeStatementCatchHandler(true); break; consumeStatementCatchHandler(true); break;
} }
// //
// Rule 524: exception_declaration ::= type_specifier_seq <openscope-ast> declarator // Rule 526: exception_declaration ::= type_specifier_seq <openscope-ast> declarator
//
case 524: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 525: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
//
case 525: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 526: exception_declaration ::= type_specifier_seq
// //
case 526: { action.builder. case 526: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 527: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
//
case 527: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 528: exception_declaration ::= type_specifier_seq
//
case 528: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 534: type_parameter_start ::= ERROR_TOKEN // Rule 536: type_parameter_start ::= ERROR_TOKEN
// //
case 534: { action.builder. case 536: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }

View file

@ -96,8 +96,8 @@ public interface CPPTemplateTypeParameterParsersym {
TK_MinusMinus = 27, TK_MinusMinus = 27,
TK_And = 9, TK_And = 9,
TK_Star = 6, TK_Star = 6,
TK_Plus = 12, TK_Plus = 11,
TK_Minus = 13, TK_Minus = 12,
TK_Tilde = 5, TK_Tilde = 5,
TK_Bang = 29, TK_Bang = 29,
TK_Slash = 91, TK_Slash = 91,
@ -118,7 +118,7 @@ public interface CPPTemplateTypeParameterParsersym {
TK_Colon = 73, TK_Colon = 73,
TK_ColonColon = 4, TK_ColonColon = 4,
TK_DotDotDot = 95, TK_DotDotDot = 95,
TK_Assign = 70, TK_Assign = 69,
TK_StarAssign = 104, TK_StarAssign = 104,
TK_SlashAssign = 105, TK_SlashAssign = 105,
TK_PercentAssign = 106, TK_PercentAssign = 106,
@ -129,11 +129,11 @@ public interface CPPTemplateTypeParameterParsersym {
TK_AndAssign = 111, TK_AndAssign = 111,
TK_CaretAssign = 112, TK_CaretAssign = 112,
TK_OrAssign = 113, TK_OrAssign = 113,
TK_Comma = 69, TK_Comma = 70,
TK_RightBracket = 118, TK_RightBracket = 118,
TK_RightParen = 74, TK_RightParen = 74,
TK_RightBrace = 71, TK_RightBrace = 71,
TK_SemiColon = 11, TK_SemiColon = 13,
TK_LeftBrace = 64, TK_LeftBrace = 64,
TK_ERROR_TOKEN = 72, TK_ERROR_TOKEN = 72,
TK_0 = 44, TK_0 = 44,
@ -151,9 +151,9 @@ public interface CPPTemplateTypeParameterParsersym {
"operator", "operator",
"And", "And",
"typename", "typename",
"SemiColon",
"Plus", "Plus",
"Minus", "Minus",
"SemiColon",
"extern", "extern",
"bool", "bool",
"char", "char",
@ -209,8 +209,8 @@ public interface CPPTemplateTypeParameterParsersym {
"enum", "enum",
"struct", "struct",
"union", "union",
"Comma",
"Assign", "Assign",
"Comma",
"RightBrace", "RightBrace",
"ERROR_TOKEN", "ERROR_TOKEN",
"Colon", "Colon",

View file

@ -64,12 +64,20 @@ public class UPCLanguageExtensionTests extends TestCase {
// test that binding resolution works // test that binding resolution works
private IASTTranslationUnit parseAndCheckBindings(String code) { private IASTTranslationUnit parseAndCheckBindings(String code) {
return ParseHelper.parse(code, getLanguage(), true, true, 0 ); ParseHelper.Options options = new ParseHelper.Options();
options.setCheckSyntaxProblems(true);
options.setCheckPreprocessorProblems(true);
options.setCheckBindings(true);
return ParseHelper.parse(code, getLanguage(), options );
} }
private IASTTranslationUnit parse(String code) { private IASTTranslationUnit parse(String code) {
return ParseHelper.parse(code, getLanguage(), true, false, 0 ); ParseHelper.Options options = new ParseHelper.Options();
options.setCheckSyntaxProblems(true);
options.setCheckPreprocessorProblems(true);
options.setCheckBindings(false);
return ParseHelper.parse(code, getLanguage(), options);
} }

View file

@ -24,6 +24,7 @@ import org.eclipse.cdt.core.dom.lrparser.lpgextensions.FixedBacktrackingParser;
import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap; import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap;
import org.eclipse.cdt.core.dom.lrparser.action.TokenMap; import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory; import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
@ -32,7 +33,6 @@ import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement; import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnarySizeofExpression; import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnarySizeofExpression;
import org.eclipse.cdt.core.dom.lrparser.lpgextensions.FixedBacktrackingParser; import org.eclipse.cdt.core.dom.lrparser.lpgextensions.FixedBacktrackingParser;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
public class UPCExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser public class UPCExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
{ {
@ -176,8 +176,9 @@ private UPCParserAction action;
public UPCExpressionParser() { // constructor public UPCExpressionParser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new UPCParserAction ( UPCASTNodeFactory.DEFAULT_INSTANCE , this, tu); action = new UPCParserAction ( UPCASTNodeFactory.DEFAULT_INSTANCE , this, tu);
action.setParserOptions(options);
} }
@ -187,10 +188,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // -1 means full error handling final int errorRepairCount = -1; // -1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -602,13 +603,13 @@ public UPCExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 102: labeled_statement ::= case constant_expression : // Rule 102: labeled_statement ::= case constant_expression : statement
// //
case 102: { action. consumeStatementCase(); break; case 102: { action. consumeStatementCase(); break;
} }
// //
// Rule 103: labeled_statement ::= default : // Rule 103: labeled_statement ::= default : statement
// //
case 103: { action. consumeStatementDefault(); break; case 103: { action. consumeStatementDefault(); break;
} }
@ -1166,381 +1167,399 @@ public UPCExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 279: initializer ::= { <openscope-ast> initializer_list comma_opt } // Rule 279: initializer ::= start_initializer_list { <openscope-ast> initializer_list comma_opt } end_initializer_list
// //
case 279: { action. consumeInitializerList(); break; case 279: { action. consumeInitializerList(); break;
} }
// //
// Rule 284: designated_initializer ::= <openscope-ast> designation = initializer // Rule 280: initializer ::= { <openscope-ast> }
// //
case 284: { action. consumeInitializerDesignated(); break; case 280: { action. consumeInitializerList(); break;
} }
// //
// Rule 288: designator_base ::= [ constant_expression ] // Rule 281: start_initializer_list ::= $Empty
// //
case 288: { action. consumeDesignatorArray(); break; case 281: { action. initializerListStart(); break;
} }
// //
// Rule 289: designator_base ::= . identifier_or_typedefname // Rule 282: end_initializer_list ::= $Empty
// //
case 289: { action. consumeDesignatorField(); break; case 282: { action. initializerListEnd(); break;
} }
// //
// Rule 290: designator ::= [ constant_expression ] // Rule 287: designated_initializer ::= <openscope-ast> designation = initializer
// //
case 290: { action. consumeDesignatorArray(); break; case 287: { action. consumeInitializerDesignated(); break;
} }
// //
// Rule 291: designator ::= . identifier_or_typedefname // Rule 291: designator_base ::= [ constant_expression ]
// //
case 291: { action. consumeDesignatorField(); break; case 291: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 292: translation_unit ::= external_declaration_list // Rule 292: designator_base ::= . identifier_or_typedefname
// //
case 292: { action. consumeTranslationUnit(); break; case 292: { action. consumeDesignatorField(); break;
} }
// //
// Rule 293: translation_unit ::= $Empty // Rule 293: designator ::= [ constant_expression ]
// //
case 293: { action. consumeTranslationUnit(); break; case 293: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 298: external_declaration ::= ; // Rule 294: designator ::= . identifier_or_typedefname
// //
case 298: { action. consumeDeclarationEmpty(); break; case 294: { action. consumeDesignatorField(); break;
} }
// //
// Rule 299: external_declaration ::= ERROR_TOKEN // Rule 295: translation_unit ::= external_declaration_list
// //
case 299: { action. consumeDeclarationProblem(); break; case 295: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 302: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body // Rule 296: translation_unit ::= $Empty
// //
case 302: { action. consumeFunctionDefinition(true); break; case 296: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 303: function_definition ::= <openscope-ast> function_declarator function_body // Rule 301: external_declaration ::= ;
// //
case 303: { action. consumeFunctionDefinition(false); break; case 301: { action. consumeDeclarationEmpty(); break;
} }
// //
// Rule 304: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement // Rule 302: external_declaration ::= ERROR_TOKEN
// //
case 304: { action. consumeFunctionDefinitionKnR(); break; case 302: { action. consumeDeclarationProblem(); break;
} }
// //
// Rule 305: function_body ::= { } // Rule 305: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body
// //
case 305: { action. consumeStatementCompoundStatement(false); break; case 305: { action. consumeFunctionDefinition(true); break;
} }
// //
// Rule 306: function_body ::= { <openscope-ast> block_item_list } // Rule 306: function_definition ::= <openscope-ast> function_declarator function_body
// //
case 306: { action. consumeStatementCompoundStatement(true); break; case 306: { action. consumeFunctionDefinition(false); break;
} }
// //
// Rule 308: expression_parser_start ::= ERROR_TOKEN // Rule 307: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement
// //
case 308: { action. consumeExpressionProblem(); break; case 307: { action. consumeFunctionDefinitionKnR(); break;
} }
// //
// Rule 309: literal ::= MYTHREAD // Rule 308: function_body ::= { }
// //
case 309: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_mythread); break; case 308: { action. consumeStatementCompoundStatement(false); break;
} }
// //
// Rule 310: literal ::= THREADS // Rule 309: function_body ::= { <openscope-ast> block_item_list }
// //
case 310: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_threads); break; case 309: { action. consumeStatementCompoundStatement(true); break;
} }
// //
// Rule 311: literal ::= UPC_MAX_BLOCKSIZE // Rule 311: expression_parser_start ::= ERROR_TOKEN
// //
case 311: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_upc_max_block_size); break; case 311: { action. consumeExpressionProblem(); break;
} }
// //
// Rule 312: unary_expression ::= upc_localsizeof unary_expression // Rule 312: literal ::= MYTHREAD
// //
case 312: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_localsizeof); break; case 312: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_mythread); break;
} }
// //
// Rule 313: unary_expression ::= upc_localsizeof ( type_name ) // Rule 313: literal ::= THREADS
// //
case 313: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_localsizeof); break; case 313: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_threads); break;
} }
// //
// Rule 314: unary_expression ::= upc_blocksizeof unary_expression // Rule 314: literal ::= UPC_MAX_BLOCKSIZE
// //
case 314: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_blocksizeof); break; case 314: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_upc_max_block_size); break;
} }
// //
// Rule 315: unary_expression ::= upc_blocksizeof ( type_name ) // Rule 315: unary_expression ::= upc_localsizeof unary_expression
// //
case 315: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_blocksizeof); break; case 315: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
} }
// //
// Rule 316: unary_expression ::= upc_elemsizeof unary_expression // Rule 316: unary_expression ::= upc_localsizeof ( type_name )
// //
case 316: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_elemsizeof); break; case 316: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
} }
// //
// Rule 317: unary_expression ::= upc_elemsizeof ( type_name ) // Rule 317: unary_expression ::= upc_blocksizeof unary_expression
// //
case 317: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_elemsizeof); break; case 317: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
} }
// //
// Rule 321: shared_type_qualifier ::= shared // Rule 318: unary_expression ::= upc_blocksizeof ( type_name )
// //
case 321: { action. consumeToken(); break; case 318: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
} }
// //
// Rule 322: reference_type_qualifier ::= relaxed // Rule 319: unary_expression ::= upc_elemsizeof unary_expression
// //
case 322: { action. consumeToken(); break; case 319: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
} }
// //
// Rule 323: reference_type_qualifier ::= strict // Rule 320: unary_expression ::= upc_elemsizeof ( type_name )
// //
case 323: { action. consumeToken(); break; case 320: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
} }
// //
// Rule 324: layout_qualifier ::= [ constant_expression ] // Rule 324: shared_type_qualifier ::= shared
// //
case 324: { action. consumeLayoutQualifier(true, false); break; case 324: { action. consumeToken(); break;
} }
// //
// Rule 325: layout_qualifier ::= [ * ] // Rule 325: reference_type_qualifier ::= relaxed
// //
case 325: { action. consumeLayoutQualifier(false, true); break; case 325: { action. consumeToken(); break;
} }
// //
// Rule 326: layout_qualifier ::= [ ] // Rule 326: reference_type_qualifier ::= strict
// //
case 326: { action. consumeLayoutQualifier(false, false); break; case 326: { action. consumeToken(); break;
} }
// //
// Rule 328: synchronization_statement ::= upc_notify expression ; // Rule 327: layout_qualifier ::= [ constant_expression ]
// //
case 328: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, true); break; case 327: { action. consumeLayoutQualifier(true, false); break;
} }
// //
// Rule 329: synchronization_statement ::= upc_notify ; // Rule 328: layout_qualifier ::= [ * ]
// //
case 329: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, false); break; case 328: { action. consumeLayoutQualifier(false, true); break;
} }
// //
// Rule 330: synchronization_statement ::= upc_wait expression ; // Rule 329: layout_qualifier ::= [ ]
// //
case 330: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, true); break; case 329: { action. consumeLayoutQualifier(false, false); break;
} }
// //
// Rule 331: synchronization_statement ::= upc_wait ; // Rule 331: synchronization_statement ::= upc_notify expression ;
// //
case 331: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, false); break; case 331: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, true); break;
} }
// //
// Rule 332: synchronization_statement ::= upc_barrier expression ; // Rule 332: synchronization_statement ::= upc_notify ;
// //
case 332: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, true); break; case 332: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, false); break;
} }
// //
// Rule 333: synchronization_statement ::= upc_barrier ; // Rule 333: synchronization_statement ::= upc_wait expression ;
// //
case 333: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, false); break; case 333: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, true); break;
} }
// //
// Rule 334: synchronization_statement ::= upc_fence ; // Rule 334: synchronization_statement ::= upc_wait ;
// //
case 334: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_fence, false); break; case 334: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, false); break;
} }
// //
// Rule 335: iteration_statement ::= upc_forall ( expression ; expression ; expression ; affinity ) statement // Rule 335: synchronization_statement ::= upc_barrier expression ;
// //
case 335: { action. consumeStatementUPCForallLoop(true, true, true, true); break; case 335: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, true); break;
} }
// //
// Rule 336: iteration_statement ::= upc_forall ( expression ; expression ; expression ; ) statement // Rule 336: synchronization_statement ::= upc_barrier ;
// //
case 336: { action. consumeStatementUPCForallLoop(true, true, true, false); break; case 336: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, false); break;
} }
// //
// Rule 337: iteration_statement ::= upc_forall ( expression ; expression ; ; affinity ) statement // Rule 337: synchronization_statement ::= upc_fence ;
// //
case 337: { action. consumeStatementUPCForallLoop(true, true, false, true); break; case 337: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_fence, false); break;
} }
// //
// Rule 338: iteration_statement ::= upc_forall ( expression ; expression ; ; ) statement // Rule 338: iteration_statement ::= upc_forall ( expression ; expression ; expression ; affinity ) statement
// //
case 338: { action. consumeStatementUPCForallLoop(true, true, false, false); break; case 338: { action. consumeStatementUPCForallLoop(true, true, true, true); break;
} }
// //
// Rule 339: iteration_statement ::= upc_forall ( expression ; ; expression ; affinity ) statement // Rule 339: iteration_statement ::= upc_forall ( expression ; expression ; expression ; ) statement
// //
case 339: { action. consumeStatementUPCForallLoop(true, false, true, true); break; case 339: { action. consumeStatementUPCForallLoop(true, true, true, false); break;
} }
// //
// Rule 340: iteration_statement ::= upc_forall ( expression ; ; expression ; ) statement // Rule 340: iteration_statement ::= upc_forall ( expression ; expression ; ; affinity ) statement
// //
case 340: { action. consumeStatementUPCForallLoop(true, false, true, false); break; case 340: { action. consumeStatementUPCForallLoop(true, true, false, true); break;
} }
// //
// Rule 341: iteration_statement ::= upc_forall ( expression ; ; ; affinity ) statement // Rule 341: iteration_statement ::= upc_forall ( expression ; expression ; ; ) statement
// //
case 341: { action. consumeStatementUPCForallLoop(true, false, false, true); break; case 341: { action. consumeStatementUPCForallLoop(true, true, false, false); break;
} }
// //
// Rule 342: iteration_statement ::= upc_forall ( expression ; ; ; ) statement // Rule 342: iteration_statement ::= upc_forall ( expression ; ; expression ; affinity ) statement
// //
case 342: { action. consumeStatementUPCForallLoop(true, false, false, false); break; case 342: { action. consumeStatementUPCForallLoop(true, false, true, true); break;
} }
// //
// Rule 343: iteration_statement ::= upc_forall ( ; expression ; expression ; affinity ) statement // Rule 343: iteration_statement ::= upc_forall ( expression ; ; expression ; ) statement
// //
case 343: { action. consumeStatementUPCForallLoop(false, true, true, true); break; case 343: { action. consumeStatementUPCForallLoop(true, false, true, false); break;
} }
// //
// Rule 344: iteration_statement ::= upc_forall ( ; expression ; expression ; ) statement // Rule 344: iteration_statement ::= upc_forall ( expression ; ; ; affinity ) statement
// //
case 344: { action. consumeStatementUPCForallLoop(false, true, true, false); break; case 344: { action. consumeStatementUPCForallLoop(true, false, false, true); break;
} }
// //
// Rule 345: iteration_statement ::= upc_forall ( ; expression ; ; affinity ) statement // Rule 345: iteration_statement ::= upc_forall ( expression ; ; ; ) statement
// //
case 345: { action. consumeStatementUPCForallLoop(false, true, false, true); break; case 345: { action. consumeStatementUPCForallLoop(true, false, false, false); break;
} }
// //
// Rule 346: iteration_statement ::= upc_forall ( ; expression ; ; ) statement // Rule 346: iteration_statement ::= upc_forall ( ; expression ; expression ; affinity ) statement
// //
case 346: { action. consumeStatementUPCForallLoop(false, true, false, false); break; case 346: { action. consumeStatementUPCForallLoop(false, true, true, true); break;
} }
// //
// Rule 347: iteration_statement ::= upc_forall ( ; ; expression ; affinity ) statement // Rule 347: iteration_statement ::= upc_forall ( ; expression ; expression ; ) statement
// //
case 347: { action. consumeStatementUPCForallLoop(false, false, true, true); break; case 347: { action. consumeStatementUPCForallLoop(false, true, true, false); break;
} }
// //
// Rule 348: iteration_statement ::= upc_forall ( ; ; expression ; ) statement // Rule 348: iteration_statement ::= upc_forall ( ; expression ; ; affinity ) statement
// //
case 348: { action. consumeStatementUPCForallLoop(false, false, true, false); break; case 348: { action. consumeStatementUPCForallLoop(false, true, false, true); break;
} }
// //
// Rule 349: iteration_statement ::= upc_forall ( ; ; ; affinity ) statement // Rule 349: iteration_statement ::= upc_forall ( ; expression ; ; ) statement
// //
case 349: { action. consumeStatementUPCForallLoop(false, false, false, true); break; case 349: { action. consumeStatementUPCForallLoop(false, true, false, false); break;
} }
// //
// Rule 350: iteration_statement ::= upc_forall ( ; ; ; ) statement // Rule 350: iteration_statement ::= upc_forall ( ; ; expression ; affinity ) statement
// //
case 350: { action. consumeStatementUPCForallLoop(false, false, false, false); break; case 350: { action. consumeStatementUPCForallLoop(false, false, true, true); break;
} }
// //
// Rule 351: iteration_statement ::= upc_forall ( declaration expression ; expression ; affinity ) statement // Rule 351: iteration_statement ::= upc_forall ( ; ; expression ; ) statement
// //
case 351: { action. consumeStatementUPCForallLoop(true, true, true, true); break; case 351: { action. consumeStatementUPCForallLoop(false, false, true, false); break;
} }
// //
// Rule 352: iteration_statement ::= upc_forall ( declaration expression ; expression ; ) statement // Rule 352: iteration_statement ::= upc_forall ( ; ; ; affinity ) statement
// //
case 352: { action. consumeStatementUPCForallLoop(true, true, true, false); break; case 352: { action. consumeStatementUPCForallLoop(false, false, false, true); break;
} }
// //
// Rule 353: iteration_statement ::= upc_forall ( declaration expression ; ; affinity ) statement // Rule 353: iteration_statement ::= upc_forall ( ; ; ; ) statement
// //
case 353: { action. consumeStatementUPCForallLoop(true, true, false, true); break; case 353: { action. consumeStatementUPCForallLoop(false, false, false, false); break;
} }
// //
// Rule 354: iteration_statement ::= upc_forall ( declaration expression ; ; ) statement // Rule 354: iteration_statement ::= upc_forall ( declaration expression ; expression ; affinity ) statement
// //
case 354: { action. consumeStatementUPCForallLoop(true, true, false, false); break; case 354: { action. consumeStatementUPCForallLoop(true, true, true, true); break;
} }
// //
// Rule 355: iteration_statement ::= upc_forall ( declaration ; expression ; affinity ) statement // Rule 355: iteration_statement ::= upc_forall ( declaration expression ; expression ; ) statement
// //
case 355: { action. consumeStatementUPCForallLoop(true, false, true, true); break; case 355: { action. consumeStatementUPCForallLoop(true, true, true, false); break;
} }
// //
// Rule 356: iteration_statement ::= upc_forall ( declaration ; expression ; ) statement // Rule 356: iteration_statement ::= upc_forall ( declaration expression ; ; affinity ) statement
// //
case 356: { action. consumeStatementUPCForallLoop(true, false, true, false); break; case 356: { action. consumeStatementUPCForallLoop(true, true, false, true); break;
} }
// //
// Rule 357: iteration_statement ::= upc_forall ( declaration ; ; affinity ) statement // Rule 357: iteration_statement ::= upc_forall ( declaration expression ; ; ) statement
// //
case 357: { action. consumeStatementUPCForallLoop(true, false, false, true); break; case 357: { action. consumeStatementUPCForallLoop(true, true, false, false); break;
} }
// //
// Rule 358: iteration_statement ::= upc_forall ( declaration ; ; ) statement // Rule 358: iteration_statement ::= upc_forall ( declaration ; expression ; affinity ) statement
// //
case 358: { action. consumeStatementUPCForallLoop(true, false, false, false); break; case 358: { action. consumeStatementUPCForallLoop(true, false, true, true); break;
} }
// //
// Rule 360: affinity ::= continue // Rule 359: iteration_statement ::= upc_forall ( declaration ; expression ; ) statement
// //
case 360: { action. consumeToken(); break; case 359: { action. consumeStatementUPCForallLoop(true, false, true, false); break;
}
//
// Rule 360: iteration_statement ::= upc_forall ( declaration ; ; affinity ) statement
//
case 360: { action. consumeStatementUPCForallLoop(true, false, false, true); break;
}
//
// Rule 361: iteration_statement ::= upc_forall ( declaration ; ; ) statement
//
case 361: { action. consumeStatementUPCForallLoop(true, false, false, false); break;
}
//
// Rule 363: affinity ::= continue
//
case 363: { action. consumeToken(); break;
} }

View file

@ -19,13 +19,13 @@ public interface UPCExpressionParsersym {
TK_break = 90, TK_break = 90,
TK_case = 91, TK_case = 91,
TK_char = 38, TK_char = 38,
TK_const = 6, TK_const = 8,
TK_continue = 92, TK_continue = 92,
TK_default = 93, TK_default = 93,
TK_do = 94, TK_do = 94,
TK_double = 39, TK_double = 39,
TK_else = 95, TK_else = 95,
TK_enum = 51, TK_enum = 52,
TK_extern = 34, TK_extern = 34,
TK_float = 40, TK_float = 40,
TK_for = 96, TK_for = 96,
@ -35,19 +35,19 @@ public interface UPCExpressionParsersym {
TK_int = 41, TK_int = 41,
TK_long = 42, TK_long = 42,
TK_register = 36, TK_register = 36,
TK_restrict = 7, TK_restrict = 9,
TK_return = 99, TK_return = 99,
TK_short = 43, TK_short = 43,
TK_signed = 44, TK_signed = 44,
TK_sizeof = 17, TK_sizeof = 17,
TK_static = 30, TK_static = 31,
TK_struct = 52, TK_struct = 53,
TK_switch = 100, TK_switch = 100,
TK_typedef = 37, TK_typedef = 37,
TK_union = 53, TK_union = 54,
TK_unsigned = 45, TK_unsigned = 45,
TK_void = 46, TK_void = 46,
TK_volatile = 8, TK_volatile = 10,
TK_while = 101, TK_while = 101,
TK__Bool = 47, TK__Bool = 47,
TK__Complex = 48, TK__Complex = 48,
@ -60,17 +60,17 @@ public interface UPCExpressionParsersym {
TK_Completion = 3, TK_Completion = 3,
TK_EndOfCompletion = 5, TK_EndOfCompletion = 5,
TK_Invalid = 102, TK_Invalid = 102,
TK_LeftBracket = 31, TK_LeftBracket = 32,
TK_LeftParen = 2, TK_LeftParen = 2,
TK_LeftBrace = 32, TK_LeftBrace = 30,
TK_Dot = 61, TK_Dot = 61,
TK_Arrow = 76, TK_Arrow = 76,
TK_PlusPlus = 15, TK_PlusPlus = 15,
TK_MinusMinus = 16, TK_MinusMinus = 16,
TK_And = 14, TK_And = 11,
TK_Star = 4, TK_Star = 4,
TK_Plus = 9, TK_Plus = 6,
TK_Minus = 10, TK_Minus = 7,
TK_Tilde = 22, TK_Tilde = 22,
TK_Bang = 23, TK_Bang = 23,
TK_Slash = 62, TK_Slash = 62,
@ -101,17 +101,17 @@ public interface UPCExpressionParsersym {
TK_AndAssign = 86, TK_AndAssign = 86,
TK_CaretAssign = 87, TK_CaretAssign = 87,
TK_OrAssign = 88, TK_OrAssign = 88,
TK_Comma = 54, TK_Comma = 55,
TK_RightBracket = 59, TK_RightBracket = 59,
TK_RightParen = 50, TK_RightParen = 50,
TK_RightBrace = 55, TK_RightBrace = 51,
TK_SemiColon = 75, TK_SemiColon = 75,
TK_MYTHREAD = 24, TK_MYTHREAD = 24,
TK_THREADS = 25, TK_THREADS = 25,
TK_UPC_MAX_BLOCKSIZE = 26, TK_UPC_MAX_BLOCKSIZE = 26,
TK_relaxed = 11, TK_relaxed = 12,
TK_shared = 12, TK_shared = 13,
TK_strict = 13, TK_strict = 14,
TK_upc_barrier = 103, TK_upc_barrier = 103,
TK_upc_localsizeof = 27, TK_upc_localsizeof = 27,
TK_upc_blocksizeof = 28, TK_upc_blocksizeof = 28,
@ -130,15 +130,15 @@ public interface UPCExpressionParsersym {
"Completion", "Completion",
"Star", "Star",
"EndOfCompletion", "EndOfCompletion",
"Plus",
"Minus",
"const", "const",
"restrict", "restrict",
"volatile", "volatile",
"Plus", "And",
"Minus",
"relaxed", "relaxed",
"shared", "shared",
"strict", "strict",
"And",
"PlusPlus", "PlusPlus",
"MinusMinus", "MinusMinus",
"sizeof", "sizeof",
@ -154,9 +154,9 @@ public interface UPCExpressionParsersym {
"upc_localsizeof", "upc_localsizeof",
"upc_blocksizeof", "upc_blocksizeof",
"upc_elemsizeof", "upc_elemsizeof",
"LeftBrace",
"static", "static",
"LeftBracket", "LeftBracket",
"LeftBrace",
"auto", "auto",
"extern", "extern",
"inline", "inline",
@ -175,11 +175,11 @@ public interface UPCExpressionParsersym {
"_Complex", "_Complex",
"_Imaginary", "_Imaginary",
"RightParen", "RightParen",
"RightBrace",
"enum", "enum",
"struct", "struct",
"union", "union",
"Comma", "Comma",
"RightBrace",
"ERROR_TOKEN", "ERROR_TOKEN",
"RightShift", "RightShift",
"LeftShift", "LeftShift",

View file

@ -24,6 +24,7 @@ import org.eclipse.cdt.core.dom.lrparser.lpgextensions.FixedBacktrackingParser;
import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap; import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap;
import org.eclipse.cdt.core.dom.lrparser.action.TokenMap; import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory; import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
@ -32,7 +33,6 @@ import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement; import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnarySizeofExpression; import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnarySizeofExpression;
import org.eclipse.cdt.core.dom.lrparser.lpgextensions.FixedBacktrackingParser; import org.eclipse.cdt.core.dom.lrparser.lpgextensions.FixedBacktrackingParser;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
public class UPCNoCastExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser public class UPCNoCastExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
{ {
@ -176,8 +176,9 @@ private UPCParserAction action;
public UPCNoCastExpressionParser() { // constructor public UPCNoCastExpressionParser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new UPCParserAction ( UPCASTNodeFactory.DEFAULT_INSTANCE , this, tu); action = new UPCParserAction ( UPCASTNodeFactory.DEFAULT_INSTANCE , this, tu);
action.setParserOptions(options);
} }
@ -187,10 +188,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // -1 means full error handling final int errorRepairCount = -1; // -1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -596,13 +597,13 @@ public UPCNoCastExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 101: labeled_statement ::= case constant_expression : // Rule 101: labeled_statement ::= case constant_expression : statement
// //
case 101: { action. consumeStatementCase(); break; case 101: { action. consumeStatementCase(); break;
} }
// //
// Rule 102: labeled_statement ::= default : // Rule 102: labeled_statement ::= default : statement
// //
case 102: { action. consumeStatementDefault(); break; case 102: { action. consumeStatementDefault(); break;
} }
@ -1160,381 +1161,399 @@ public UPCNoCastExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 278: initializer ::= { <openscope-ast> initializer_list comma_opt } // Rule 278: initializer ::= start_initializer_list { <openscope-ast> initializer_list comma_opt } end_initializer_list
// //
case 278: { action. consumeInitializerList(); break; case 278: { action. consumeInitializerList(); break;
} }
// //
// Rule 283: designated_initializer ::= <openscope-ast> designation = initializer // Rule 279: initializer ::= { <openscope-ast> }
// //
case 283: { action. consumeInitializerDesignated(); break; case 279: { action. consumeInitializerList(); break;
} }
// //
// Rule 287: designator_base ::= [ constant_expression ] // Rule 280: start_initializer_list ::= $Empty
// //
case 287: { action. consumeDesignatorArray(); break; case 280: { action. initializerListStart(); break;
} }
// //
// Rule 288: designator_base ::= . identifier_or_typedefname // Rule 281: end_initializer_list ::= $Empty
// //
case 288: { action. consumeDesignatorField(); break; case 281: { action. initializerListEnd(); break;
} }
// //
// Rule 289: designator ::= [ constant_expression ] // Rule 286: designated_initializer ::= <openscope-ast> designation = initializer
// //
case 289: { action. consumeDesignatorArray(); break; case 286: { action. consumeInitializerDesignated(); break;
} }
// //
// Rule 290: designator ::= . identifier_or_typedefname // Rule 290: designator_base ::= [ constant_expression ]
// //
case 290: { action. consumeDesignatorField(); break; case 290: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 291: translation_unit ::= external_declaration_list // Rule 291: designator_base ::= . identifier_or_typedefname
// //
case 291: { action. consumeTranslationUnit(); break; case 291: { action. consumeDesignatorField(); break;
} }
// //
// Rule 292: translation_unit ::= $Empty // Rule 292: designator ::= [ constant_expression ]
// //
case 292: { action. consumeTranslationUnit(); break; case 292: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 297: external_declaration ::= ; // Rule 293: designator ::= . identifier_or_typedefname
// //
case 297: { action. consumeDeclarationEmpty(); break; case 293: { action. consumeDesignatorField(); break;
} }
// //
// Rule 298: external_declaration ::= ERROR_TOKEN // Rule 294: translation_unit ::= external_declaration_list
// //
case 298: { action. consumeDeclarationProblem(); break; case 294: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 301: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body // Rule 295: translation_unit ::= $Empty
// //
case 301: { action. consumeFunctionDefinition(true); break; case 295: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 302: function_definition ::= <openscope-ast> function_declarator function_body // Rule 300: external_declaration ::= ;
// //
case 302: { action. consumeFunctionDefinition(false); break; case 300: { action. consumeDeclarationEmpty(); break;
} }
// //
// Rule 303: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement // Rule 301: external_declaration ::= ERROR_TOKEN
// //
case 303: { action. consumeFunctionDefinitionKnR(); break; case 301: { action. consumeDeclarationProblem(); break;
} }
// //
// Rule 304: function_body ::= { } // Rule 304: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body
// //
case 304: { action. consumeStatementCompoundStatement(false); break; case 304: { action. consumeFunctionDefinition(true); break;
} }
// //
// Rule 305: function_body ::= { <openscope-ast> block_item_list } // Rule 305: function_definition ::= <openscope-ast> function_declarator function_body
// //
case 305: { action. consumeStatementCompoundStatement(true); break; case 305: { action. consumeFunctionDefinition(false); break;
} }
// //
// Rule 307: no_cast_start ::= ERROR_TOKEN // Rule 306: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement
// //
case 307: { action. consumeExpressionProblem(); break; case 306: { action. consumeFunctionDefinitionKnR(); break;
} }
// //
// Rule 308: literal ::= MYTHREAD // Rule 307: function_body ::= { }
// //
case 308: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_mythread); break; case 307: { action. consumeStatementCompoundStatement(false); break;
} }
// //
// Rule 309: literal ::= THREADS // Rule 308: function_body ::= { <openscope-ast> block_item_list }
// //
case 309: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_threads); break; case 308: { action. consumeStatementCompoundStatement(true); break;
} }
// //
// Rule 310: literal ::= UPC_MAX_BLOCKSIZE // Rule 310: no_cast_start ::= ERROR_TOKEN
// //
case 310: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_upc_max_block_size); break; case 310: { action. consumeExpressionProblem(); break;
} }
// //
// Rule 311: unary_expression ::= upc_localsizeof unary_expression // Rule 311: literal ::= MYTHREAD
// //
case 311: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_localsizeof); break; case 311: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_mythread); break;
} }
// //
// Rule 312: unary_expression ::= upc_localsizeof ( type_name ) // Rule 312: literal ::= THREADS
// //
case 312: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_localsizeof); break; case 312: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_threads); break;
} }
// //
// Rule 313: unary_expression ::= upc_blocksizeof unary_expression // Rule 313: literal ::= UPC_MAX_BLOCKSIZE
// //
case 313: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_blocksizeof); break; case 313: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_upc_max_block_size); break;
} }
// //
// Rule 314: unary_expression ::= upc_blocksizeof ( type_name ) // Rule 314: unary_expression ::= upc_localsizeof unary_expression
// //
case 314: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_blocksizeof); break; case 314: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
} }
// //
// Rule 315: unary_expression ::= upc_elemsizeof unary_expression // Rule 315: unary_expression ::= upc_localsizeof ( type_name )
// //
case 315: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_elemsizeof); break; case 315: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
} }
// //
// Rule 316: unary_expression ::= upc_elemsizeof ( type_name ) // Rule 316: unary_expression ::= upc_blocksizeof unary_expression
// //
case 316: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_elemsizeof); break; case 316: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
} }
// //
// Rule 320: shared_type_qualifier ::= shared // Rule 317: unary_expression ::= upc_blocksizeof ( type_name )
// //
case 320: { action. consumeToken(); break; case 317: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
} }
// //
// Rule 321: reference_type_qualifier ::= relaxed // Rule 318: unary_expression ::= upc_elemsizeof unary_expression
// //
case 321: { action. consumeToken(); break; case 318: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
} }
// //
// Rule 322: reference_type_qualifier ::= strict // Rule 319: unary_expression ::= upc_elemsizeof ( type_name )
// //
case 322: { action. consumeToken(); break; case 319: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
} }
// //
// Rule 323: layout_qualifier ::= [ constant_expression ] // Rule 323: shared_type_qualifier ::= shared
// //
case 323: { action. consumeLayoutQualifier(true, false); break; case 323: { action. consumeToken(); break;
} }
// //
// Rule 324: layout_qualifier ::= [ * ] // Rule 324: reference_type_qualifier ::= relaxed
// //
case 324: { action. consumeLayoutQualifier(false, true); break; case 324: { action. consumeToken(); break;
} }
// //
// Rule 325: layout_qualifier ::= [ ] // Rule 325: reference_type_qualifier ::= strict
// //
case 325: { action. consumeLayoutQualifier(false, false); break; case 325: { action. consumeToken(); break;
} }
// //
// Rule 327: synchronization_statement ::= upc_notify expression ; // Rule 326: layout_qualifier ::= [ constant_expression ]
// //
case 327: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, true); break; case 326: { action. consumeLayoutQualifier(true, false); break;
} }
// //
// Rule 328: synchronization_statement ::= upc_notify ; // Rule 327: layout_qualifier ::= [ * ]
// //
case 328: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, false); break; case 327: { action. consumeLayoutQualifier(false, true); break;
} }
// //
// Rule 329: synchronization_statement ::= upc_wait expression ; // Rule 328: layout_qualifier ::= [ ]
// //
case 329: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, true); break; case 328: { action. consumeLayoutQualifier(false, false); break;
} }
// //
// Rule 330: synchronization_statement ::= upc_wait ; // Rule 330: synchronization_statement ::= upc_notify expression ;
// //
case 330: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, false); break; case 330: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, true); break;
} }
// //
// Rule 331: synchronization_statement ::= upc_barrier expression ; // Rule 331: synchronization_statement ::= upc_notify ;
// //
case 331: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, true); break; case 331: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, false); break;
} }
// //
// Rule 332: synchronization_statement ::= upc_barrier ; // Rule 332: synchronization_statement ::= upc_wait expression ;
// //
case 332: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, false); break; case 332: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, true); break;
} }
// //
// Rule 333: synchronization_statement ::= upc_fence ; // Rule 333: synchronization_statement ::= upc_wait ;
// //
case 333: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_fence, false); break; case 333: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, false); break;
} }
// //
// Rule 334: iteration_statement ::= upc_forall ( expression ; expression ; expression ; affinity ) statement // Rule 334: synchronization_statement ::= upc_barrier expression ;
// //
case 334: { action. consumeStatementUPCForallLoop(true, true, true, true); break; case 334: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, true); break;
} }
// //
// Rule 335: iteration_statement ::= upc_forall ( expression ; expression ; expression ; ) statement // Rule 335: synchronization_statement ::= upc_barrier ;
// //
case 335: { action. consumeStatementUPCForallLoop(true, true, true, false); break; case 335: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, false); break;
} }
// //
// Rule 336: iteration_statement ::= upc_forall ( expression ; expression ; ; affinity ) statement // Rule 336: synchronization_statement ::= upc_fence ;
// //
case 336: { action. consumeStatementUPCForallLoop(true, true, false, true); break; case 336: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_fence, false); break;
} }
// //
// Rule 337: iteration_statement ::= upc_forall ( expression ; expression ; ; ) statement // Rule 337: iteration_statement ::= upc_forall ( expression ; expression ; expression ; affinity ) statement
// //
case 337: { action. consumeStatementUPCForallLoop(true, true, false, false); break; case 337: { action. consumeStatementUPCForallLoop(true, true, true, true); break;
} }
// //
// Rule 338: iteration_statement ::= upc_forall ( expression ; ; expression ; affinity ) statement // Rule 338: iteration_statement ::= upc_forall ( expression ; expression ; expression ; ) statement
// //
case 338: { action. consumeStatementUPCForallLoop(true, false, true, true); break; case 338: { action. consumeStatementUPCForallLoop(true, true, true, false); break;
} }
// //
// Rule 339: iteration_statement ::= upc_forall ( expression ; ; expression ; ) statement // Rule 339: iteration_statement ::= upc_forall ( expression ; expression ; ; affinity ) statement
// //
case 339: { action. consumeStatementUPCForallLoop(true, false, true, false); break; case 339: { action. consumeStatementUPCForallLoop(true, true, false, true); break;
} }
// //
// Rule 340: iteration_statement ::= upc_forall ( expression ; ; ; affinity ) statement // Rule 340: iteration_statement ::= upc_forall ( expression ; expression ; ; ) statement
// //
case 340: { action. consumeStatementUPCForallLoop(true, false, false, true); break; case 340: { action. consumeStatementUPCForallLoop(true, true, false, false); break;
} }
// //
// Rule 341: iteration_statement ::= upc_forall ( expression ; ; ; ) statement // Rule 341: iteration_statement ::= upc_forall ( expression ; ; expression ; affinity ) statement
// //
case 341: { action. consumeStatementUPCForallLoop(true, false, false, false); break; case 341: { action. consumeStatementUPCForallLoop(true, false, true, true); break;
} }
// //
// Rule 342: iteration_statement ::= upc_forall ( ; expression ; expression ; affinity ) statement // Rule 342: iteration_statement ::= upc_forall ( expression ; ; expression ; ) statement
// //
case 342: { action. consumeStatementUPCForallLoop(false, true, true, true); break; case 342: { action. consumeStatementUPCForallLoop(true, false, true, false); break;
} }
// //
// Rule 343: iteration_statement ::= upc_forall ( ; expression ; expression ; ) statement // Rule 343: iteration_statement ::= upc_forall ( expression ; ; ; affinity ) statement
// //
case 343: { action. consumeStatementUPCForallLoop(false, true, true, false); break; case 343: { action. consumeStatementUPCForallLoop(true, false, false, true); break;
} }
// //
// Rule 344: iteration_statement ::= upc_forall ( ; expression ; ; affinity ) statement // Rule 344: iteration_statement ::= upc_forall ( expression ; ; ; ) statement
// //
case 344: { action. consumeStatementUPCForallLoop(false, true, false, true); break; case 344: { action. consumeStatementUPCForallLoop(true, false, false, false); break;
} }
// //
// Rule 345: iteration_statement ::= upc_forall ( ; expression ; ; ) statement // Rule 345: iteration_statement ::= upc_forall ( ; expression ; expression ; affinity ) statement
// //
case 345: { action. consumeStatementUPCForallLoop(false, true, false, false); break; case 345: { action. consumeStatementUPCForallLoop(false, true, true, true); break;
} }
// //
// Rule 346: iteration_statement ::= upc_forall ( ; ; expression ; affinity ) statement // Rule 346: iteration_statement ::= upc_forall ( ; expression ; expression ; ) statement
// //
case 346: { action. consumeStatementUPCForallLoop(false, false, true, true); break; case 346: { action. consumeStatementUPCForallLoop(false, true, true, false); break;
} }
// //
// Rule 347: iteration_statement ::= upc_forall ( ; ; expression ; ) statement // Rule 347: iteration_statement ::= upc_forall ( ; expression ; ; affinity ) statement
// //
case 347: { action. consumeStatementUPCForallLoop(false, false, true, false); break; case 347: { action. consumeStatementUPCForallLoop(false, true, false, true); break;
} }
// //
// Rule 348: iteration_statement ::= upc_forall ( ; ; ; affinity ) statement // Rule 348: iteration_statement ::= upc_forall ( ; expression ; ; ) statement
// //
case 348: { action. consumeStatementUPCForallLoop(false, false, false, true); break; case 348: { action. consumeStatementUPCForallLoop(false, true, false, false); break;
} }
// //
// Rule 349: iteration_statement ::= upc_forall ( ; ; ; ) statement // Rule 349: iteration_statement ::= upc_forall ( ; ; expression ; affinity ) statement
// //
case 349: { action. consumeStatementUPCForallLoop(false, false, false, false); break; case 349: { action. consumeStatementUPCForallLoop(false, false, true, true); break;
} }
// //
// Rule 350: iteration_statement ::= upc_forall ( declaration expression ; expression ; affinity ) statement // Rule 350: iteration_statement ::= upc_forall ( ; ; expression ; ) statement
// //
case 350: { action. consumeStatementUPCForallLoop(true, true, true, true); break; case 350: { action. consumeStatementUPCForallLoop(false, false, true, false); break;
} }
// //
// Rule 351: iteration_statement ::= upc_forall ( declaration expression ; expression ; ) statement // Rule 351: iteration_statement ::= upc_forall ( ; ; ; affinity ) statement
// //
case 351: { action. consumeStatementUPCForallLoop(true, true, true, false); break; case 351: { action. consumeStatementUPCForallLoop(false, false, false, true); break;
} }
// //
// Rule 352: iteration_statement ::= upc_forall ( declaration expression ; ; affinity ) statement // Rule 352: iteration_statement ::= upc_forall ( ; ; ; ) statement
// //
case 352: { action. consumeStatementUPCForallLoop(true, true, false, true); break; case 352: { action. consumeStatementUPCForallLoop(false, false, false, false); break;
} }
// //
// Rule 353: iteration_statement ::= upc_forall ( declaration expression ; ; ) statement // Rule 353: iteration_statement ::= upc_forall ( declaration expression ; expression ; affinity ) statement
// //
case 353: { action. consumeStatementUPCForallLoop(true, true, false, false); break; case 353: { action. consumeStatementUPCForallLoop(true, true, true, true); break;
} }
// //
// Rule 354: iteration_statement ::= upc_forall ( declaration ; expression ; affinity ) statement // Rule 354: iteration_statement ::= upc_forall ( declaration expression ; expression ; ) statement
// //
case 354: { action. consumeStatementUPCForallLoop(true, false, true, true); break; case 354: { action. consumeStatementUPCForallLoop(true, true, true, false); break;
} }
// //
// Rule 355: iteration_statement ::= upc_forall ( declaration ; expression ; ) statement // Rule 355: iteration_statement ::= upc_forall ( declaration expression ; ; affinity ) statement
// //
case 355: { action. consumeStatementUPCForallLoop(true, false, true, false); break; case 355: { action. consumeStatementUPCForallLoop(true, true, false, true); break;
} }
// //
// Rule 356: iteration_statement ::= upc_forall ( declaration ; ; affinity ) statement // Rule 356: iteration_statement ::= upc_forall ( declaration expression ; ; ) statement
// //
case 356: { action. consumeStatementUPCForallLoop(true, false, false, true); break; case 356: { action. consumeStatementUPCForallLoop(true, true, false, false); break;
} }
// //
// Rule 357: iteration_statement ::= upc_forall ( declaration ; ; ) statement // Rule 357: iteration_statement ::= upc_forall ( declaration ; expression ; affinity ) statement
// //
case 357: { action. consumeStatementUPCForallLoop(true, false, false, false); break; case 357: { action. consumeStatementUPCForallLoop(true, false, true, true); break;
} }
// //
// Rule 359: affinity ::= continue // Rule 358: iteration_statement ::= upc_forall ( declaration ; expression ; ) statement
// //
case 359: { action. consumeToken(); break; case 358: { action. consumeStatementUPCForallLoop(true, false, true, false); break;
}
//
// Rule 359: iteration_statement ::= upc_forall ( declaration ; ; affinity ) statement
//
case 359: { action. consumeStatementUPCForallLoop(true, false, false, true); break;
}
//
// Rule 360: iteration_statement ::= upc_forall ( declaration ; ; ) statement
//
case 360: { action. consumeStatementUPCForallLoop(true, false, false, false); break;
}
//
// Rule 362: affinity ::= continue
//
case 362: { action. consumeToken(); break;
} }

View file

@ -15,7 +15,7 @@ package org.eclipse.cdt.internal.core.dom.parser.upc;
public interface UPCNoCastExpressionParsersym { public interface UPCNoCastExpressionParsersym {
public final static int public final static int
TK_auto = 32, TK_auto = 33,
TK_break = 90, TK_break = 90,
TK_case = 91, TK_case = 91,
TK_char = 38, TK_char = 38,
@ -25,26 +25,26 @@ public interface UPCNoCastExpressionParsersym {
TK_do = 94, TK_do = 94,
TK_double = 39, TK_double = 39,
TK_else = 95, TK_else = 95,
TK_enum = 51, TK_enum = 52,
TK_extern = 33, TK_extern = 34,
TK_float = 40, TK_float = 40,
TK_for = 96, TK_for = 96,
TK_goto = 97, TK_goto = 97,
TK_if = 98, TK_if = 98,
TK_inline = 34, TK_inline = 35,
TK_int = 41, TK_int = 41,
TK_long = 42, TK_long = 42,
TK_register = 35, TK_register = 36,
TK_restrict = 7, TK_restrict = 7,
TK_return = 99, TK_return = 99,
TK_short = 43, TK_short = 43,
TK_signed = 44, TK_signed = 44,
TK_sizeof = 19, TK_sizeof = 17,
TK_static = 15, TK_static = 18,
TK_struct = 52, TK_struct = 53,
TK_switch = 100, TK_switch = 100,
TK_typedef = 36, TK_typedef = 37,
TK_union = 53, TK_union = 54,
TK_unsigned = 45, TK_unsigned = 45,
TK_void = 46, TK_void = 46,
TK_volatile = 8, TK_volatile = 8,
@ -52,27 +52,27 @@ public interface UPCNoCastExpressionParsersym {
TK__Bool = 47, TK__Bool = 47,
TK__Complex = 48, TK__Complex = 48,
TK__Imaginary = 49, TK__Imaginary = 49,
TK_integer = 20, TK_integer = 19,
TK_floating = 21, TK_floating = 20,
TK_charconst = 22, TK_charconst = 21,
TK_stringlit = 23, TK_stringlit = 22,
TK_identifier = 1, TK_identifier = 1,
TK_Completion = 3, TK_Completion = 3,
TK_EndOfCompletion = 5, TK_EndOfCompletion = 5,
TK_Invalid = 102, TK_Invalid = 102,
TK_LeftBracket = 16, TK_LeftBracket = 23,
TK_LeftParen = 2, TK_LeftParen = 2,
TK_LeftBrace = 37, TK_LeftBrace = 24,
TK_Dot = 61, TK_Dot = 61,
TK_Arrow = 76, TK_Arrow = 76,
TK_PlusPlus = 17, TK_PlusPlus = 15,
TK_MinusMinus = 18, TK_MinusMinus = 16,
TK_And = 14, TK_And = 14,
TK_Star = 4, TK_Star = 4,
TK_Plus = 12, TK_Plus = 12,
TK_Minus = 13, TK_Minus = 13,
TK_Tilde = 24, TK_Tilde = 25,
TK_Bang = 25, TK_Bang = 26,
TK_Slash = 62, TK_Slash = 62,
TK_Percent = 63, TK_Percent = 63,
TK_RightShift = 57, TK_RightShift = 57,
@ -101,21 +101,21 @@ public interface UPCNoCastExpressionParsersym {
TK_AndAssign = 86, TK_AndAssign = 86,
TK_CaretAssign = 87, TK_CaretAssign = 87,
TK_OrAssign = 88, TK_OrAssign = 88,
TK_Comma = 54, TK_Comma = 55,
TK_RightBracket = 59, TK_RightBracket = 59,
TK_RightParen = 50, TK_RightParen = 50,
TK_RightBrace = 55, TK_RightBrace = 51,
TK_SemiColon = 75, TK_SemiColon = 75,
TK_MYTHREAD = 26, TK_MYTHREAD = 27,
TK_THREADS = 27, TK_THREADS = 28,
TK_UPC_MAX_BLOCKSIZE = 28, TK_UPC_MAX_BLOCKSIZE = 29,
TK_relaxed = 9, TK_relaxed = 9,
TK_shared = 10, TK_shared = 10,
TK_strict = 11, TK_strict = 11,
TK_upc_barrier = 103, TK_upc_barrier = 103,
TK_upc_localsizeof = 29, TK_upc_localsizeof = 30,
TK_upc_blocksizeof = 30, TK_upc_blocksizeof = 31,
TK_upc_elemsizeof = 31, TK_upc_elemsizeof = 32,
TK_upc_notify = 104, TK_upc_notify = 104,
TK_upc_fence = 105, TK_upc_fence = 105,
TK_upc_wait = 106, TK_upc_wait = 106,
@ -139,15 +139,16 @@ public interface UPCNoCastExpressionParsersym {
"Plus", "Plus",
"Minus", "Minus",
"And", "And",
"static",
"LeftBracket",
"PlusPlus", "PlusPlus",
"MinusMinus", "MinusMinus",
"sizeof", "sizeof",
"static",
"integer", "integer",
"floating", "floating",
"charconst", "charconst",
"stringlit", "stringlit",
"LeftBracket",
"LeftBrace",
"Tilde", "Tilde",
"Bang", "Bang",
"MYTHREAD", "MYTHREAD",
@ -161,7 +162,6 @@ public interface UPCNoCastExpressionParsersym {
"inline", "inline",
"register", "register",
"typedef", "typedef",
"LeftBrace",
"char", "char",
"double", "double",
"float", "float",
@ -175,11 +175,11 @@ public interface UPCNoCastExpressionParsersym {
"_Complex", "_Complex",
"_Imaginary", "_Imaginary",
"RightParen", "RightParen",
"RightBrace",
"enum", "enum",
"struct", "struct",
"union", "union",
"Comma", "Comma",
"RightBrace",
"ERROR_TOKEN", "ERROR_TOKEN",
"RightShift", "RightShift",
"LeftShift", "LeftShift",

View file

@ -24,6 +24,7 @@ import org.eclipse.cdt.core.dom.lrparser.lpgextensions.FixedBacktrackingParser;
import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap; import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap;
import org.eclipse.cdt.core.dom.lrparser.action.TokenMap; import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory; import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
@ -32,7 +33,6 @@ import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement; import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnarySizeofExpression; import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnarySizeofExpression;
import org.eclipse.cdt.core.dom.lrparser.lpgextensions.FixedBacktrackingParser; import org.eclipse.cdt.core.dom.lrparser.lpgextensions.FixedBacktrackingParser;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
public class UPCParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser public class UPCParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
{ {
@ -176,8 +176,9 @@ private UPCParserAction action;
public UPCParser() { // constructor public UPCParser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new UPCParserAction ( UPCASTNodeFactory.DEFAULT_INSTANCE , this, tu); action = new UPCParserAction ( UPCASTNodeFactory.DEFAULT_INSTANCE , this, tu);
action.setParserOptions(options);
} }
@ -187,10 +188,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // -1 means full error handling final int errorRepairCount = -1; // -1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -602,13 +603,13 @@ public UPCParser(String[] mapFrom) { // constructor
} }
// //
// Rule 102: labeled_statement ::= case constant_expression : // Rule 102: labeled_statement ::= case constant_expression : statement
// //
case 102: { action. consumeStatementCase(); break; case 102: { action. consumeStatementCase(); break;
} }
// //
// Rule 103: labeled_statement ::= default : // Rule 103: labeled_statement ::= default : statement
// //
case 103: { action. consumeStatementDefault(); break; case 103: { action. consumeStatementDefault(); break;
} }
@ -1166,375 +1167,393 @@ public UPCParser(String[] mapFrom) { // constructor
} }
// //
// Rule 279: initializer ::= { <openscope-ast> initializer_list comma_opt } // Rule 279: initializer ::= start_initializer_list { <openscope-ast> initializer_list comma_opt } end_initializer_list
// //
case 279: { action. consumeInitializerList(); break; case 279: { action. consumeInitializerList(); break;
} }
// //
// Rule 284: designated_initializer ::= <openscope-ast> designation = initializer // Rule 280: initializer ::= { <openscope-ast> }
// //
case 284: { action. consumeInitializerDesignated(); break; case 280: { action. consumeInitializerList(); break;
} }
// //
// Rule 288: designator_base ::= [ constant_expression ] // Rule 281: start_initializer_list ::= $Empty
// //
case 288: { action. consumeDesignatorArray(); break; case 281: { action. initializerListStart(); break;
} }
// //
// Rule 289: designator_base ::= . identifier_or_typedefname // Rule 282: end_initializer_list ::= $Empty
// //
case 289: { action. consumeDesignatorField(); break; case 282: { action. initializerListEnd(); break;
} }
// //
// Rule 290: designator ::= [ constant_expression ] // Rule 287: designated_initializer ::= <openscope-ast> designation = initializer
// //
case 290: { action. consumeDesignatorArray(); break; case 287: { action. consumeInitializerDesignated(); break;
} }
// //
// Rule 291: designator ::= . identifier_or_typedefname // Rule 291: designator_base ::= [ constant_expression ]
// //
case 291: { action. consumeDesignatorField(); break; case 291: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 292: translation_unit ::= external_declaration_list // Rule 292: designator_base ::= . identifier_or_typedefname
// //
case 292: { action. consumeTranslationUnit(); break; case 292: { action. consumeDesignatorField(); break;
} }
// //
// Rule 293: translation_unit ::= $Empty // Rule 293: designator ::= [ constant_expression ]
// //
case 293: { action. consumeTranslationUnit(); break; case 293: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 298: external_declaration ::= ; // Rule 294: designator ::= . identifier_or_typedefname
// //
case 298: { action. consumeDeclarationEmpty(); break; case 294: { action. consumeDesignatorField(); break;
} }
// //
// Rule 299: external_declaration ::= ERROR_TOKEN // Rule 295: translation_unit ::= external_declaration_list
// //
case 299: { action. consumeDeclarationProblem(); break; case 295: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 302: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body // Rule 296: translation_unit ::= $Empty
// //
case 302: { action. consumeFunctionDefinition(true); break; case 296: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 303: function_definition ::= <openscope-ast> function_declarator function_body // Rule 301: external_declaration ::= ;
// //
case 303: { action. consumeFunctionDefinition(false); break; case 301: { action. consumeDeclarationEmpty(); break;
} }
// //
// Rule 304: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement // Rule 302: external_declaration ::= ERROR_TOKEN
// //
case 304: { action. consumeFunctionDefinitionKnR(); break; case 302: { action. consumeDeclarationProblem(); break;
} }
// //
// Rule 305: function_body ::= { } // Rule 305: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body
// //
case 305: { action. consumeStatementCompoundStatement(false); break; case 305: { action. consumeFunctionDefinition(true); break;
} }
// //
// Rule 306: function_body ::= { <openscope-ast> block_item_list } // Rule 306: function_definition ::= <openscope-ast> function_declarator function_body
// //
case 306: { action. consumeStatementCompoundStatement(true); break; case 306: { action. consumeFunctionDefinition(false); break;
} }
// //
// Rule 307: literal ::= MYTHREAD // Rule 307: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement
// //
case 307: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_mythread); break; case 307: { action. consumeFunctionDefinitionKnR(); break;
} }
// //
// Rule 308: literal ::= THREADS // Rule 308: function_body ::= { }
// //
case 308: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_threads); break; case 308: { action. consumeStatementCompoundStatement(false); break;
} }
// //
// Rule 309: literal ::= UPC_MAX_BLOCKSIZE // Rule 309: function_body ::= { <openscope-ast> block_item_list }
// //
case 309: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_upc_max_block_size); break; case 309: { action. consumeStatementCompoundStatement(true); break;
} }
// //
// Rule 310: unary_expression ::= upc_localsizeof unary_expression // Rule 310: literal ::= MYTHREAD
// //
case 310: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_localsizeof); break; case 310: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_mythread); break;
} }
// //
// Rule 311: unary_expression ::= upc_localsizeof ( type_name ) // Rule 311: literal ::= THREADS
// //
case 311: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_localsizeof); break; case 311: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_threads); break;
} }
// //
// Rule 312: unary_expression ::= upc_blocksizeof unary_expression // Rule 312: literal ::= UPC_MAX_BLOCKSIZE
// //
case 312: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_blocksizeof); break; case 312: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_upc_max_block_size); break;
} }
// //
// Rule 313: unary_expression ::= upc_blocksizeof ( type_name ) // Rule 313: unary_expression ::= upc_localsizeof unary_expression
// //
case 313: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_blocksizeof); break; case 313: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
} }
// //
// Rule 314: unary_expression ::= upc_elemsizeof unary_expression // Rule 314: unary_expression ::= upc_localsizeof ( type_name )
// //
case 314: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_elemsizeof); break; case 314: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
} }
// //
// Rule 315: unary_expression ::= upc_elemsizeof ( type_name ) // Rule 315: unary_expression ::= upc_blocksizeof unary_expression
// //
case 315: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_elemsizeof); break; case 315: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
} }
// //
// Rule 319: shared_type_qualifier ::= shared // Rule 316: unary_expression ::= upc_blocksizeof ( type_name )
// //
case 319: { action. consumeToken(); break; case 316: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
} }
// //
// Rule 320: reference_type_qualifier ::= relaxed // Rule 317: unary_expression ::= upc_elemsizeof unary_expression
// //
case 320: { action. consumeToken(); break; case 317: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
} }
// //
// Rule 321: reference_type_qualifier ::= strict // Rule 318: unary_expression ::= upc_elemsizeof ( type_name )
// //
case 321: { action. consumeToken(); break; case 318: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
} }
// //
// Rule 322: layout_qualifier ::= [ constant_expression ] // Rule 322: shared_type_qualifier ::= shared
// //
case 322: { action. consumeLayoutQualifier(true, false); break; case 322: { action. consumeToken(); break;
} }
// //
// Rule 323: layout_qualifier ::= [ * ] // Rule 323: reference_type_qualifier ::= relaxed
// //
case 323: { action. consumeLayoutQualifier(false, true); break; case 323: { action. consumeToken(); break;
} }
// //
// Rule 324: layout_qualifier ::= [ ] // Rule 324: reference_type_qualifier ::= strict
// //
case 324: { action. consumeLayoutQualifier(false, false); break; case 324: { action. consumeToken(); break;
} }
// //
// Rule 326: synchronization_statement ::= upc_notify expression ; // Rule 325: layout_qualifier ::= [ constant_expression ]
// //
case 326: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, true); break; case 325: { action. consumeLayoutQualifier(true, false); break;
} }
// //
// Rule 327: synchronization_statement ::= upc_notify ; // Rule 326: layout_qualifier ::= [ * ]
// //
case 327: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, false); break; case 326: { action. consumeLayoutQualifier(false, true); break;
} }
// //
// Rule 328: synchronization_statement ::= upc_wait expression ; // Rule 327: layout_qualifier ::= [ ]
// //
case 328: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, true); break; case 327: { action. consumeLayoutQualifier(false, false); break;
} }
// //
// Rule 329: synchronization_statement ::= upc_wait ; // Rule 329: synchronization_statement ::= upc_notify expression ;
// //
case 329: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, false); break; case 329: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, true); break;
} }
// //
// Rule 330: synchronization_statement ::= upc_barrier expression ; // Rule 330: synchronization_statement ::= upc_notify ;
// //
case 330: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, true); break; case 330: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, false); break;
} }
// //
// Rule 331: synchronization_statement ::= upc_barrier ; // Rule 331: synchronization_statement ::= upc_wait expression ;
// //
case 331: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, false); break; case 331: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, true); break;
} }
// //
// Rule 332: synchronization_statement ::= upc_fence ; // Rule 332: synchronization_statement ::= upc_wait ;
// //
case 332: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_fence, false); break; case 332: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, false); break;
} }
// //
// Rule 333: iteration_statement ::= upc_forall ( expression ; expression ; expression ; affinity ) statement // Rule 333: synchronization_statement ::= upc_barrier expression ;
// //
case 333: { action. consumeStatementUPCForallLoop(true, true, true, true); break; case 333: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, true); break;
} }
// //
// Rule 334: iteration_statement ::= upc_forall ( expression ; expression ; expression ; ) statement // Rule 334: synchronization_statement ::= upc_barrier ;
// //
case 334: { action. consumeStatementUPCForallLoop(true, true, true, false); break; case 334: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, false); break;
} }
// //
// Rule 335: iteration_statement ::= upc_forall ( expression ; expression ; ; affinity ) statement // Rule 335: synchronization_statement ::= upc_fence ;
// //
case 335: { action. consumeStatementUPCForallLoop(true, true, false, true); break; case 335: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_fence, false); break;
} }
// //
// Rule 336: iteration_statement ::= upc_forall ( expression ; expression ; ; ) statement // Rule 336: iteration_statement ::= upc_forall ( expression ; expression ; expression ; affinity ) statement
// //
case 336: { action. consumeStatementUPCForallLoop(true, true, false, false); break; case 336: { action. consumeStatementUPCForallLoop(true, true, true, true); break;
} }
// //
// Rule 337: iteration_statement ::= upc_forall ( expression ; ; expression ; affinity ) statement // Rule 337: iteration_statement ::= upc_forall ( expression ; expression ; expression ; ) statement
// //
case 337: { action. consumeStatementUPCForallLoop(true, false, true, true); break; case 337: { action. consumeStatementUPCForallLoop(true, true, true, false); break;
} }
// //
// Rule 338: iteration_statement ::= upc_forall ( expression ; ; expression ; ) statement // Rule 338: iteration_statement ::= upc_forall ( expression ; expression ; ; affinity ) statement
// //
case 338: { action. consumeStatementUPCForallLoop(true, false, true, false); break; case 338: { action. consumeStatementUPCForallLoop(true, true, false, true); break;
} }
// //
// Rule 339: iteration_statement ::= upc_forall ( expression ; ; ; affinity ) statement // Rule 339: iteration_statement ::= upc_forall ( expression ; expression ; ; ) statement
// //
case 339: { action. consumeStatementUPCForallLoop(true, false, false, true); break; case 339: { action. consumeStatementUPCForallLoop(true, true, false, false); break;
} }
// //
// Rule 340: iteration_statement ::= upc_forall ( expression ; ; ; ) statement // Rule 340: iteration_statement ::= upc_forall ( expression ; ; expression ; affinity ) statement
// //
case 340: { action. consumeStatementUPCForallLoop(true, false, false, false); break; case 340: { action. consumeStatementUPCForallLoop(true, false, true, true); break;
} }
// //
// Rule 341: iteration_statement ::= upc_forall ( ; expression ; expression ; affinity ) statement // Rule 341: iteration_statement ::= upc_forall ( expression ; ; expression ; ) statement
// //
case 341: { action. consumeStatementUPCForallLoop(false, true, true, true); break; case 341: { action. consumeStatementUPCForallLoop(true, false, true, false); break;
} }
// //
// Rule 342: iteration_statement ::= upc_forall ( ; expression ; expression ; ) statement // Rule 342: iteration_statement ::= upc_forall ( expression ; ; ; affinity ) statement
// //
case 342: { action. consumeStatementUPCForallLoop(false, true, true, false); break; case 342: { action. consumeStatementUPCForallLoop(true, false, false, true); break;
} }
// //
// Rule 343: iteration_statement ::= upc_forall ( ; expression ; ; affinity ) statement // Rule 343: iteration_statement ::= upc_forall ( expression ; ; ; ) statement
// //
case 343: { action. consumeStatementUPCForallLoop(false, true, false, true); break; case 343: { action. consumeStatementUPCForallLoop(true, false, false, false); break;
} }
// //
// Rule 344: iteration_statement ::= upc_forall ( ; expression ; ; ) statement // Rule 344: iteration_statement ::= upc_forall ( ; expression ; expression ; affinity ) statement
// //
case 344: { action. consumeStatementUPCForallLoop(false, true, false, false); break; case 344: { action. consumeStatementUPCForallLoop(false, true, true, true); break;
} }
// //
// Rule 345: iteration_statement ::= upc_forall ( ; ; expression ; affinity ) statement // Rule 345: iteration_statement ::= upc_forall ( ; expression ; expression ; ) statement
// //
case 345: { action. consumeStatementUPCForallLoop(false, false, true, true); break; case 345: { action. consumeStatementUPCForallLoop(false, true, true, false); break;
} }
// //
// Rule 346: iteration_statement ::= upc_forall ( ; ; expression ; ) statement // Rule 346: iteration_statement ::= upc_forall ( ; expression ; ; affinity ) statement
// //
case 346: { action. consumeStatementUPCForallLoop(false, false, true, false); break; case 346: { action. consumeStatementUPCForallLoop(false, true, false, true); break;
} }
// //
// Rule 347: iteration_statement ::= upc_forall ( ; ; ; affinity ) statement // Rule 347: iteration_statement ::= upc_forall ( ; expression ; ; ) statement
// //
case 347: { action. consumeStatementUPCForallLoop(false, false, false, true); break; case 347: { action. consumeStatementUPCForallLoop(false, true, false, false); break;
} }
// //
// Rule 348: iteration_statement ::= upc_forall ( ; ; ; ) statement // Rule 348: iteration_statement ::= upc_forall ( ; ; expression ; affinity ) statement
// //
case 348: { action. consumeStatementUPCForallLoop(false, false, false, false); break; case 348: { action. consumeStatementUPCForallLoop(false, false, true, true); break;
} }
// //
// Rule 349: iteration_statement ::= upc_forall ( declaration expression ; expression ; affinity ) statement // Rule 349: iteration_statement ::= upc_forall ( ; ; expression ; ) statement
// //
case 349: { action. consumeStatementUPCForallLoop(true, true, true, true); break; case 349: { action. consumeStatementUPCForallLoop(false, false, true, false); break;
} }
// //
// Rule 350: iteration_statement ::= upc_forall ( declaration expression ; expression ; ) statement // Rule 350: iteration_statement ::= upc_forall ( ; ; ; affinity ) statement
// //
case 350: { action. consumeStatementUPCForallLoop(true, true, true, false); break; case 350: { action. consumeStatementUPCForallLoop(false, false, false, true); break;
} }
// //
// Rule 351: iteration_statement ::= upc_forall ( declaration expression ; ; affinity ) statement // Rule 351: iteration_statement ::= upc_forall ( ; ; ; ) statement
// //
case 351: { action. consumeStatementUPCForallLoop(true, true, false, true); break; case 351: { action. consumeStatementUPCForallLoop(false, false, false, false); break;
} }
// //
// Rule 352: iteration_statement ::= upc_forall ( declaration expression ; ; ) statement // Rule 352: iteration_statement ::= upc_forall ( declaration expression ; expression ; affinity ) statement
// //
case 352: { action. consumeStatementUPCForallLoop(true, true, false, false); break; case 352: { action. consumeStatementUPCForallLoop(true, true, true, true); break;
} }
// //
// Rule 353: iteration_statement ::= upc_forall ( declaration ; expression ; affinity ) statement // Rule 353: iteration_statement ::= upc_forall ( declaration expression ; expression ; ) statement
// //
case 353: { action. consumeStatementUPCForallLoop(true, false, true, true); break; case 353: { action. consumeStatementUPCForallLoop(true, true, true, false); break;
} }
// //
// Rule 354: iteration_statement ::= upc_forall ( declaration ; expression ; ) statement // Rule 354: iteration_statement ::= upc_forall ( declaration expression ; ; affinity ) statement
// //
case 354: { action. consumeStatementUPCForallLoop(true, false, true, false); break; case 354: { action. consumeStatementUPCForallLoop(true, true, false, true); break;
} }
// //
// Rule 355: iteration_statement ::= upc_forall ( declaration ; ; affinity ) statement // Rule 355: iteration_statement ::= upc_forall ( declaration expression ; ; ) statement
// //
case 355: { action. consumeStatementUPCForallLoop(true, false, false, true); break; case 355: { action. consumeStatementUPCForallLoop(true, true, false, false); break;
} }
// //
// Rule 356: iteration_statement ::= upc_forall ( declaration ; ; ) statement // Rule 356: iteration_statement ::= upc_forall ( declaration ; expression ; affinity ) statement
// //
case 356: { action. consumeStatementUPCForallLoop(true, false, false, false); break; case 356: { action. consumeStatementUPCForallLoop(true, false, true, true); break;
} }
// //
// Rule 358: affinity ::= continue // Rule 357: iteration_statement ::= upc_forall ( declaration ; expression ; ) statement
// //
case 358: { action. consumeToken(); break; case 357: { action. consumeStatementUPCForallLoop(true, false, true, false); break;
}
//
// Rule 358: iteration_statement ::= upc_forall ( declaration ; ; affinity ) statement
//
case 358: { action. consumeStatementUPCForallLoop(true, false, false, true); break;
}
//
// Rule 359: iteration_statement ::= upc_forall ( declaration ; ; ) statement
//
case 359: { action. consumeStatementUPCForallLoop(true, false, false, false); break;
}
//
// Rule 361: affinity ::= continue
//
case 361: { action. consumeToken(); break;
} }

View file

@ -24,6 +24,7 @@ import org.eclipse.cdt.core.dom.lrparser.lpgextensions.FixedBacktrackingParser;
import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap; import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap;
import org.eclipse.cdt.core.dom.lrparser.action.TokenMap; import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory; import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
@ -32,7 +33,6 @@ import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement; import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnarySizeofExpression; import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnarySizeofExpression;
import org.eclipse.cdt.core.dom.lrparser.lpgextensions.FixedBacktrackingParser; import org.eclipse.cdt.core.dom.lrparser.lpgextensions.FixedBacktrackingParser;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
public class UPCSizeofExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser public class UPCSizeofExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
{ {
@ -176,8 +176,9 @@ private UPCParserAction action;
public UPCSizeofExpressionParser() { // constructor public UPCSizeofExpressionParser() { // constructor
} }
private void initActions(IASTTranslationUnit tu) { private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new UPCParserAction ( UPCASTNodeFactory.DEFAULT_INSTANCE , this, tu); action = new UPCParserAction ( UPCASTNodeFactory.DEFAULT_INSTANCE , this, tu);
action.setParserOptions(options);
} }
@ -187,10 +188,10 @@ public void addToken(IToken token) {
} }
public IASTCompletionNode parse(IASTTranslationUnit tu) { public IASTCompletionNode parse(IASTTranslationUnit tu, Set<IParser.Options> options) {
// this has to be done, or... kaboom! // this has to be done, or... kaboom!
setStreamLength(getSize()); setStreamLength(getSize());
initActions(tu); initActions(tu, options);
final int errorRepairCount = -1; // -1 means full error handling final int errorRepairCount = -1; // -1 means full error handling
parser(null, errorRepairCount); // do the actual parse parser(null, errorRepairCount); // do the actual parse
@ -596,13 +597,13 @@ public UPCSizeofExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 101: labeled_statement ::= case constant_expression : // Rule 101: labeled_statement ::= case constant_expression : statement
// //
case 101: { action. consumeStatementCase(); break; case 101: { action. consumeStatementCase(); break;
} }
// //
// Rule 102: labeled_statement ::= default : // Rule 102: labeled_statement ::= default : statement
// //
case 102: { action. consumeStatementDefault(); break; case 102: { action. consumeStatementDefault(); break;
} }
@ -1160,363 +1161,381 @@ public UPCSizeofExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 278: initializer ::= { <openscope-ast> initializer_list comma_opt } // Rule 278: initializer ::= start_initializer_list { <openscope-ast> initializer_list comma_opt } end_initializer_list
// //
case 278: { action. consumeInitializerList(); break; case 278: { action. consumeInitializerList(); break;
} }
// //
// Rule 283: designated_initializer ::= <openscope-ast> designation = initializer // Rule 279: initializer ::= { <openscope-ast> }
// //
case 283: { action. consumeInitializerDesignated(); break; case 279: { action. consumeInitializerList(); break;
} }
// //
// Rule 287: designator_base ::= [ constant_expression ] // Rule 280: start_initializer_list ::= $Empty
// //
case 287: { action. consumeDesignatorArray(); break; case 280: { action. initializerListStart(); break;
} }
// //
// Rule 288: designator_base ::= . identifier_or_typedefname // Rule 281: end_initializer_list ::= $Empty
// //
case 288: { action. consumeDesignatorField(); break; case 281: { action. initializerListEnd(); break;
} }
// //
// Rule 289: designator ::= [ constant_expression ] // Rule 286: designated_initializer ::= <openscope-ast> designation = initializer
// //
case 289: { action. consumeDesignatorArray(); break; case 286: { action. consumeInitializerDesignated(); break;
} }
// //
// Rule 290: designator ::= . identifier_or_typedefname // Rule 290: designator_base ::= [ constant_expression ]
// //
case 290: { action. consumeDesignatorField(); break; case 290: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 291: translation_unit ::= external_declaration_list // Rule 291: designator_base ::= . identifier_or_typedefname
// //
case 291: { action. consumeTranslationUnit(); break; case 291: { action. consumeDesignatorField(); break;
} }
// //
// Rule 292: translation_unit ::= $Empty // Rule 292: designator ::= [ constant_expression ]
// //
case 292: { action. consumeTranslationUnit(); break; case 292: { action. consumeDesignatorArray(); break;
} }
// //
// Rule 297: external_declaration ::= ; // Rule 293: designator ::= . identifier_or_typedefname
// //
case 297: { action. consumeDeclarationEmpty(); break; case 293: { action. consumeDesignatorField(); break;
} }
// //
// Rule 298: external_declaration ::= ERROR_TOKEN // Rule 294: translation_unit ::= external_declaration_list
// //
case 298: { action. consumeDeclarationProblem(); break; case 294: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 301: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body // Rule 295: translation_unit ::= $Empty
// //
case 301: { action. consumeFunctionDefinition(true); break; case 295: { action. consumeTranslationUnit(); break;
} }
// //
// Rule 302: function_definition ::= <openscope-ast> function_declarator function_body // Rule 300: external_declaration ::= ;
// //
case 302: { action. consumeFunctionDefinition(false); break; case 300: { action. consumeDeclarationEmpty(); break;
} }
// //
// Rule 303: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement // Rule 301: external_declaration ::= ERROR_TOKEN
// //
case 303: { action. consumeFunctionDefinitionKnR(); break; case 301: { action. consumeDeclarationProblem(); break;
} }
// //
// Rule 304: function_body ::= { } // Rule 304: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body
// //
case 304: { action. consumeStatementCompoundStatement(false); break; case 304: { action. consumeFunctionDefinition(true); break;
} }
// //
// Rule 305: function_body ::= { <openscope-ast> block_item_list } // Rule 305: function_definition ::= <openscope-ast> function_declarator function_body
// //
case 305: { action. consumeStatementCompoundStatement(true); break; case 305: { action. consumeFunctionDefinition(false); break;
} }
// //
// Rule 307: no_sizeof_type_name_start ::= ERROR_TOKEN // Rule 306: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement
// //
case 307: { action. consumeExpressionProblem(); break; case 306: { action. consumeFunctionDefinitionKnR(); break;
} }
// //
// Rule 308: literal ::= MYTHREAD // Rule 307: function_body ::= { }
// //
case 308: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_mythread); break; case 307: { action. consumeStatementCompoundStatement(false); break;
} }
// //
// Rule 309: literal ::= THREADS // Rule 308: function_body ::= { <openscope-ast> block_item_list }
// //
case 309: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_threads); break; case 308: { action. consumeStatementCompoundStatement(true); break;
} }
// //
// Rule 310: literal ::= UPC_MAX_BLOCKSIZE // Rule 310: no_sizeof_type_name_start ::= ERROR_TOKEN
// //
case 310: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_upc_max_block_size); break; case 310: { action. consumeExpressionProblem(); break;
} }
// //
// Rule 311: unary_expression ::= upc_localsizeof unary_expression // Rule 311: literal ::= MYTHREAD
// //
case 311: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_localsizeof); break; case 311: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_mythread); break;
} }
// //
// Rule 312: unary_expression ::= upc_blocksizeof unary_expression // Rule 312: literal ::= THREADS
// //
case 312: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_blocksizeof); break; case 312: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_threads); break;
} }
// //
// Rule 313: unary_expression ::= upc_elemsizeof unary_expression // Rule 313: literal ::= UPC_MAX_BLOCKSIZE
// //
case 313: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_elemsizeof); break; case 313: { action. consumeKeywordExpression(IUPCASTKeywordExpression.kw_upc_max_block_size); break;
} }
// //
// Rule 317: shared_type_qualifier ::= shared // Rule 314: unary_expression ::= upc_localsizeof unary_expression
// //
case 317: { action. consumeToken(); break; case 314: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
} }
// //
// Rule 318: reference_type_qualifier ::= relaxed // Rule 315: unary_expression ::= upc_blocksizeof unary_expression
// //
case 318: { action. consumeToken(); break; case 315: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
} }
// //
// Rule 319: reference_type_qualifier ::= strict // Rule 316: unary_expression ::= upc_elemsizeof unary_expression
// //
case 319: { action. consumeToken(); break; case 316: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
} }
// //
// Rule 320: layout_qualifier ::= [ constant_expression ] // Rule 320: shared_type_qualifier ::= shared
// //
case 320: { action. consumeLayoutQualifier(true, false); break; case 320: { action. consumeToken(); break;
} }
// //
// Rule 321: layout_qualifier ::= [ * ] // Rule 321: reference_type_qualifier ::= relaxed
// //
case 321: { action. consumeLayoutQualifier(false, true); break; case 321: { action. consumeToken(); break;
} }
// //
// Rule 322: layout_qualifier ::= [ ] // Rule 322: reference_type_qualifier ::= strict
// //
case 322: { action. consumeLayoutQualifier(false, false); break; case 322: { action. consumeToken(); break;
} }
// //
// Rule 324: synchronization_statement ::= upc_notify expression ; // Rule 323: layout_qualifier ::= [ constant_expression ]
// //
case 324: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, true); break; case 323: { action. consumeLayoutQualifier(true, false); break;
} }
// //
// Rule 325: synchronization_statement ::= upc_notify ; // Rule 324: layout_qualifier ::= [ * ]
// //
case 325: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, false); break; case 324: { action. consumeLayoutQualifier(false, true); break;
} }
// //
// Rule 326: synchronization_statement ::= upc_wait expression ; // Rule 325: layout_qualifier ::= [ ]
// //
case 326: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, true); break; case 325: { action. consumeLayoutQualifier(false, false); break;
} }
// //
// Rule 327: synchronization_statement ::= upc_wait ; // Rule 327: synchronization_statement ::= upc_notify expression ;
// //
case 327: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, false); break; case 327: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, true); break;
} }
// //
// Rule 328: synchronization_statement ::= upc_barrier expression ; // Rule 328: synchronization_statement ::= upc_notify ;
// //
case 328: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, true); break; case 328: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, false); break;
} }
// //
// Rule 329: synchronization_statement ::= upc_barrier ; // Rule 329: synchronization_statement ::= upc_wait expression ;
// //
case 329: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, false); break; case 329: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, true); break;
} }
// //
// Rule 330: synchronization_statement ::= upc_fence ; // Rule 330: synchronization_statement ::= upc_wait ;
// //
case 330: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_fence, false); break; case 330: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, false); break;
} }
// //
// Rule 331: iteration_statement ::= upc_forall ( expression ; expression ; expression ; affinity ) statement // Rule 331: synchronization_statement ::= upc_barrier expression ;
// //
case 331: { action. consumeStatementUPCForallLoop(true, true, true, true); break; case 331: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, true); break;
} }
// //
// Rule 332: iteration_statement ::= upc_forall ( expression ; expression ; expression ; ) statement // Rule 332: synchronization_statement ::= upc_barrier ;
// //
case 332: { action. consumeStatementUPCForallLoop(true, true, true, false); break; case 332: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, false); break;
} }
// //
// Rule 333: iteration_statement ::= upc_forall ( expression ; expression ; ; affinity ) statement // Rule 333: synchronization_statement ::= upc_fence ;
// //
case 333: { action. consumeStatementUPCForallLoop(true, true, false, true); break; case 333: { action. consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_fence, false); break;
} }
// //
// Rule 334: iteration_statement ::= upc_forall ( expression ; expression ; ; ) statement // Rule 334: iteration_statement ::= upc_forall ( expression ; expression ; expression ; affinity ) statement
// //
case 334: { action. consumeStatementUPCForallLoop(true, true, false, false); break; case 334: { action. consumeStatementUPCForallLoop(true, true, true, true); break;
} }
// //
// Rule 335: iteration_statement ::= upc_forall ( expression ; ; expression ; affinity ) statement // Rule 335: iteration_statement ::= upc_forall ( expression ; expression ; expression ; ) statement
// //
case 335: { action. consumeStatementUPCForallLoop(true, false, true, true); break; case 335: { action. consumeStatementUPCForallLoop(true, true, true, false); break;
} }
// //
// Rule 336: iteration_statement ::= upc_forall ( expression ; ; expression ; ) statement // Rule 336: iteration_statement ::= upc_forall ( expression ; expression ; ; affinity ) statement
// //
case 336: { action. consumeStatementUPCForallLoop(true, false, true, false); break; case 336: { action. consumeStatementUPCForallLoop(true, true, false, true); break;
} }
// //
// Rule 337: iteration_statement ::= upc_forall ( expression ; ; ; affinity ) statement // Rule 337: iteration_statement ::= upc_forall ( expression ; expression ; ; ) statement
// //
case 337: { action. consumeStatementUPCForallLoop(true, false, false, true); break; case 337: { action. consumeStatementUPCForallLoop(true, true, false, false); break;
} }
// //
// Rule 338: iteration_statement ::= upc_forall ( expression ; ; ; ) statement // Rule 338: iteration_statement ::= upc_forall ( expression ; ; expression ; affinity ) statement
// //
case 338: { action. consumeStatementUPCForallLoop(true, false, false, false); break; case 338: { action. consumeStatementUPCForallLoop(true, false, true, true); break;
} }
// //
// Rule 339: iteration_statement ::= upc_forall ( ; expression ; expression ; affinity ) statement // Rule 339: iteration_statement ::= upc_forall ( expression ; ; expression ; ) statement
// //
case 339: { action. consumeStatementUPCForallLoop(false, true, true, true); break; case 339: { action. consumeStatementUPCForallLoop(true, false, true, false); break;
} }
// //
// Rule 340: iteration_statement ::= upc_forall ( ; expression ; expression ; ) statement // Rule 340: iteration_statement ::= upc_forall ( expression ; ; ; affinity ) statement
// //
case 340: { action. consumeStatementUPCForallLoop(false, true, true, false); break; case 340: { action. consumeStatementUPCForallLoop(true, false, false, true); break;
} }
// //
// Rule 341: iteration_statement ::= upc_forall ( ; expression ; ; affinity ) statement // Rule 341: iteration_statement ::= upc_forall ( expression ; ; ; ) statement
// //
case 341: { action. consumeStatementUPCForallLoop(false, true, false, true); break; case 341: { action. consumeStatementUPCForallLoop(true, false, false, false); break;
} }
// //
// Rule 342: iteration_statement ::= upc_forall ( ; expression ; ; ) statement // Rule 342: iteration_statement ::= upc_forall ( ; expression ; expression ; affinity ) statement
// //
case 342: { action. consumeStatementUPCForallLoop(false, true, false, false); break; case 342: { action. consumeStatementUPCForallLoop(false, true, true, true); break;
} }
// //
// Rule 343: iteration_statement ::= upc_forall ( ; ; expression ; affinity ) statement // Rule 343: iteration_statement ::= upc_forall ( ; expression ; expression ; ) statement
// //
case 343: { action. consumeStatementUPCForallLoop(false, false, true, true); break; case 343: { action. consumeStatementUPCForallLoop(false, true, true, false); break;
} }
// //
// Rule 344: iteration_statement ::= upc_forall ( ; ; expression ; ) statement // Rule 344: iteration_statement ::= upc_forall ( ; expression ; ; affinity ) statement
// //
case 344: { action. consumeStatementUPCForallLoop(false, false, true, false); break; case 344: { action. consumeStatementUPCForallLoop(false, true, false, true); break;
} }
// //
// Rule 345: iteration_statement ::= upc_forall ( ; ; ; affinity ) statement // Rule 345: iteration_statement ::= upc_forall ( ; expression ; ; ) statement
// //
case 345: { action. consumeStatementUPCForallLoop(false, false, false, true); break; case 345: { action. consumeStatementUPCForallLoop(false, true, false, false); break;
} }
// //
// Rule 346: iteration_statement ::= upc_forall ( ; ; ; ) statement // Rule 346: iteration_statement ::= upc_forall ( ; ; expression ; affinity ) statement
// //
case 346: { action. consumeStatementUPCForallLoop(false, false, false, false); break; case 346: { action. consumeStatementUPCForallLoop(false, false, true, true); break;
} }
// //
// Rule 347: iteration_statement ::= upc_forall ( declaration expression ; expression ; affinity ) statement // Rule 347: iteration_statement ::= upc_forall ( ; ; expression ; ) statement
// //
case 347: { action. consumeStatementUPCForallLoop(true, true, true, true); break; case 347: { action. consumeStatementUPCForallLoop(false, false, true, false); break;
} }
// //
// Rule 348: iteration_statement ::= upc_forall ( declaration expression ; expression ; ) statement // Rule 348: iteration_statement ::= upc_forall ( ; ; ; affinity ) statement
// //
case 348: { action. consumeStatementUPCForallLoop(true, true, true, false); break; case 348: { action. consumeStatementUPCForallLoop(false, false, false, true); break;
} }
// //
// Rule 349: iteration_statement ::= upc_forall ( declaration expression ; ; affinity ) statement // Rule 349: iteration_statement ::= upc_forall ( ; ; ; ) statement
// //
case 349: { action. consumeStatementUPCForallLoop(true, true, false, true); break; case 349: { action. consumeStatementUPCForallLoop(false, false, false, false); break;
} }
// //
// Rule 350: iteration_statement ::= upc_forall ( declaration expression ; ; ) statement // Rule 350: iteration_statement ::= upc_forall ( declaration expression ; expression ; affinity ) statement
// //
case 350: { action. consumeStatementUPCForallLoop(true, true, false, false); break; case 350: { action. consumeStatementUPCForallLoop(true, true, true, true); break;
} }
// //
// Rule 351: iteration_statement ::= upc_forall ( declaration ; expression ; affinity ) statement // Rule 351: iteration_statement ::= upc_forall ( declaration expression ; expression ; ) statement
// //
case 351: { action. consumeStatementUPCForallLoop(true, false, true, true); break; case 351: { action. consumeStatementUPCForallLoop(true, true, true, false); break;
} }
// //
// Rule 352: iteration_statement ::= upc_forall ( declaration ; expression ; ) statement // Rule 352: iteration_statement ::= upc_forall ( declaration expression ; ; affinity ) statement
// //
case 352: { action. consumeStatementUPCForallLoop(true, false, true, false); break; case 352: { action. consumeStatementUPCForallLoop(true, true, false, true); break;
} }
// //
// Rule 353: iteration_statement ::= upc_forall ( declaration ; ; affinity ) statement // Rule 353: iteration_statement ::= upc_forall ( declaration expression ; ; ) statement
// //
case 353: { action. consumeStatementUPCForallLoop(true, false, false, true); break; case 353: { action. consumeStatementUPCForallLoop(true, true, false, false); break;
} }
// //
// Rule 354: iteration_statement ::= upc_forall ( declaration ; ; ) statement // Rule 354: iteration_statement ::= upc_forall ( declaration ; expression ; affinity ) statement
// //
case 354: { action. consumeStatementUPCForallLoop(true, false, false, false); break; case 354: { action. consumeStatementUPCForallLoop(true, false, true, true); break;
} }
// //
// Rule 356: affinity ::= continue // Rule 355: iteration_statement ::= upc_forall ( declaration ; expression ; ) statement
// //
case 356: { action. consumeToken(); break; case 355: { action. consumeStatementUPCForallLoop(true, false, true, false); break;
}
//
// Rule 356: iteration_statement ::= upc_forall ( declaration ; ; affinity ) statement
//
case 356: { action. consumeStatementUPCForallLoop(true, false, false, true); break;
}
//
// Rule 357: iteration_statement ::= upc_forall ( declaration ; ; ) statement
//
case 357: { action. consumeStatementUPCForallLoop(true, false, false, false); break;
}
//
// Rule 359: affinity ::= continue
//
case 359: { action. consumeToken(); break;
} }

View file

@ -15,7 +15,7 @@ package org.eclipse.cdt.internal.core.dom.parser.upc;
public interface UPCSizeofExpressionParsersym { public interface UPCSizeofExpressionParsersym {
public final static int public final static int
TK_auto = 17, TK_auto = 19,
TK_break = 90, TK_break = 90,
TK_case = 91, TK_case = 91,
TK_char = 38, TK_char = 38,
@ -25,26 +25,26 @@ public interface UPCSizeofExpressionParsersym {
TK_do = 94, TK_do = 94,
TK_double = 39, TK_double = 39,
TK_else = 95, TK_else = 95,
TK_enum = 51, TK_enum = 52,
TK_extern = 18, TK_extern = 20,
TK_float = 40, TK_float = 40,
TK_for = 96, TK_for = 96,
TK_goto = 97, TK_goto = 97,
TK_if = 98, TK_if = 98,
TK_inline = 19, TK_inline = 21,
TK_int = 41, TK_int = 41,
TK_long = 42, TK_long = 42,
TK_register = 20, TK_register = 22,
TK_restrict = 7, TK_restrict = 7,
TK_return = 99, TK_return = 99,
TK_short = 43, TK_short = 43,
TK_signed = 44, TK_signed = 44,
TK_sizeof = 24, TK_sizeof = 23,
TK_static = 12, TK_static = 14,
TK_struct = 52, TK_struct = 53,
TK_switch = 100, TK_switch = 100,
TK_typedef = 21, TK_typedef = 24,
TK_union = 53, TK_union = 54,
TK_unsigned = 45, TK_unsigned = 45,
TK_void = 46, TK_void = 46,
TK_volatile = 8, TK_volatile = 8,
@ -60,17 +60,17 @@ public interface UPCSizeofExpressionParsersym {
TK_Completion = 3, TK_Completion = 3,
TK_EndOfCompletion = 5, TK_EndOfCompletion = 5,
TK_Invalid = 102, TK_Invalid = 102,
TK_LeftBracket = 13, TK_LeftBracket = 15,
TK_LeftParen = 2, TK_LeftParen = 2,
TK_LeftBrace = 37, TK_LeftBrace = 37,
TK_Dot = 61, TK_Dot = 61,
TK_Arrow = 76, TK_Arrow = 76,
TK_PlusPlus = 22, TK_PlusPlus = 17,
TK_MinusMinus = 23, TK_MinusMinus = 18,
TK_And = 16, TK_And = 16,
TK_Star = 4, TK_Star = 4,
TK_Plus = 14, TK_Plus = 12,
TK_Minus = 15, TK_Minus = 13,
TK_Tilde = 29, TK_Tilde = 29,
TK_Bang = 30, TK_Bang = 30,
TK_Slash = 62, TK_Slash = 62,
@ -101,10 +101,10 @@ public interface UPCSizeofExpressionParsersym {
TK_AndAssign = 86, TK_AndAssign = 86,
TK_CaretAssign = 87, TK_CaretAssign = 87,
TK_OrAssign = 88, TK_OrAssign = 88,
TK_Comma = 54, TK_Comma = 55,
TK_RightBracket = 59, TK_RightBracket = 59,
TK_RightParen = 50, TK_RightParen = 50,
TK_RightBrace = 55, TK_RightBrace = 51,
TK_SemiColon = 75, TK_SemiColon = 75,
TK_MYTHREAD = 31, TK_MYTHREAD = 31,
TK_THREADS = 32, TK_THREADS = 32,
@ -136,19 +136,19 @@ public interface UPCSizeofExpressionParsersym {
"relaxed", "relaxed",
"shared", "shared",
"strict", "strict",
"static",
"LeftBracket",
"Plus", "Plus",
"Minus", "Minus",
"static",
"LeftBracket",
"And", "And",
"PlusPlus",
"MinusMinus",
"auto", "auto",
"extern", "extern",
"inline", "inline",
"register", "register",
"typedef",
"PlusPlus",
"MinusMinus",
"sizeof", "sizeof",
"typedef",
"integer", "integer",
"floating", "floating",
"charconst", "charconst",
@ -175,11 +175,11 @@ public interface UPCSizeofExpressionParsersym {
"_Complex", "_Complex",
"_Imaginary", "_Imaginary",
"RightParen", "RightParen",
"RightBrace",
"enum", "enum",
"struct", "struct",
"union", "union",
"Comma", "Comma",
"RightBrace",
"ERROR_TOKEN", "ERROR_TOKEN",
"RightShift", "RightShift",
"LeftShift", "LeftShift",