示例#1
0
        public PatternRoot Deserialize(CodeFile data)
        {
            if (string.IsNullOrEmpty(data.Code))
            {
                throw new ParsingException(data, message: "Pattern value can not be empty.");
            }

            var parser = new DslAntlrParser()
            {
                Logger = Logger
            };
            var converter = new DslUstConverter
            {
                Logger = Logger,
                PatternExpressionInsideStatement = PatternExpressionInsideStatement,
                Data = data
            };

            DslParser.PatternContext patternContext = parser.Parse(data.Code);

            PatternRoot patternNode = converter.Convert(patternContext);

            patternNode.CodeFile = data;

            var preprocessor = new PatternNormalizer()
            {
                Logger = Logger
            };

            patternNode = preprocessor.Normalize(patternNode);

            return(patternNode);
        }
示例#2
0
 public DslProcessor()
 {
     Parser       = new DslAntlrParser();
     UstConverter = new DslUstConverter();
 }