Esempio n. 1
0
 protected override void InnerInitialize(ParserInitializeArgs args)
 {
     if (Inner != null)
     {
         Inner.Initialize(args);
     }
     base.InnerInitialize(args);
 }
Esempio n. 2
0
 public override void Initialize(ParserInitializeArgs args)
 {
     base.Initialize(args);
     if (Inner != null && args.Push(this))
     {
         Inner.Initialize(args);
         args.Pop();
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Called to initialize the parser when used in a grammar
 /// </summary>
 /// <remarks>
 /// This is used to perform certain tasks like caching information for performance, or to deal with
 /// things like left recursion in the grammar.
 /// </remarks>
 /// <param name="args">Initialization arguments</param>
 public virtual void Initialize(ParserInitializeArgs args)
 {
     if (args.Push(this))
     {
         hasNamedChildren = Children().Any(r => r.Name != null);
         mode             = (hasNamedChildren && name != null) ? ParseMode.NamedChildren : name != null || AddError ? ParseMode.NameOrError : ParseMode.Simple;
         args.Pop();
     }
 }
Esempio n. 4
0
 public void InitializeItems(ParserInitializeArgs args)
 {
     foreach (var item in Items)
     {
         if (item != null)
         {
             item.Initialize(args);
         }
     }
 }
Esempio n. 5
0
 protected override void InnerInitialize(ParserInitializeArgs args)
 {
     for (int i = 0, itemCount = Items.Count; i < itemCount; i++)
     {
         var item = Items[i];
         if (item != null)
         {
             item.Initialize(args);
         }
     }
     base.InnerInitialize(args);
 }
Esempio n. 6
0
        /// <summary>
        /// Called to initialize the parser when used in a grammar
        /// </summary>
        /// <remarks>
        /// This is used to perform certain tasks like caching information for performance, or to deal with
        /// things like left recursion in the grammar.
        /// </remarks>
        /// <param name="args">Initialization arguments</param>
        public void Initialize(ParserInitializeArgs args)
        {
            if (!initialized && args.Push(this))
            {
                initialized = true;
                var parent = args.Parent;
                args.Parent = this;
                InnerInitialize(args);
                args.Parent      = parent;
                hasNamedChildren = (Children.Any(r => r.AddMatch || r.hasNamedChildren));
                var parentNamed = false;
                if (parent != null && hasNamedChildren)
                {
                    var parentHasMatches = parent.Scan(filter: p => p != this).Any(p => p.AddMatch);
                    //parentNamed = parent.Scan(filter: p => p != this).Any(p => p.AddMatch);
                    parentNamed = parent.AddMatch;
                }

                mode = (hasNamedChildren && (AddMatch /* || parentNamed*/)) ? ParseMode.NamedChildren : AddMatch || AddError ? ParseMode.NameOrError : ParseMode.Simple;

                args.Pop();
            }
        }
Esempio n. 7
0
 protected virtual void InnerInitialize(ParserInitializeArgs args)
 {
 }