Open furesoft opened 9 years ago
Hi @furesoft !
I know this might be outdated, but i dont wanna leave it unanswered.
If this is what you want to get: from this example EBNF grammar file:
then the code is very simple:
foreach(var child in grammar.Children) { if (!string.IsNullOrEmpty(child.Name)) { Console.WriteLine("Found grammar child:\t" + child.Name); } }
In this code, you loop through grammar Children, and just reject those who dont have anything (Those are usually newlines in the EBNF source file)
By the way, you might ask what is grammar
in this context. It's the new EbnfGrammar()
object!
var grammar = new EbnfGrammar(EbnfStyle.Iso14977).Build(File.ReadAllText(args[0]), args[2]);
and args[2]
is the start sequence keyword.
hi,
how can i get all productions of an ebnf grammar (left part)?
i want to make a visual studio grammar language service