SRGS Grammar Literals

The SRGS grammar literal is always of type Grammar.

SRGSGrammar:
SRGSGrammarDeclarator [ComplexLiteralInputChars]
SRGSGrammarDeclarator [Expression]
SRGSGrammarDeclarator:
any case of XG
SRGS grammar literals are used to represent a grammar that supports the Speech Recognition Grammar format. The grammar must have an ecma variable named tag if used as a main grammar in a recognition. The ComplexLiteralInputChars can include the [ character as long as it has a balanced number of ] characters: one for every [ character found:
  • If the sequence of characters can be parsed as an Expression of type String, java.io.File, java.net.URL, or org.w3c.dom.Document then the resulting grammar is a SRGS grammar where the expression specifies the inline content of the grammar or the filename where to retrieve the grammar.

  • If the sequence of characters cannot be parsed properly as described above, then it is considered to be the inline content of the SRGS grammar.