/*
* generated by Xtext
*/
package de.ugoe.cs.swe.bnftools.ui.contentassist.antlr;

import java.util.Collection;
import java.util.Map;
import java.util.HashMap;

import org.antlr.runtime.RecognitionException;
import org.eclipse.xtext.AbstractElement;
import org.eclipse.xtext.ui.editor.contentassist.antlr.AbstractContentAssistParser;
import org.eclipse.xtext.ui.editor.contentassist.antlr.FollowElement;
import org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;

import com.google.inject.Inject;

import de.ugoe.cs.swe.bnftools.services.EbnfGrammarAccess;

public class EbnfParser extends AbstractContentAssistParser {
	
	@Inject
	private EbnfGrammarAccess grammarAccess;
	
	private Map<AbstractElement, String> nameMappings;
	
	@Override
	protected de.ugoe.cs.swe.bnftools.ui.contentassist.antlr.internal.InternalEbnfParser createParser() {
		de.ugoe.cs.swe.bnftools.ui.contentassist.antlr.internal.InternalEbnfParser result = new de.ugoe.cs.swe.bnftools.ui.contentassist.antlr.internal.InternalEbnfParser(null);
		result.setGrammarAccess(grammarAccess);
		return result;
	}
	
	@Override
	protected String getRuleName(AbstractElement element) {
		if (nameMappings == null) {
			nameMappings = new HashMap<AbstractElement, String>() {
				private static final long serialVersionUID = 1L;
				{
					put(grammarAccess.getEtsiBnfAccess().getAlternatives(), "rule__EtsiBnf__Alternatives");
					put(grammarAccess.getBnfEntryAccess().getAlternatives(), "rule__BnfEntry__Alternatives");
					put(grammarAccess.getDeltaEntryAccess().getAlternatives(), "rule__DeltaEntry__Alternatives");
					put(grammarAccess.getMergeEntryAccess().getAlternatives(), "rule__MergeEntry__Alternatives");
					put(grammarAccess.getImportAccess().getAlternatives_2_1(), "rule__Import__Alternatives_2_1");
					put(grammarAccess.getExtRuleAccess().getAlternatives_4(), "rule__ExtRule__Alternatives_4");
					put(grammarAccess.getMergeRuleAccess().getAlternatives(), "rule__MergeRule__Alternatives");
					put(grammarAccess.getTermAccess().getAlternatives(), "rule__Term__Alternatives");
					put(grammarAccess.getAtomAccess().getAlternatives(), "rule__Atom__Alternatives");
					put(grammarAccess.getStringRuleAccess().getAlternatives(), "rule__StringRule__Alternatives");
					put(grammarAccess.getEtsiBnfAccess().getGroup_0(), "rule__EtsiBnf__Group_0__0");
					put(grammarAccess.getEtsiBnfAccess().getGroup_0_2(), "rule__EtsiBnf__Group_0_2__0");
					put(grammarAccess.getEtsiBnfAccess().getGroup_1(), "rule__EtsiBnf__Group_1__0");
					put(grammarAccess.getEtsiBnfAccess().getGroup_2(), "rule__EtsiBnf__Group_2__0");
					put(grammarAccess.getSectionHeadingAccess().getGroup(), "rule__SectionHeading__Group__0");
					put(grammarAccess.getImportAccess().getGroup(), "rule__Import__Group__0");
					put(grammarAccess.getImportAccess().getGroup_2(), "rule__Import__Group_2__0");
					put(grammarAccess.getImportAccess().getGroup_3(), "rule__Import__Group_3__0");
					put(grammarAccess.getRuleAccess().getGroup(), "rule__Rule__Group__0");
					put(grammarAccess.getRuleAccess().getGroup_0(), "rule__Rule__Group_0__0");
					put(grammarAccess.getExtRuleAccess().getGroup(), "rule__ExtRule__Group__0");
					put(grammarAccess.getExtRuleAccess().getGroup_0(), "rule__ExtRule__Group_0__0");
					put(grammarAccess.getExtRuleAccess().getGroup_2(), "rule__ExtRule__Group_2__0");
					put(grammarAccess.getGlobalCombinatorAccess().getGroup(), "rule__GlobalCombinator__Group__0");
					put(grammarAccess.getGlobalCombinatorAccess().getGroup_0(), "rule__GlobalCombinator__Group_0__0");
					put(grammarAccess.getRuleCombinatorAccess().getGroup(), "rule__RuleCombinator__Group__0");
					put(grammarAccess.getRuleCombinatorAccess().getGroup_0(), "rule__RuleCombinator__Group_0__0");
					put(grammarAccess.getRuleCombinatorAccess().getGroup_2(), "rule__RuleCombinator__Group_2__0");
					put(grammarAccess.getHookCombinatorAccess().getGroup(), "rule__HookCombinator__Group__0");
					put(grammarAccess.getHookCombinatorAccess().getGroup_7(), "rule__HookCombinator__Group_7__0");
					put(grammarAccess.getDefinitionListAccess().getGroup(), "rule__DefinitionList__Group__0");
					put(grammarAccess.getDefinitionListAccess().getGroup_1(), "rule__DefinitionList__Group_1__0");
					put(grammarAccess.getGroupedSequenceAccess().getGroup(), "rule__GroupedSequence__Group__0");
					put(grammarAccess.getOptionalSequenceAccess().getGroup(), "rule__OptionalSequence__Group__0");
					put(grammarAccess.getRepeatedSequenceAccess().getGroup(), "rule__RepeatedSequence__Group__0");
					put(grammarAccess.getEtsiBnfAccess().getNameAssignment_0_1(), "rule__EtsiBnf__NameAssignment_0_1");
					put(grammarAccess.getEtsiBnfAccess().getTypeAssignment_0_2_0(), "rule__EtsiBnf__TypeAssignment_0_2_0");
					put(grammarAccess.getEtsiBnfAccess().getImportSectionAssignment_0_2_2(), "rule__EtsiBnf__ImportSectionAssignment_0_2_2");
					put(grammarAccess.getEtsiBnfAccess().getBnfEntryAssignment_0_2_3(), "rule__EtsiBnf__BnfEntryAssignment_0_2_3");
					put(grammarAccess.getEtsiBnfAccess().getTypeAssignment_1_0(), "rule__EtsiBnf__TypeAssignment_1_0");
					put(grammarAccess.getEtsiBnfAccess().getImportSectionAssignment_1_2(), "rule__EtsiBnf__ImportSectionAssignment_1_2");
					put(grammarAccess.getEtsiBnfAccess().getDeltaEntryAssignment_1_3(), "rule__EtsiBnf__DeltaEntryAssignment_1_3");
					put(grammarAccess.getEtsiBnfAccess().getTypeAssignment_2_0(), "rule__EtsiBnf__TypeAssignment_2_0");
					put(grammarAccess.getEtsiBnfAccess().getImportSectionAssignment_2_2(), "rule__EtsiBnf__ImportSectionAssignment_2_2");
					put(grammarAccess.getEtsiBnfAccess().getMergeEntryAssignment_2_3(), "rule__EtsiBnf__MergeEntryAssignment_2_3");
					put(grammarAccess.getImportSectionAccess().getImportsAssignment(), "rule__ImportSection__ImportsAssignment");
					put(grammarAccess.getBnfEntryAccess().getSectionheaderAssignment_0(), "rule__BnfEntry__SectionheaderAssignment_0");
					put(grammarAccess.getBnfEntryAccess().getRuleAssignment_1(), "rule__BnfEntry__RuleAssignment_1");
					put(grammarAccess.getDeltaEntryAccess().getRuleAssignment_0(), "rule__DeltaEntry__RuleAssignment_0");
					put(grammarAccess.getDeltaEntryAccess().getSectionheaderAssignment_1(), "rule__DeltaEntry__SectionheaderAssignment_1");
					put(grammarAccess.getDeltaEntryAccess().getExtRuleAssignment_2(), "rule__DeltaEntry__ExtRuleAssignment_2");
					put(grammarAccess.getMergeEntryAccess().getSectionheaderAssignment_0(), "rule__MergeEntry__SectionheaderAssignment_0");
					put(grammarAccess.getMergeEntryAccess().getMergeRuleAssignment_1(), "rule__MergeEntry__MergeRuleAssignment_1");
					put(grammarAccess.getSectionHeadingAccess().getSectionHeaderAssignment_1(), "rule__SectionHeading__SectionHeaderAssignment_1");
					put(grammarAccess.getImportAccess().getImportURIAssignment_1(), "rule__Import__ImportURIAssignment_1");
					put(grammarAccess.getImportAccess().getGrammarTypeAssignment_2_1_0(), "rule__Import__GrammarTypeAssignment_2_1_0");
					put(grammarAccess.getImportAccess().getGrammarTypeAssignment_2_1_1(), "rule__Import__GrammarTypeAssignment_2_1_1");
					put(grammarAccess.getImportAccess().getGrammarTypeAssignment_2_1_2(), "rule__Import__GrammarTypeAssignment_2_1_2");
					put(grammarAccess.getImportAccess().getLabelAssignment_3_1(), "rule__Import__LabelAssignment_3_1");
					put(grammarAccess.getRuleAccess().getRulenumberAssignment_0_0(), "rule__Rule__RulenumberAssignment_0_0");
					put(grammarAccess.getRuleAccess().getRulevariantAssignment_0_1(), "rule__Rule__RulevariantAssignment_0_1");
					put(grammarAccess.getRuleAccess().getNameAssignment_1(), "rule__Rule__NameAssignment_1");
					put(grammarAccess.getRuleAccess().getDefinitionListAssignment_3(), "rule__Rule__DefinitionListAssignment_3");
					put(grammarAccess.getExtRuleAccess().getRulenumberAssignment_0_0(), "rule__ExtRule__RulenumberAssignment_0_0");
					put(grammarAccess.getExtRuleAccess().getRulevariantAssignment_0_1(), "rule__ExtRule__RulevariantAssignment_0_1");
					put(grammarAccess.getExtRuleAccess().getNameAssignment_1(), "rule__ExtRule__NameAssignment_1");
					put(grammarAccess.getExtRuleAccess().getRuleextAssignment_2_1(), "rule__ExtRule__RuleextAssignment_2_1");
					put(grammarAccess.getExtRuleAccess().getElementsAssignment_4_0(), "rule__ExtRule__ElementsAssignment_4_0");
					put(grammarAccess.getGlobalCombinatorAccess().getLogicAssignment_1(), "rule__GlobalCombinator__LogicAssignment_1");
					put(grammarAccess.getRuleCombinatorAccess().getNameAssignment_0_2(), "rule__RuleCombinator__NameAssignment_0_2");
					put(grammarAccess.getRuleCombinatorAccess().getLogicAssignment_1(), "rule__RuleCombinator__LogicAssignment_1");
					put(grammarAccess.getRuleCombinatorAccess().getLABELAssignment_2_1(), "rule__RuleCombinator__LABELAssignment_2_1");
					put(grammarAccess.getHookCombinatorAccess().getNameAssignment_2(), "rule__HookCombinator__NameAssignment_2");
					put(grammarAccess.getHookCombinatorAccess().getRuleextAssignment_4(), "rule__HookCombinator__RuleextAssignment_4");
					put(grammarAccess.getHookCombinatorAccess().getLogicAssignment_6(), "rule__HookCombinator__LogicAssignment_6");
					put(grammarAccess.getHookCombinatorAccess().getLABELAssignment_7_1(), "rule__HookCombinator__LABELAssignment_7_1");
					put(grammarAccess.getDefinitionListAccess().getSingleDefinitionAssignment_0(), "rule__DefinitionList__SingleDefinitionAssignment_0");
					put(grammarAccess.getDefinitionListAccess().getSingleDefinitionAssignment_1_1(), "rule__DefinitionList__SingleDefinitionAssignment_1_1");
					put(grammarAccess.getSingleDefinitionAccess().getTermsAssignment(), "rule__SingleDefinition__TermsAssignment");
					put(grammarAccess.getTermAccess().getTermAtomAssignment_0(), "rule__Term__TermAtomAssignment_0");
					put(grammarAccess.getTermAccess().getTermGroupedSequenceAssignment_1(), "rule__Term__TermGroupedSequenceAssignment_1");
					put(grammarAccess.getTermAccess().getTermOptionalSequenceAssignment_2(), "rule__Term__TermOptionalSequenceAssignment_2");
					put(grammarAccess.getTermAccess().getTermRepeatedSequenceAssignment_3(), "rule__Term__TermRepeatedSequenceAssignment_3");
					put(grammarAccess.getAtomAccess().getAtomStringRuleAssignment_0(), "rule__Atom__AtomStringRuleAssignment_0");
					put(grammarAccess.getAtomAccess().getAtomRuleReferenceAssignment_1(), "rule__Atom__AtomRuleReferenceAssignment_1");
					put(grammarAccess.getRuleReferenceAccess().getRulerefAssignment(), "rule__RuleReference__RulerefAssignment");
					put(grammarAccess.getStringRuleAccess().getLiteralAssignment_0(), "rule__StringRule__LiteralAssignment_0");
					put(grammarAccess.getStringRuleAccess().getColonAssignment_1(), "rule__StringRule__ColonAssignment_1");
					put(grammarAccess.getGroupedSequenceAccess().getDefinitionListAssignment_1(), "rule__GroupedSequence__DefinitionListAssignment_1");
					put(grammarAccess.getOptionalSequenceAccess().getDefinitionListAssignment_1(), "rule__OptionalSequence__DefinitionListAssignment_1");
					put(grammarAccess.getRepeatedSequenceAccess().getDefinitionsAssignment_1(), "rule__RepeatedSequence__DefinitionsAssignment_1");
					put(grammarAccess.getRepeatedSequenceAccess().getMorethanonceAssignment_3(), "rule__RepeatedSequence__MorethanonceAssignment_3");
				}
			};
		}
		return nameMappings.get(element);
	}
	
	@Override
	protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
		try {
			de.ugoe.cs.swe.bnftools.ui.contentassist.antlr.internal.InternalEbnfParser typedParser = (de.ugoe.cs.swe.bnftools.ui.contentassist.antlr.internal.InternalEbnfParser) parser;
			typedParser.entryRuleEtsiBnf();
			return typedParser.getFollowElements();
		} catch(RecognitionException ex) {
			throw new RuntimeException(ex);
		}		
	}
	
	@Override
	protected String[] getInitialHiddenTokens() {
		return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" };
	}
	
	public EbnfGrammarAccess getGrammarAccess() {
		return this.grammarAccess;
	}
	
	public void setGrammarAccess(EbnfGrammarAccess grammarAccess) {
		this.grammarAccess = grammarAccess;
	}
}
