Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
495
FromEbnf method
posted

Hello!

Using 13.1, I'm trying to reproduce Step 1 from the "Implementing a TextDocument with a RichTextBox" documentation but the FromEbnf() method of the Grammar object doesn't seem to exist.  Am I doing something wrong or is the doc wrong?

http://help.infragistics.com/NetAdvantage/WinForms/2013.1/CLR4.0/?page=Implementing_a_TextDocument_with_a_RichTextBox.html

What I'm trying to achieve is loading the syntax at runtime.  This used to work in the CTP:

****************************

var grammar = new Grammar();
grammar.FromEbnf(
@"
?
<Grammar>
<Name>MyGrammar</Name>
<StartSymbol>Document</StartSymbol>
</Grammar>
?;

?
<TerminalSymbols>
<TerminalSymbol> <Name>CommaToken</Name> <Value>,</Value> </TerminalSymbol>
<TerminalSymbol> <Name>DotToken</Name> <Value>.</Value> </TerminalSymbol>
<TerminalSymbol> <Name>ExclamationPointToken</Name> <Value>!</Value> </TerminalSymbol>

<!-- The question mark must be escaped below so the special sequence is not ended. -->
<TerminalSymbol> <Name>QuestionMarkToken</Name> <Value>&#x3F;</Value> </TerminalSymbol>

<TerminalSymbol> <Name>SemicolonToken</Name> <Value>;</Value> </TerminalSymbol>
<TerminalSymbol> <Name>WordToken</Name> <Value>\w+</Value> <Comparison>RegularExpression</Comparison> </TerminalSymbol>
</TerminalSymbols>
?;

Document =
{Sentence};
Sentence =
Phrase, {PhraseSeparatingPunctuation, Phrase}, SentenceEndingPunctuation;
SentenceEndingPunctuation =
DotToken
| ExclamationPointToken
| QuestionMarkToken;
PhraseSeparatingPunctuation =
CommaToken
| SemicolonToken;
Phrase =
_words;
_words =
WordToken |
WordToken, _words;
");


CustomLanguage language = new CustomLanguage(grammar);
TextDocument document = new TextDocument();
document.Language = language;

document.Append(
@"
Hello World! This sentence has multiple phrases; they are separated by a semicolon.
");

document.Parse();

****************************

Is this still possible?

BTW, why is this forum still labeled with CTP? Has not the Parsing engine reached RTM in 13.1?

Thanks

Guy Barrette