Browse
 
Tools
Rss Categories

LVGrammar::AddRule (Deprecated)

Reference Number: AA-00860 Views: 5948 0 Rating/ Voters

Add rules to a grammar object.

Function

  • int LVGrammar_AddRule(HGRAMMAR hgram, const char* rule_name, const char* rule_definition)

Parameters

hgram

A handle to the grammar.

rule_name

The name of the rule

rule_definition

The definition of the rule

Return Values

LV_SUCCESS

No errors; the rule has been successfully added or removed.

LV_GRAMMAR_SYNTAX_WARNING

The new rule was not fully conforming, but it was understandable and is now ready to be used

LV_GRAMMAR_SYNTAX_ERROR

The new rule was not understandable to the grammar compiler. You will not be able to decode with this grammar.

Example

LVGrammar_AddRule(hgram, "foo", "hello [world]");

Is the same as writing a rule:

$foo = hello [world];

Remarks

New rules must be written into the grammar in ABNF notation.
Detailed error and warning messages are sent to the grammar object's logging callback function.