/*
* generated by Xtext
*/
package jp.ac.jaist.kslab.e4.dsl.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 jp.ac.jaist.kslab.e4.dsl.services.E4DslGrammarAccess;

public class E4DslParser extends org.eclipse.xtext.parser.antlr.AbstractAntlrParser {
	
	@Inject
	private E4DslGrammarAccess 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");
		jp.ac.jaist.kslab.e4.dsl.parser.antlr.internal.InternalE4DslParser 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 jp.ac.jaist.kslab.e4.dsl.parser.antlr.internal.InternalE4DslParser createParser(XtextTokenStream stream) {
		return new jp.ac.jaist.kslab.e4.dsl.parser.antlr.internal.InternalE4DslParser(stream, getElementFactory(), getGrammarAccess());
	}
	
	@Override 
	protected String getDefaultRuleName() {
		return "Application";
	}
	
	public E4DslGrammarAccess getGrammarAccess() {
		return this.grammarAccess;
	}
	
	public void setGrammarAccess(E4DslGrammarAccess grammarAccess) {
		this.grammarAccess = grammarAccess;
	}
	
}
