@@ -478,17 +478,6 @@ private static void testErrors()
478
478
var column = error . Column ; // 12
479
479
}
480
480
481
- private static void TestRuleParser ( )
482
- {
483
- Console . WriteLine ( "hum hum..." ) ;
484
- var parserInstance = new RuleParser < EbnfToken > ( ) ;
485
- var builder = new ParserBuilder < EbnfToken , IClause < EbnfToken > > ( ) ;
486
- var r = builder . BuildParser ( parserInstance , ParserType . LL_RECURSIVE_DESCENT , "rule" ) ;
487
-
488
- var parser = r . Result ;
489
- var rule = parser . Parse ( "a ( b ) " , "clauses" ) ;
490
- }
491
-
492
481
493
482
public static BuildResult < Parser < ExpressionToken , int > > buildSimpleExpressionParserWithContext ( )
494
483
{
@@ -737,7 +726,7 @@ private static void TestGraphViz()
737
726
var parser = builder . BuildParser ( parserInstance , ParserType . LL_RECURSIVE_DESCENT , StartingRule ) ;
738
727
var result = parser . Result . Parse ( "2 + 2 * 3" ) ;
739
728
var tree = result . SyntaxTree ;
740
- var graphviz = new GraphVizEBNFSyntaxTreeVisitor < ExpressionToken > ( ) ;
729
+ var graphviz = new GraphVizEBNFSyntaxTreeVisitor < ExpressionToken , int > ( ) ;
741
730
var root = graphviz . VisitTree ( tree ) ;
742
731
string graph = graphviz . Graph . Compile ( ) ;
743
732
// File.Delete("c:\\temp\\tree.dot");
@@ -783,32 +772,6 @@ private static void TestChars()
783
772
}
784
773
}
785
774
786
- private static void TestGrammarParser ( )
787
- {
788
- string productionRule = "clauses : clause (COMMA [D] clause)*" ;
789
- var ruleparser = new RuleParser < TestGrammarToken > ( ) ;
790
- var builder = new ParserBuilder < EbnfTokenGeneric , GrammarNode < TestGrammarToken > > ( ) ;
791
- var grammarParser = builder . BuildParser ( ruleparser , ParserType . LL_RECURSIVE_DESCENT , "rule" ) . Result ;
792
- var result = grammarParser . Parse ( productionRule ) ;
793
- //(grammarParser.Lexer as GenericLexer<TestGrammarToken>).ResetLexer();
794
- Console . WriteLine ( $ "alors ? { string . Join ( '\n ' , result . Errors . Select ( e => e . ErrorMessage ) ) } ") ;
795
- result = grammarParser . Parse ( productionRule ) ;
796
- Console . WriteLine ( $ "alors ? { string . Join ( '\n ' , result . Errors . Select ( e => e . ErrorMessage ) ) } ") ;
797
- ;
798
-
799
- Console . WriteLine ( "starting" ) ;
800
- ErroneousGrammar parserInstance = new ErroneousGrammar ( ) ;
801
- Console . WriteLine ( "new instance" ) ;
802
-
803
- var builder2 = new ParserBuilder < TestGrammarToken , object > ( ) ;
804
- Console . WriteLine ( "builder" ) ;
805
-
806
- var Parser = builder . BuildParser ( parserInstance , ParserType . EBNF_LL_RECURSIVE_DESCENT , "rule" ) ;
807
- Console . WriteLine ( $ "built : { Parser . IsOk } ") ;
808
-
809
-
810
- }
811
-
812
775
public static void TestRecursion ( )
813
776
{
814
777
var builder = new ParserBuilder < TestGrammarToken , object > ( ) ;
@@ -861,7 +824,7 @@ public static void TestScript()
861
824
string ko2 = "|B|plotshape(data, style=shapexcross)|E|" ;
862
825
863
826
var r = parser . Parse ( ko1 ) ;
864
- var graphviz = new GraphVizEBNFSyntaxTreeVisitor < ScriptToken > ( ) ;
827
+ var graphviz = new GraphVizEBNFSyntaxTreeVisitor < ScriptToken , object > ( ) ;
865
828
var root = graphviz . VisitTree ( r . SyntaxTree ) ;
866
829
var graph = graphviz . Graph . Compile ( ) ;
867
830
r = parser . Parse ( ko2 ) ;
@@ -1195,8 +1158,8 @@ public static void TestIndentedParserNeverEnding()
1195
1158
1196
1159
var parseResult = parser . Parse ( source ) ;
1197
1160
1198
- GraphVizEBNFSyntaxTreeVisitor < IndentedLangLexer > grapher =
1199
- new GraphVizEBNFSyntaxTreeVisitor < IndentedLangLexer > ( ) ;
1161
+ GraphVizEBNFSyntaxTreeVisitor < IndentedLangLexer , Ast > grapher =
1162
+ new GraphVizEBNFSyntaxTreeVisitor < IndentedLangLexer , Ast > ( ) ;
1200
1163
grapher . VisitTree ( parseResult . SyntaxTree ) ;
1201
1164
var graph = grapher . Graph . Compile ( ) ;
1202
1165
//File.WriteAllText(@"c:\tmp\graph.dot", graph);
@@ -1624,7 +1587,7 @@ private static void NodeNames()
1624
1587
else
1625
1588
{
1626
1589
;
1627
- var graphviz = new GraphVizEBNFSyntaxTreeVisitor < ExpressionToken > ( ) ;
1590
+ var graphviz = new GraphVizEBNFSyntaxTreeVisitor < ExpressionToken , int > ( ) ;
1628
1591
var root = graphviz . VisitTree ( r . SyntaxTree ) ;
1629
1592
string graph = graphviz . Graph . Compile ( ) ;
1630
1593
File . Delete ( "c:\\ temp\\ tree.dot" ) ;
0 commit comments