Skip to content

Instantly share code, notes, and snippets.

@jozefchmelar
Last active November 21, 2019 18:26
Show Gist options
  • Save jozefchmelar/2e3b70a0e84d1fa4fc938556a7743491 to your computer and use it in GitHub Desktop.
Save jozefchmelar/2e3b70a0e84d1fa4fc938556a7743491 to your computer and use it in GitHub Desktop.
Writing the text
public override void AcceptVisitor(IAstVisitor visitor)
{
if(Parent is RootAst) // in case it's top level we want to have <p> tag, if it's inside <b> tag we dont need it.
visitor.BeginVisit(this);
if(visitor is IAstWriteableVisitor writeableVisitor)
writeableVisitor.Write(Text); /// here you output the text.
if (Parent is RootAst)
visitor.EndVisit(this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment