public override void EnterSection(ProgramClassParser.SectionContext context) { // if we Enter(..) a node here, it will be detached by ExitParagraph // if we do not, no need to detach anything in ExitSection if (context.SectionHeader() != null) { SectionHeader header = (SectionHeader)context.SectionHeader().Symbol; Enter(new Section(header), context); } else if (context.ParagraphHeader() != null) { ParagraphHeader header = (ParagraphHeader)context.ParagraphHeader().Symbol; Enter(new Paragraph(header), context); } }
public override void EnterSection(ProgramClassParser.SectionContext context) { // if we Enter(..) a node here, it will be detached by ExitParagraph // if we do not, no need to detach anything in ExitSection if (context.SectionHeader() != null) { SectionHeader header = (SectionHeader)context.SectionHeader().Symbol; var section = new Section(header); Enter(section, context); section.SymbolTable.AddSection(section); } else if (context.ParagraphHeader() != null) { ParagraphHeader header = (ParagraphHeader)context.ParagraphHeader().Symbol; var paragraph = new Paragraph(header); Enter(paragraph, context); paragraph.SymbolTable.AddParagraph(paragraph); } }