public RuleAction(ParseInfo parseInfo, Scope scope, DeltinScriptParser.Ow_ruleContext ruleContext)
        {
            Name     = Extras.RemoveQuotes(ruleContext.STRINGLITERAL().GetText());
            Disabled = ruleContext.DISABLED() != null;
            DocRange ruleInfoRange = DocRange.GetRange(ruleContext.RULE_WORD());

            missingBlockRange = ruleInfoRange;

            GetRuleSettings(parseInfo, scope, ruleContext);

            // Store restricted calls
            CallInfo callInfo = new CallInfo(parseInfo.Script);

            // Get the conditions.
            if (ruleContext.rule_if() == null)
            {
                Conditions = new RuleIfAction[0];
            }
            else
            {
                Conditions = new RuleIfAction[ruleContext.rule_if().Length];
                for (int i = 0; i < Conditions.Length; i++)
                {
                    parseInfo.Script.AddCompletionRange(new CompletionRange(
                                                            scope,
                                                            DocRange.GetRange(ruleContext.rule_if(i).LEFT_PAREN(), ruleContext.rule_if(i).RIGHT_PAREN()),
                                                            CompletionRangeKind.Catch
                                                            ));

                    Conditions[i]     = new RuleIfAction(parseInfo.SetCallInfo(callInfo), scope, ruleContext.rule_if(i));
                    missingBlockRange = DocRange.GetRange(ruleContext.rule_if(i));
                }
            }

            // Get the block.
            if (ruleContext.block() != null)
            {
                Block = new BlockAction(parseInfo.SetCallInfo(callInfo), scope, ruleContext.block());
            }
            else
            {
                parseInfo.Script.Diagnostics.Error("Missing block.", missingBlockRange);
            }

            // Check restricted calls.
            callInfo.CheckRestrictedCalls(EventType);

            // Get the rule order priority.
            if (ruleContext.number() != null)
            {
                Priority = double.Parse(ruleContext.number().GetText());
            }

            ElementCountLens = new ElementCountCodeLens(ruleInfoRange, parseInfo.TranslateInfo.OptimizeOutput);
            parseInfo.Script.AddCodeLensRange(ElementCountLens);
        }
        public RuleAction(ParseInfo parseInfo, Scope scope, DeltinScriptParser.Ow_ruleContext ruleContext)
        {
            Name               = Extras.RemoveQuotes(ruleContext.STRINGLITERAL().GetText());
            Disabled           = ruleContext.DISABLED() != null;
            _missingBlockRange = DocRange.GetRange(ruleContext.RULE_WORD());

            GetRuleSettings(parseInfo, scope, ruleContext);

            // Get the conditions.
            if (ruleContext.rule_if() == null)
            {
                Conditions = new RuleIfAction[0];
            }
            else
            {
                Conditions = new RuleIfAction[ruleContext.rule_if().Length];
                for (int i = 0; i < Conditions.Length; i++)
                {
                    parseInfo.Script.AddCompletionRange(new CompletionRange(
                                                            scope,
                                                            DocRange.GetRange(ruleContext.rule_if(i).LEFT_PAREN(), ruleContext.rule_if(i).RIGHT_PAREN()),
                                                            CompletionRangeKind.Catch
                                                            ));

                    Conditions[i]      = new RuleIfAction(parseInfo, scope, ruleContext.rule_if(i));
                    _missingBlockRange = DocRange.GetRange(ruleContext.rule_if(i));
                }
            }

            // Get the block.
            if (ruleContext.block() != null)
            {
                Block = new BlockAction(parseInfo, scope, ruleContext.block());
            }
            else
            {
                parseInfo.Script.Diagnostics.Error("Missing block.", _missingBlockRange);
            }

            // Get the rule order priority.
            if (ruleContext.number() != null)
            {
                Priority = double.Parse(ruleContext.number().GetText());
            }
        }