示例#1
0
        private void PopulateSequence()
        {
            if (this.sequence != null)
            {
                return;
            }

            this.sequence = new List <Pattern>();
            for (int Idx = 1; Idx < template.Length; ++Idx)
            {
                sequence.Add(scope.getPattern(template, Idx));
            }
        }
示例#2
0
        private void PopulateOptions()
        {
            if (this.options != null)
            {
                return;
            }

            this.options = new List <Pattern>();
            for (int Idx = 1; Idx < template.Length; ++Idx)
            {
                options.Add(scope.getPattern(template, Idx));
            }
        }
示例#3
0
        public Expression ParseBase(List <object> tokens)
        {
            int          index       = 0;
            string       startName   = settings.getString("START");
            PatternScope scope       = new PatternScope(settings);
            Pattern      rootPattern = scope.getPattern(startName);

            Expression result = rootPattern.Parse(tokens, ref index);

            if (index < tokens.Count)
            {
                return(null);
            }
            else
            {
                return(new Expression(new List <Expression>()
                {
                    result
                }));
            }
        }
示例#4
0
 public Pattern_Bind(JSONArray template, PatternScope scope)
 {
     bindName = template.getString(1);
     body     = scope.getPattern(template, 2);
 }
示例#5
0
 public Pattern_Optional(JSONArray template, PatternScope scope)
 {
     body = scope.getPattern(template, 1);
 }
示例#6
0
 public Pattern_Multi(JSONArray template, PatternScope scope)
 {
     body = scope.getPattern(template, 1);
 }