public UstNode VisitPattern(DslParser.PatternContext context) { DslNode result; result = new DslNode(context.dslCode().Select(code => VisitDslCode(code)).ToList()); return(result); }
public UstNode Deserialize(string data, LanguageFlags sourceLanguage) { if (string.IsNullOrEmpty(data)) { throw new ParsingException("Pattern value can not be empty.") { IsPattern = true }; } Parser.Logger = Logger; UstConverter.Logger = Logger; DslParser.PatternContext patternContext = Parser.Parse(data); UstConverter.SourceLanguage = sourceLanguage; UstConverter.Data = data; DslNode dslNode = UstConverter.Convert(patternContext); UstNode result = dslNode.Collection.First(); ResultPatternVars = dslNode.PatternVarDefs; var preprocessor = new UstPreprocessor(); preprocessor.Logger = Logger; result = new PatternNode(result, dslNode.PatternVarDefs); result = preprocessor.Preprocess(result); return(result); }