/* * generated by Xtext */ package org.eclipse.amalgam.tutorials.xtext.parser.antlr; import org.antlr.runtime.CharStream; import org.antlr.runtime.TokenSource; import org.eclipse.xtext.parser.IParseResult; import org.eclipse.xtext.parser.ParseException; import org.eclipse.xtext.parser.antlr.XtextTokenStream; import com.google.inject.Inject; import org.eclipse.amalgam.tutorials.xtext.services.DroidGrammarAccess; public class DroidParser extends org.eclipse.xtext.parser.antlr.AbstractAntlrParser { @Inject private DroidGrammarAccess grammarAccess; @Override protected IParseResult parse(String ruleName, CharStream in) { TokenSource tokenSource = createLexer(in); XtextTokenStream tokenStream = createTokenStream(tokenSource); tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT"); org.eclipse.amalgam.tutorials.xtext.parser.antlr.internal.InternalDroidParser parser = createParser(tokenStream); parser.setTokenTypeMap(getTokenDefProvider().getTokenDefMap()); parser.setSyntaxErrorProvider(getSyntaxErrorProvider()); parser.setUnorderedGroupHelper(getUnorderedGroupHelper().get()); try { if(ruleName != null) return parser.parse(ruleName); return parser.parse(); } catch (Exception re) { throw new ParseException(re.getMessage(),re); } } protected org.eclipse.amalgam.tutorials.xtext.parser.antlr.internal.InternalDroidParser createParser(XtextTokenStream stream) { return new org.eclipse.amalgam.tutorials.xtext.parser.antlr.internal.InternalDroidParser(stream, getElementFactory(), getGrammarAccess()); } @Override protected String getDefaultRuleName() { return "Application"; } public DroidGrammarAccess getGrammarAccess() { return this.grammarAccess; } public void setGrammarAccess(DroidGrammarAccess grammarAccess) { this.grammarAccess = grammarAccess; } }