Skip to content

Commit 93b739c

Browse files
committed
remove useless code
1 parent bb379e3 commit 93b739c

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/samples/ParserExample/Program.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ private static void AddExponentExtension(DoubleExponent token, LexemeAttribute l
932932
var fsmBuilder = lexer.FSMBuilder;
933933

934934

935-
fsmBuilder.GoTo(GenericLexer<DoubleExponent>.in_double) // start a in_double node
935+
fsmBuilder.GoTo(GenericLexer<DoubleExponent>.in_double) // start an in_double node
936936
.Transition(new char[] {'E','e'}) // add a transition on '.' with precondition
937937
.Transition(new char[]{'+','-'})
938938
.Mark("start_exponent_val")
@@ -1158,15 +1158,15 @@ public static void TestIndentedParserNeverEnding()
11581158
Assert.True(parserRes.IsOk);
11591159
var parser = parserRes.Result;
11601160
Assert.NotNull(parser);
1161-
parser.SyntaxParseCallback = node =>
1162-
{
1163-
GraphVizEBNFSyntaxTreeVisitor<IndentedLangLexer> grapher =
1164-
new GraphVizEBNFSyntaxTreeVisitor<IndentedLangLexer>();
1165-
var root = grapher.VisitTree(node);
1166-
var graph = grapher.Graph.Compile();
1167-
// File.WriteAllText(@"c:\tmp\graph.dot", graph);
1168-
};
1161+
11691162
var parseResult = parser.Parse(source);
1163+
1164+
GraphVizEBNFSyntaxTreeVisitor<IndentedLangLexer> grapher =
1165+
new GraphVizEBNFSyntaxTreeVisitor<IndentedLangLexer>();
1166+
grapher.VisitTree(parseResult.SyntaxTree);
1167+
var graph = grapher.Graph.Compile();
1168+
//File.WriteAllText(@"c:\tmp\graph.dot", graph);
1169+
11701170
Assert.True(parseResult.IsOk);
11711171
var ast = parseResult.Result;
11721172
indented.Block root = ast as indented.Block;

src/sly/parser/parser/Parser.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ namespace sly.parser
1616
{
1717
public class Parser<IN, OUT> where IN : struct
1818
{
19-
public Action<ISyntaxNode<IN>> SyntaxParseCallback { get; set; }
2019

2120
public Dictionary<IN, Dictionary<string, string>> LexemeLabels => Lexer.LexemeLabels;
2221

@@ -121,10 +120,7 @@ public ParseResult<IN, OUT> ParseWithContext(IList<Token<IN>> tokens, object par
121120
syntaxResult = cleaner.CleanSyntaxTree(syntaxResult);
122121
if (!syntaxResult.IsError && syntaxResult.Root != null)
123122
{
124-
if (SyntaxParseCallback != null)
125-
{
126-
SyntaxParseCallback(syntaxResult.Root);
127-
}
123+
128124
var r = Visitor.VisitSyntaxTree(syntaxResult.Root,parsingContext);
129125
result.Result = r;
130126
result.SyntaxTree = syntaxResult.Root;

0 commit comments

Comments
 (0)