コード例 #1
0
        public void Read(string shadertext)
        {
            Semantic    = new SemanticAnalyzer();
            highlighter = new SyntaxHighlighter(syntax);
            highlightedLexers.Clear();
            var ast = new SyntaxParser(Semantic, syntax);

            try {
                //shadertext = File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "IDE", "TestShaders", "Test.fx"));

                shadertext = shadertext.Replace(Environment.NewLine, "\n");
                ShaderDocument.Blocks.Clear();
                ShaderDocument.Blocks.Add(new Paragraph(new Run(shadertext)));
                //
                var la = new LexicalAnalyzer(syntax);
                la.Parse(ShaderDocument.ContentStart, shadertext);
                var lexer = la.Lexers;
                //
                ast.Parse(lexer);
            }catch (SyntaxException se) {
                highlighter.HighlightException(se);
            } catch (Exception ex) {
                ex.ToString();
            }

            ast.Prog.Handle(highlighter);
            //highlighter.ApplyComments(ast.Comments);
        }
コード例 #2
0
 public SyntaxParser(SemanticAnalyzer analizer, ShaderSyntaxInfo syntax)
 {
     this.semantic = analizer;
     this.syntax   = syntax;
     Comments      = new List <LexerNode>();
     Prog          = new DefinitionObjectNode();
 }