public virtual void CheckActionRedefinitions(IList<GrammarAST> actions)
{
if (actions == null)
return;
string scope = g.GetDefaultActionScope();
string name;
GrammarAST nameNode;
foreach (GrammarAST ampersandAST in actions)
{
nameNode = (GrammarAST)ampersandAST.GetChild(0);
if (ampersandAST.ChildCount == 2)
{
name = nameNode.Text;
}
else
{
scope = nameNode.Text;
name = ampersandAST.GetChild(1).Text;
}
ISet<string> scopeActions;
if (!actionScopeToActionNames.TryGetValue(scope, out scopeActions) || scopeActions == null)
{
// init scope
scopeActions = new HashSet<string>();
actionScopeToActionNames[scope] = scopeActions;
}
if (!scopeActions.Contains(name))
{
scopeActions.Add(name);
}
else
{
errMgr.GrammarError(ErrorType.ACTION_REDEFINITION,
g.fileName, nameNode.Token, name);
}
}
}