Exemple #1
0
        public State GetNfa(RulePath path, GetNfaParams param)
        {
            if (rules.ContainsKey(name) == false)
                throw new Exception(string.Format(@"@RuleLinkExpression: |{0}| rule not found", name));

            var newPath = path + name;

            return param.OnMarkRule(rules[name].GetNfa(newPath, param), newPath);
        }
Exemple #2
0
 public State GetNfa(RulePath path, GetNfaParams param)
 {
     switch (name)
     {
         case "RepeatBy":
             return State.NoCloneRepeatBy(arguments[0].GetNfa(path, param), arguments[1].GetNfa(path, param));
         default:
             throw new NotImplementedException(string.Format(@"@FuncCallExpression: |{0}| function is not defined", name));
     }
 }
Exemple #3
0
        public State GetNfa(RulePath path, GetNfaParams param)
        {
            if (rules.ContainsKey(name) == false)
            {
                throw new Exception(string.Format(@"@RuleLinkExpression: |{0}| rule not found", name));
            }

            var newPath = path + name;

            return(param.OnMarkRule(rules[name].GetNfa(newPath, param), newPath));
        }
Exemple #4
0
        public State GetNfa(RulePath path, GetNfaParams param)
        {
            switch (name)
            {
            case "RepeatBy":
                return(State.NoCloneRepeatBy(arguments[0].GetNfa(path, param), arguments[1].GetNfa(path, param)));

            default:
                throw new NotImplementedException(string.Format(@"@FuncCallExpression: |{0}| function is not defined", name));
            }
        }
Exemple #5
0
        public State GetNfa(RulePath path, GetNfaParams param)
        {
            var result = State.NoCloneRepeatBy(value.GetNfa(path, param), by.GetNfa(path, param));

            if (count1 <= 0)
                result = State.NoCloneOption(result);

            if (count1 > 1)
                result = State.Repeat(count1, count2, result);

            return result;
        }
Exemple #6
0
 public State GetNfa(RulePath path, GetNfaParams param)
 {
     if (hex1 != null)
     {
         if (hex2 == null)
             return Thompson.Create(hex1.Value);
         else
             return Thompson.Create(hex1.Value, hex2.Value);
     }
     else
     {
         return Thompson.Create(hexs.ToArray());
     }
 }
Exemple #7
0
        public State GetNfa(RulePath path, GetNfaParams param)
        {
            var result = State.NoCloneRepeatBy(value.GetNfa(path, param), by.GetNfa(path, param));

            if (count1 <= 0)
            {
                result = State.NoCloneOption(result);
            }

            if (count1 > 1)
            {
                result = State.Repeat(count1, count2, result);
            }

            return(result);
        }
Exemple #8
0
 public State GetNfa(RulePath path, GetNfaParams param)
 {
     if (hex1 != null)
     {
         if (hex2 == null)
         {
             return(Thompson.Create(hex1.Value));
         }
         else
         {
             return(Thompson.Create(hex1.Value, hex2.Value));
         }
     }
     else
     {
         return(Thompson.Create(hexs.ToArray()));
     }
 }
 public State GetNfa(RulePath path, GetNfaParams param)
 {
     return(State.Substract(value1.GetNfa(path, param), value2.GetNfa(path, param)));
 }
Exemple #10
0
 public State GetNfa(RulePath path, GetNfaParams param)
 {
     return(State.NoCloneConcatanation(Builder.BaseExpression.GetNfasArray(path, expressions, param)));
 }
Exemple #11
0
 public State GetNfa(RulePath path, GetNfaParams param)
 {
     return(State.Repeat(count1, count2, value.GetNfa(path, param)));
 }
Exemple #12
0
 public static State[] GetNfasArray(RulePath path, IEnumerable<IExpression> expressions, GetNfaParams param)
 {
     return new List<State>(GetNfas(path, expressions, param)).ToArray();
 }
Exemple #13
0
 public static IEnumerable<State> GetNfas(RulePath path, IEnumerable<IExpression> expressions, GetNfaParams param)
 {
     foreach (var expression in expressions)
         yield return expression.GetNfa(path, param);
 }
Exemple #14
0
 public State GetNfa(RulePath path, GetNfaParams param)
 {
     return State.NoCloneOption(expression.GetNfa(path, param));
 }
Exemple #15
0
 public State GetNfa(RulePath path, GetNfaParams param)
 {
     return State.NoCloneAlternation(Builder.BaseExpression.GetNfasArray(path, expressions, param));
 }
Exemple #16
0
 public static IEnumerable <State> GetNfas(RulePath path, IEnumerable <IExpression> expressions, GetNfaParams param)
 {
     foreach (var expression in expressions)
     {
         yield return(expression.GetNfa(path, param));
     }
 }
Exemple #17
0
 public State GetNfa(RulePath path, GetNfaParams param)
 {
     return(param.OnMarkRule(Thompson.Create(chars), path + chars));
 }
Exemple #18
0
 public State GetNfa(RulePath path, GetNfaParams param)
 {
     return State.Substract(value1.GetNfa(path, param), value2.GetNfa(path, param));
 }
Exemple #19
0
 public State GetNfa(RulePath path, GetNfaParams param)
 {
     return(State.NoCloneOption(expression.GetNfa(path, param)));
 }
Exemple #20
0
 public State GetNfa(RulePath path, GetNfaParams param)
 {
     return param.OnMarkRule(Thompson.Create(chars), path + chars);
 }
Exemple #21
0
 public static State[] GetNfasArray(RulePath path, IEnumerable <IExpression> expressions, GetNfaParams param)
 {
     return(new List <State>(GetNfas(path, expressions, param)).ToArray());
 }
Exemple #22
0
 public State GetNfa(RulePath path, GetNfaParams param)
 {
     return State.Repeat(count1, count2, value.GetNfa(path, param));
 }