/*
* generated by Xtext
*/
package org.xtext.example.mydsl2.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 org.xtext.example.mydsl2.services.MyDsl2GrammarAccess;

public class MyDsl2Parser extends AbstractContentAssistParser {
	
	@Inject
	private MyDsl2GrammarAccess grammarAccess;
	
	private Map<AbstractElement, String> nameMappings;
	
	@Override
	protected org.xtext.example.mydsl2.ui.contentassist.antlr.internal.InternalMyDsl2Parser createParser() {
		org.xtext.example.mydsl2.ui.contentassist.antlr.internal.InternalMyDsl2Parser result = new org.xtext.example.mydsl2.ui.contentassist.antlr.internal.InternalMyDsl2Parser(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.getPrincipleAccess().getAlternatives(), "rule__Principle__Alternatives");
					put(grammarAccess.getBasePermissionAccess().getAlternatives(), "rule__BasePermission__Alternatives");
					put(grammarAccess.getUserModelAccess().getGroup(), "rule__UserModel__Group__0");
					put(grammarAccess.getUserModelAccess().getGroup_3(), "rule__UserModel__Group_3__0");
					put(grammarAccess.getUserModelAccess().getGroup_4(), "rule__UserModel__Group_4__0");
					put(grammarAccess.getSitePermissionAccess().getGroup(), "rule__SitePermission__Group__0");
					put(grammarAccess.getSitePermissionAccess().getGroup_6(), "rule__SitePermission__Group_6__0");
					put(grammarAccess.getSitePermissionAccess().getGroup_7(), "rule__SitePermission__Group_7__0");
					put(grammarAccess.getSitePermissionAccess().getGroup_8(), "rule__SitePermission__Group_8__0");
					put(grammarAccess.getGroupAccess().getGroup(), "rule__Group__Group__0");
					put(grammarAccess.getGroupAccess().getGroup_3(), "rule__Group__Group_3__0");
					put(grammarAccess.getGroupAccess().getGroup_3_3(), "rule__Group__Group_3_3__0");
					put(grammarAccess.getUserAccess().getGroup(), "rule__User__Group__0");
					put(grammarAccess.getRoleAssignmentAccess().getGroup(), "rule__RoleAssignment__Group__0");
					put(grammarAccess.getRoleAssignmentAccess().getGroup_6(), "rule__RoleAssignment__Group_6__0");
					put(grammarAccess.getRoleAssignmentAccess().getGroup_6_3(), "rule__RoleAssignment__Group_6_3__0");
					put(grammarAccess.getRoleDefinitionAccess().getGroup(), "rule__RoleDefinition__Group__0");
					put(grammarAccess.getRoleDefinitionAccess().getGroup_6(), "rule__RoleDefinition__Group_6__0");
					put(grammarAccess.getQualifiedNameAccess().getGroup(), "rule__QualifiedName__Group__0");
					put(grammarAccess.getQualifiedNameAccess().getGroup_1(), "rule__QualifiedName__Group_1__0");
					put(grammarAccess.getUserModelAccess().getNameAssignment_1(), "rule__UserModel__NameAssignment_1");
					put(grammarAccess.getUserModelAccess().getUsersAssignment_3_2(), "rule__UserModel__UsersAssignment_3_2");
					put(grammarAccess.getUserModelAccess().getUsersAssignment_3_3(), "rule__UserModel__UsersAssignment_3_3");
					put(grammarAccess.getUserModelAccess().getSitePermissionsAssignment_4_2(), "rule__UserModel__SitePermissionsAssignment_4_2");
					put(grammarAccess.getUserModelAccess().getSitePermissionsAssignment_4_3(), "rule__UserModel__SitePermissionsAssignment_4_3");
					put(grammarAccess.getSitePermissionAccess().getNameAssignment_1(), "rule__SitePermission__NameAssignment_1");
					put(grammarAccess.getSitePermissionAccess().getWebGUIDAssignment_5(), "rule__SitePermission__WebGUIDAssignment_5");
					put(grammarAccess.getSitePermissionAccess().getOwnedGroupAssignment_6_2(), "rule__SitePermission__OwnedGroupAssignment_6_2");
					put(grammarAccess.getSitePermissionAccess().getOwnedRoleDefinitionAssignment_7_2(), "rule__SitePermission__OwnedRoleDefinitionAssignment_7_2");
					put(grammarAccess.getSitePermissionAccess().getOwnedRoleAssignmentsAssignment_8_2(), "rule__SitePermission__OwnedRoleAssignmentsAssignment_8_2");
					put(grammarAccess.getGroupAccess().getNameAssignment_1(), "rule__Group__NameAssignment_1");
					put(grammarAccess.getGroupAccess().getUsersAssignment_3_2(), "rule__Group__UsersAssignment_3_2");
					put(grammarAccess.getGroupAccess().getUsersAssignment_3_3_1(), "rule__Group__UsersAssignment_3_3_1");
					put(grammarAccess.getUserAccess().getNameAssignment_1(), "rule__User__NameAssignment_1");
					put(grammarAccess.getRoleAssignmentAccess().getNameAssignment_1(), "rule__RoleAssignment__NameAssignment_1");
					put(grammarAccess.getRoleAssignmentAccess().getMemberAssignment_5(), "rule__RoleAssignment__MemberAssignment_5");
					put(grammarAccess.getRoleAssignmentAccess().getRoleDefinitionBindingsAssignment_6_2(), "rule__RoleAssignment__RoleDefinitionBindingsAssignment_6_2");
					put(grammarAccess.getRoleAssignmentAccess().getRoleDefinitionBindingsAssignment_6_3_1(), "rule__RoleAssignment__RoleDefinitionBindingsAssignment_6_3_1");
					put(grammarAccess.getRoleDefinitionAccess().getNameAssignment_1(), "rule__RoleDefinition__NameAssignment_1");
					put(grammarAccess.getRoleDefinitionAccess().getBasePermissionsAssignment_5(), "rule__RoleDefinition__BasePermissionsAssignment_5");
					put(grammarAccess.getRoleDefinitionAccess().getBasePermissionsAssignment_6_1(), "rule__RoleDefinition__BasePermissionsAssignment_6_1");
				}
			};
		}
		return nameMappings.get(element);
	}
	
	@Override
	protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
		try {
			org.xtext.example.mydsl2.ui.contentassist.antlr.internal.InternalMyDsl2Parser typedParser = (org.xtext.example.mydsl2.ui.contentassist.antlr.internal.InternalMyDsl2Parser) parser;
			typedParser.entryRuleUserModel();
			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 MyDsl2GrammarAccess getGrammarAccess() {
		return this.grammarAccess;
	}
	
	public void setGrammarAccess(MyDsl2GrammarAccess grammarAccess) {
		this.grammarAccess = grammarAccess;
	}
}
