public TemplateParser(TemplateScanner scanner)
            : base(scanner)
        {
            // Initialize the "aliases" manually here instead of the .y file to workaround the problem 
            // in GPPG code generation, which stores quotation marks in in the dictionary values.
            TemplateParser.aliases = TokenAliases;

            scanner.Parser = this;
        }
        public TemplateParser(TemplateScanner scanner)
            : base(scanner)
        {
            // Initialize the "aliases" manually here instead of the .y file to workaround the problem
            // in GPPG code generation, which stores quotation marks in in the dictionary values.
            TemplateParser.aliases = TokenAliases;

            scanner.Parser = this;
        }
            public TemplateBuffer(TemplateScanner scanner, string source)
            {
                Debug.Assert(scanner != null, "scanner");
                Debug.Assert(source != null, "source");

                this.scanner  = scanner;
                this.source   = source;
                this.length   = source.Length;
                this.FileName = null;
            }
            public TemplateBuffer(TemplateScanner scanner, string source)
            {
                Debug.Assert(scanner != null, "scanner");
                Debug.Assert(source != null, "source");

                this.scanner = scanner;
                this.source = source;
                this.length = source.Length;
                this.FileName = null;
            }
Exemple #5
0
        private static IEnumerable <SyntaxNode> Scan(string input)
        {
            var scanner = new TemplateScanner(input);

            while (scanner.yylex() != (int)SyntaxKind.EOF)
            {
                yield return(scanner.yylval);
            }

            yield return(scanner.yylval); // EndOfFile
        }
        private void ParseTextSnapshot(ITextSnapshot snapshot)
        {
            var scanner = new TemplateScanner(snapshot.GetText());

            var parser = new TemplateParser(scanner);
            parser.Parse();

            // Always return a template object, even if the parser couldn't build one, to avoid downstream errors.
            Template template = parser.Template ?? new Template();

            var errors = new List<TemplateError>(parser.Errors);
            errors.AddRange(template.Validate());

            this.OnTemplateChanged(new TemplateAnalysis(snapshot, template, errors));
        }
Exemple #7
0
        private static TemplateParser CreateParser(string input)
        {
            var scanner = new TemplateScanner(input);

            return(new TemplateParser(scanner));
        }
 private static TemplateParser CreateParser(string input)
 {
     var scanner = new TemplateScanner(input);
     return new TemplateParser(scanner);            
 }
        private static IEnumerable<SyntaxNode> Scan(string input)
        {
            var scanner = new TemplateScanner(input);
            while (scanner.yylex() != (int)SyntaxKind.EOF)
            {
                yield return scanner.yylval;
            }

            yield return scanner.yylval; // EndOfFile 
        }