This topic explains the benefits of using the SymbolNames constants.
The following topics are prerequisites to understanding this topic:
The internal grammatical structure of these the supported languages, including the structure of the syntax tree created for documents parsed with them is subject to change. Moreover, if you are writing code to inspect or traverse a syntax tree you should use the nested SymbolNames
class constants in each language definition to identify the name of each node’s symbol (rather than the symbol name as a string literal) so that future changes to these symbol names will be highlighted via compilation errors.
Additionally, it is a good practice to write test logic using the Debug.Assert method and test for the number and type of the child nodes on a particular node so changes to a node’s child structure in the future will be detected and handled gracefully.
The following topics provide additional information related to this topic.