Пример #1
0
        public override void Init(AstContext context, ParseTreeNode parseNode)
        {
            Php54Grammar = (Php54Grammar)context.Language.Grammar;
            IEnumerable<ParseTreeNode> _Childs;
            _Childs = parseNode.ChildNodes;

            if (parseNode.ChildNodes.Count > 0)
            {
                if (parseNode.ChildNodes[0].FindTokenAndGetText() == "array")
                {
                    _Childs = _Childs.Skip(1);
                }
            }
            Childs = _Childs.ElementAt(0).ChildNodes.Select(Item => Item).ToArray();
        }
Пример #2
0
        public Php54Runtime(bool InteractiveErrors = false)
        {
            if (Thread.CurrentThread.CurrentCulture.Name != "en-US")
            {
                Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
                Debug.WriteLine("Changed CultureInfo to en-US");
            }

            this.InteractiveErrors = InteractiveErrors;
            this.Grammar = new Php54Grammar();
            this.LanguageData = new LanguageData(Grammar);
            this.Parser = new Parser(LanguageData);
            this.Parser.Context.TracingEnabled = true;
            this.Parser.Context.MaxErrors = 5;
            this.TextWriter = Console.Out;
            this.FunctionScope = new Php54FunctionScope(this);
            Reset();
        }