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); }
public SyntaxParser(SemanticAnalyzer analizer, ShaderSyntaxInfo syntax) { this.semantic = analizer; this.syntax = syntax; Comments = new List <LexerNode>(); Prog = new DefinitionObjectNode(); }