public override ParseGraphNode BuildParseGraph(RuntimeState state) { PatternExpression body = (PatternExpression)this.body; string reps = (string)this.reps; return(new RepNode( Source, body.BuildParseGraph(state), Reps.ForName(reps))); }
public override void Build(RuntimeState state, ClassBuilder builder) { builder.Pattern = new ConcretePattern(Source, builder.TypeBuilder.Name, body.BuildParseGraph(state)); }
public override ParseGraphNode BuildParseGraph(RuntimeState state) { ParseGraphNode parseGraph = body.BuildParseGraph(state); if (options.Count == 0) { return(parseGraph); } OptionsNode optionsNode = new OptionsNode(Source, parseGraph); foreach (Option option in options) { string optionKey = option.optionKey.name; object optionValue; if (option.optionValue == null) { optionValue = true; } else { optionValue = option.optionValue.Get(state); } switch (optionKey) { case "buildTextNodes": optionsNode.BuildTextNodes.Value = ConvertNode.ToBool(optionValue); break; case "dropPrecedence": optionsNode.DropPrecedence.Value = ConvertNode.ToBool(optionValue); break; case "recursive": { if (ConvertNode.ToBool(optionValue)) { optionsNode.RecursionBehaviour.Value = RecursionBehaviour.Recursive; } else { optionsNode.RecursionBehaviour.Value = RecursionBehaviour.None; } } break; case "leftRecursive": optionsNode.RecursionBehaviour.Value = RecursionBehaviour.LeftRecursive; break; case "rightRecursive": optionsNode.RecursionBehaviour.Value = RecursionBehaviour.RightRecursive; break; case "whitespace": optionsNode.Whitespace.Value = Pattern.PatternForType((Type)optionValue); break; case "exclude": optionsNode.Exclude.Value = Pattern.PatternForType((Type)optionValue); break; } } return(optionsNode); }
public override ParseGraphNode BuildParseGraph(RuntimeState state) { return(new NotNode( Source, body.BuildParseGraph(state))); }
public override ParseGraphNode BuildParseGraph(RuntimeState state) { return(new LabelNode(Source, label.name, body.BuildParseGraph(state))); }
public override ParseGraphNode BuildParseGraph(RuntimeState state) { PatternExpression body = (PatternExpression)this.body; return(body.BuildParseGraph(state)); }