Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
 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);
     }
 }