/*
* generated by Xtext
*/
package urban.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 urban.services.UrbanGrammarAccess;
public class UrbanParser extends org.eclipse.xtext.parser.antlr.AbstractAntlrParser {
@Inject
private UrbanGrammarAccess grammarAccess;
@Override
protected IParseResult parse(String ruleName, CharStream in) {
TokenSource tokenSource = createLexer(in);
XtextTokenStream tokenStream = createTokenStream(tokenSource);
tokenStream.setInitialHiddenTokens("RULE_WS");
urban.parser.antlr.internal.InternalUrbanParser 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 urban.parser.antlr.internal.InternalUrbanParser createParser(XtextTokenStream stream) {
return new urban.parser.antlr.internal.InternalUrbanParser(stream, getElementFactory(), getGrammarAccess());
}
@Override
protected String getDefaultRuleName() {
return "Model";
}
public UrbanGrammarAccess getGrammarAccess() {
return this.grammarAccess;
}
public void setGrammarAccess(UrbanGrammarAccess grammarAccess) {
this.grammarAccess = grammarAccess;
}
}