public static IEnumerable <State> GetNfas(RulePath path, IEnumerable <IExpression> expressions) { foreach (var expression in expressions) { yield return(expression.GetNfa(path)); } }
public State OnMarkRule(State start, RulePath path) { if (markAction != null) return markAction(start, path); return start; }
protected State OnMarkRule(State start, RulePath path) { if (markAction != null) { return(markAction(start, path)); } return(start); }
public State GetNfa(RulePath path) { if (rules.ContainsKey(name) == false) throw new Exception(string.Format(@"@RuleLinkExpression: |{0}| rule not", name)); var newPath = path + name; return OnMarkRule(rules[name].GetNfa(newPath), newPath); }
public State GetNfa(RulePath path) { switch (name) { case "RepeatBy": return State.NoCloneRepeatBy(arguments[0].GetNfa(path), arguments[1].GetNfa(path)); default: throw new NotImplementedException(string.Format(@"@FuncCallExpression: |{0}| function is not defined", name)); } }
public State GetNfa(RulePath path) { if (rules.ContainsKey(name) == false) { throw new Exception(string.Format(@"@RuleLinkExpression: |{0}| rule not", name)); } var newPath = path + name; return(OnMarkRule(rules[name].GetNfa(newPath), newPath)); }
public State GetNfa(RulePath path) { switch (name) { case "RepeatBy": return(State.NoCloneRepeatBy(arguments[0].GetNfa(path), arguments[1].GetNfa(path))); default: throw new NotImplementedException(string.Format(@"@FuncCallExpression: |{0}| function is not defined", name)); } }
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; }
public State GetNfa(RulePath path) { 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) { var result = State.NoCloneRepeatBy(value.GetNfa(path), by.GetNfa(path)); if (count1 <= 0) { result = State.NoCloneOption(result); } if (count1 > 1) { result = State.Repeat(count1, count2, result); } return(result); }
public State GetNfa(RulePath path) { 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) { return(State.NoCloneOption(expression.GetNfa(path))); }
public State GetNfa(RulePath path) { return(OnMarkRule(Thompson.Create(chars), path + chars)); }
public State GetNfa(RulePath path, GetNfaParams param) { return State.NoCloneOption(expression.GetNfa(path, param)); }
public static State[] GetNfasArray(RulePath path, IEnumerable <IExpression> expressions) { return(new List <State>(GetNfas(path, expressions)).ToArray()); }
public State GetNfa(RulePath path, GetNfaParams param) { return(State.NoCloneConcatanation(Builder.BaseExpression.GetNfasArray(path, expressions, param))); }
public State GetNfa(RulePath path, GetNfaParams param) { return(State.NoCloneOption(expression.GetNfa(path, param))); }
public State GetNfa(RulePath path) { return State.Substract(value1.GetNfa(path), value2.GetNfa(path)); }
public State GetNfa(RulePath path) { return(State.Substract(value1.GetNfa(path), value2.GetNfa(path))); }
public State MarkRuleHandler(State start, RulePath path) { ActionsDescription mark; if (marks.TryGetValue(path.Value, out mark) && mark.IsEmpty == false) { mark.UseCount++; foreach (var action in mark.Actions) { switch (action.Mark) { case Marks.Custom: start = State.MarkCustom(start, action.Args[0], action.Args[1], action.Args[2], action.Args[3]); break; case Marks.Const: start.MarkConst(action.Args[0], action.Args[1], int.Parse(action.Args[2])); break; case Marks.Range: start = State.MarkRange(start, action.Args[0], int.Parse(action.Args[1]), int.Parse(action.Args[2])); break; case Marks.BeginRange: start = State.MarkBeginRange(start, action.Args[0], action.Args[1] == "AtBegin", int.Parse(action.Args[2])); break; case Marks.EndRange: case Marks.EndRangeIfInvalid: start = State.MarkEndRange(start, action.Mark, action.Args[0], action.Args[1] == "AtBegin", int.Parse(action.Args[2])); break; case Marks.ContinueRange: start.MarkContinueRange(action.Args[0]); break; case Marks.Decimal: start.MarkDecimal(action.Args[0], action.Args[1], action.Args[2]); break; case Marks.Hex: start.MarkHex(action.Args[0], action.Args[1], action.Args[2]); break; case Marks.Count: start.MarkCount(action.Args[0], int.Parse(action.Args[1]), int.Parse(action.Args[2])); break; case Marks.Bool: case Marks.BoolEx: case Marks.BoolExNot: start.MarkBool(action.Mark, action.Args[0]); break; case Marks.ResetRange: start.MarkReset(action.Args[0]); break; case Marks.ResetRangeIfInvalid: start.MarkResetIfInvalid(action.Args[0]); break; default: throw new Exception(); } } } return(start); }
public State GetNfa(RulePath path, GetNfaParams param) { return param.OnMarkRule(Thompson.Create(chars), path + chars); }
public State GetNfa(RulePath path, GetNfaParams param) { return State.NoCloneAlternation(Builder.BaseExpression.GetNfasArray(path, expressions, param)); }
public State GetNfa(RulePath path) { return(State.Repeat(count1, count2, value.GetNfa(path))); }
public State GetNfa(RulePath path, GetNfaParams param) { return(param.OnMarkRule(Thompson.Create(chars), path + chars)); }
public State GetNfa(RulePath path, GetNfaParams param) { return State.Repeat(count1, count2, value.GetNfa(path, param)); }
public State GetNfa(RulePath path) { return(State.NoCloneAlternation(Builder.BaseExpression.GetNfasArray(path, expressions))); }
public State MarkRuleHandler(State start, RulePath path) { ActionsDescription mark; if (marks.TryGetValue(path.Value, out mark) && mark.IsEmpty == false) { mark.UseCount++; foreach (var action in mark.Actions) { switch (action.Mark) { case Marks.Custom: start = State.MarkCustom(start, action.Args[0], action.Args[1], action.Args[2], action.Args[3]); break; case Marks.Const: start.MarkConst(action.Args[0], action.Args[1], int.Parse(action.Args[2])); break; case Marks.Range: start = State.MarkRange(start, action.Args[0], int.Parse(action.Args[1]), int.Parse(action.Args[2])); break; case Marks.BeginRange: start = State.MarkBeginRange(start, action.Args[0], action.Args[1] == "AtBegin", int.Parse(action.Args[2])); break; case Marks.EndRange: case Marks.EndRangeIfInvalid: start = State.MarkEndRange(start, action.Mark, action.Args[0], action.Args[1] == "AtBegin", int.Parse(action.Args[2])); break; case Marks.ContinueRange: start.MarkContinueRange(action.Args[0]); break; case Marks.Decimal: start.MarkDecimal(action.Args[0], action.Args[1], action.Args[2]); break; case Marks.Hex: start.MarkHex(action.Args[0], action.Args[1], action.Args[2]); break; case Marks.Count: start.MarkCount(action.Args[0], int.Parse(action.Args[1]), int.Parse(action.Args[2])); break; case Marks.Bool: case Marks.BoolEx: case Marks.BoolExNot: start.MarkBool(action.Mark, action.Args[0]); break; case Marks.ResetRange: start.MarkReset(action.Args[0]); break; case Marks.ResetRangeIfInvalid: start.MarkResetIfInvalid(action.Args[0]); break; default: throw new Exception(); } } } return start; }
public static IEnumerable<State> GetNfas(RulePath path, IEnumerable<IExpression> expressions) { foreach (var expression in expressions) yield return expression.GetNfa(path); }
public State GetNfa(RulePath path) { return State.NoCloneConcatanation(Builder.BaseExpression.GetNfasArray(path, expressions)); }
public static State[] GetNfasArray(RulePath path, IEnumerable<IExpression> expressions) { return new List<State>(GetNfas(path, expressions)).ToArray(); }
public State GetNfa(RulePath path, GetNfaParams param) { return(State.Substract(value1.GetNfa(path, param), value2.GetNfa(path, param))); }
protected State OnMarkRule(State start, RulePath path) { return builder.OnMarkRule(start, path); }
public State GetNfa(RulePath path) { return State.NoCloneOption(expression.GetNfa(path)); }
public State GetNfa(RulePath path, GetNfaParams param) { return State.Substract(value1.GetNfa(path, param), value2.GetNfa(path, param)); }
public State GetNfa(RulePath path, GetNfaParams param) { return(State.Repeat(count1, count2, value.GetNfa(path, param))); }
public State GetNfa(RulePath path) { return OnMarkRule(Thompson.Create(chars), path + chars); }
protected State OnMarkRule(State start, RulePath path) { return(builder.OnMarkRule(start, path)); }
public State GetNfa(RulePath path) { return State.Repeat(count1, count2, value.GetNfa(path)); }