Posted 17 years ago
by Willem Mitchell
I'm currently evaluating the editor for a project where I have to add C# scripting capabilities. While the editor functionality is great, I need to be able to get an parse and get an AST from a text file, not from the editor. I'd like to use the C# add-on parser to do this.
I've used ANTLR before and what I'm trying to acheive with an ANTLR generated parser would look like something like this:
//Initialize lexer
CSharpLexer lexer = new CSharpLexer(fileStream);
.
.
CSharpParser parser = new CSharpParser(lexer);
//If the text file contained a single function
parser.MethodBody()
Antlr.Collection.IAST treeRoot = parser.GetAST();
WalkTree(treeRoot);
Does anyone have a simple example of how to do this with the SyntaxEditor C# parser?
I've used ANTLR before and what I'm trying to acheive with an ANTLR generated parser would look like something like this:
//Initialize lexer
CSharpLexer lexer = new CSharpLexer(fileStream);
.
.
CSharpParser parser = new CSharpParser(lexer);
//If the text file contained a single function
parser.MethodBody()
Antlr.Collection.IAST treeRoot = parser.GetAST();
WalkTree(treeRoot);
Does anyone have a simple example of how to do this with the SyntaxEditor C# parser?