Can anyone help me with this problem. I need to traverse an Abstract Syntax Tree to replace all the Children's Text in C#
Asked
Active
Viewed 121 times
1 Answers
1
I would say the CommonTree.Text
property is provided for that purpose, but as you can see the method literally does nothing. The CommonTreeAdaptor.SetText
method (inherited from BaseTreeAdaptor
at least throws a NotSupportedException
.
What you need to do is get the IToken
associated with the tree node, probably by calling CommonTreeAdaptor.GetToken
. You can then set the IToken.Text
property of the token, which at least for CommonToken
is implemented.

Sam Harwell
- 97,721
- 20
- 209
- 280