| /* |
| * generated by Xtext |
| */ |
| grammar InternalGolang; |
| |
| options { |
| superClass=AbstractInternalAntlrParser; |
| |
| } |
| |
| @lexer::header { |
| package me.dollyn.goide.parser.antlr.internal; |
| |
| // Hack: Use our own Lexer superclass by means of import. |
| // Currently there is no other way to specify the superclass for the lexer. |
| import org.eclipse.xtext.parser.antlr.Lexer; |
| } |
| |
| @parser::header { |
| package me.dollyn.goide.parser.antlr.internal; |
| |
| import org.eclipse.xtext.*; |
| import org.eclipse.xtext.parser.*; |
| import org.eclipse.xtext.parser.impl.*; |
| import org.eclipse.emf.ecore.util.EcoreUtil; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser; |
| import org.eclipse.xtext.parser.antlr.XtextTokenStream; |
| import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens; |
| import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken; |
| import me.dollyn.goide.services.GolangGrammarAccess; |
| |
| } |
| |
| @parser::members { |
| |
| private GolangGrammarAccess grammarAccess; |
| |
| public InternalGolangParser(TokenStream input, GolangGrammarAccess grammarAccess) { |
| this(input); |
| this.grammarAccess = grammarAccess; |
| registerRules(grammarAccess.getGrammar()); |
| } |
| |
| @Override |
| protected String getFirstRuleName() { |
| return "GoModel"; |
| } |
| |
| @Override |
| protected GolangGrammarAccess getGrammarAccess() { |
| return grammarAccess; |
| } |
| } |
| |
| @rulecatch { |
| catch (RecognitionException re) { |
| recover(input,re); |
| appendSkippedTokens(); |
| } |
| } |
| |
| |
| |
| |
| // Entry rule entryRuleGoModel |
| entryRuleGoModel returns [EObject current=null] |
| : |
| { newCompositeNode(grammarAccess.getGoModelRule()); } |
| iv_ruleGoModel=ruleGoModel |
| { $current=$iv_ruleGoModel.current; } |
| EOF |
| ; |
| |
| // Rule GoModel |
| ruleGoModel returns [EObject current=null] |
| @init { enterRule(); |
| } |
| @after { leaveRule(); }: |
| (( |
| ( |
| lv_package_0_0=RULE_ID |
| { |
| newLeafNode(lv_package_0_0, grammarAccess.getGoModelAccess().getPackageIDTerminalRuleCall_0_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getGoModelRule()); |
| } |
| setWithLastConsumed( |
| $current, |
| "package", |
| lv_package_0_0, |
| "ID"); |
| } |
| |
| ) |
| )( |
| ( |
| { |
| newCompositeNode(grammarAccess.getGoModelAccess().getImportsImportParserRuleCall_1_0()); |
| } |
| lv_imports_1_0=ruleImport { |
| if ($current==null) { |
| $current = createModelElementForParent(grammarAccess.getGoModelRule()); |
| } |
| add( |
| $current, |
| "imports", |
| lv_imports_1_0, |
| "Import"); |
| afterParserOrEnumRuleCall(); |
| } |
| |
| ) |
| )*) |
| ; |
| |
| |
| |
| |
| |
| |
| |
| // Entry rule entryRuleImport |
| entryRuleImport returns [EObject current=null] |
| : |
| { newCompositeNode(grammarAccess.getImportRule()); } |
| iv_ruleImport=ruleImport |
| { $current=$iv_ruleImport.current; } |
| EOF |
| ; |
| |
| // Rule Import |
| ruleImport returns [EObject current=null] |
| @init { enterRule(); |
| } |
| @after { leaveRule(); }: |
| ( otherlv_0='import' |
| { |
| newLeafNode(otherlv_0, grammarAccess.getImportAccess().getImportKeyword_0()); |
| } |
| ( |
| ( |
| lv_package_1_0=RULE_STRING |
| { |
| newLeafNode(lv_package_1_0, grammarAccess.getImportAccess().getPackageSTRINGTerminalRuleCall_1_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getImportRule()); |
| } |
| setWithLastConsumed( |
| $current, |
| "package", |
| lv_package_1_0, |
| "STRING"); |
| } |
| |
| ) |
| )) |
| ; |
| |
| |
| |
| |
| |
| RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; |
| |
| RULE_INT : ('0'..'9')+; |
| |
| RULE_STRING : ('"' ('\\' ('b'|'t'|'n'|'f'|'r'|'u'|'"'|'\''|'\\')|~(('\\'|'"')))* '"'|'\'' ('\\' ('b'|'t'|'n'|'f'|'r'|'u'|'"'|'\''|'\\')|~(('\\'|'\'')))* '\''); |
| |
| RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )*'*/'; |
| |
| RULE_SL_COMMENT : '//' ~(('\n'|'\r'))* ('\r'? '\n')?; |
| |
| RULE_WS : (' '|'\t'|'\r'|'\n')+; |
| |
| RULE_ANY_OTHER : .; |
| |
| |