Skip to content

Commit

Permalink
remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
b3b00 committed Dec 13, 2024
1 parent bb379e3 commit 93b739c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
18 changes: 9 additions & 9 deletions src/samples/ParserExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ private static void AddExponentExtension(DoubleExponent token, LexemeAttribute l
var fsmBuilder = lexer.FSMBuilder;


fsmBuilder.GoTo(GenericLexer<DoubleExponent>.in_double) // start a in_double node
fsmBuilder.GoTo(GenericLexer<DoubleExponent>.in_double) // start an in_double node
.Transition(new char[] {'E','e'}) // add a transition on '.' with precondition
.Transition(new char[]{'+','-'})
.Mark("start_exponent_val")
Expand Down Expand Up @@ -1158,15 +1158,15 @@ public static void TestIndentedParserNeverEnding()
Assert.True(parserRes.IsOk);
var parser = parserRes.Result;
Assert.NotNull(parser);
parser.SyntaxParseCallback = node =>
{
GraphVizEBNFSyntaxTreeVisitor<IndentedLangLexer> grapher =
new GraphVizEBNFSyntaxTreeVisitor<IndentedLangLexer>();
var root = grapher.VisitTree(node);
var graph = grapher.Graph.Compile();
// File.WriteAllText(@"c:\tmp\graph.dot", graph);
};

var parseResult = parser.Parse(source);

GraphVizEBNFSyntaxTreeVisitor<IndentedLangLexer> grapher =
new GraphVizEBNFSyntaxTreeVisitor<IndentedLangLexer>();
grapher.VisitTree(parseResult.SyntaxTree);
var graph = grapher.Graph.Compile();
//File.WriteAllText(@"c:\tmp\graph.dot", graph);

Assert.True(parseResult.IsOk);
var ast = parseResult.Result;
indented.Block root = ast as indented.Block;
Expand Down
6 changes: 1 addition & 5 deletions src/sly/parser/parser/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ namespace sly.parser
{
public class Parser<IN, OUT> where IN : struct
{
public Action<ISyntaxNode<IN>> SyntaxParseCallback { get; set; }

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

Expand Down Expand Up @@ -121,10 +120,7 @@ public ParseResult<IN, OUT> ParseWithContext(IList<Token<IN>> tokens, object par
syntaxResult = cleaner.CleanSyntaxTree(syntaxResult);
if (!syntaxResult.IsError && syntaxResult.Root != null)
{
if (SyntaxParseCallback != null)
{
SyntaxParseCallback(syntaxResult.Root);
}

var r = Visitor.VisitSyntaxTree(syntaxResult.Root,parsingContext);
result.Result = r;
result.SyntaxTree = syntaxResult.Root;
Expand Down

0 comments on commit 93b739c

Please sign in to comment.