Antlr4.Semantics.SymbolChecks.CheckActionRedefinitions C# (CSharp) Method

CheckActionRedefinitions() public method

public CheckActionRedefinitions ( IList actions ) : void
actions IList
return void
        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);
                }
            }
        }