// GPDefSyntaxAnalyzerSem.cs HDO, 2006-08-28 // ------------- // Semantic evaluator for table-driven top-down parsing. // Generated by Coco-2 (PGT). //=====================================|======================================== using System; using System.Text; using System.Collections; using System.Collections.Generic; using Lex = GPDefSyntaxAnalyzerLex; using Syn = GPDefSyntaxAnalyzerSyn; public class GPDefSyntaxAnalyzerSem { public const String MODULENAME = "GPDefSyntaxAnalyzerSem"; public static void GPDefSyntaxAnalyzerSemMethod(Utils.ModuleAction action, out String moduleName) { //-----------------------------------|---------------------------------------- moduleName = MODULENAME; switch (action) { case Utils.ModuleAction.getModuleName: return; case Utils.ModuleAction.initModule: break; case Utils.ModuleAction.resetModule: break; case Utils.ModuleAction.cleanupModule: return; } // switch } // GPDefSyntaxAnalyzerSemMethod // *** start of global SYN and SEM declarations from ATG *** // *** end of global SYN and SEM declarations from ATG *** private static void P_source() { Lex.GETsourceAttr(); for (; ; ) { switch (GPDefSyntaxAnalyzerLex.curCh) { case Utils.EF: Errors.SemError(GPDefSyntaxAnalyzerLex.curLine, GPDefSyntaxAnalyzerLex.curCol, "end of file in source text"); return; case '<': GPDefSyntaxAnalyzerLex.NextCh(); if (GPDefSyntaxAnalyzerLex.curCh == '<') { Errors.Warning(GPDefSyntaxAnalyzerLex.curLine, GPDefSyntaxAnalyzerLex.curCol, "non closed source text before?"); GPDefSyntaxAnalyzerLex.NextCh(); } break; case '>': GPDefSyntaxAnalyzerLex.NextCh(); if (GPDefSyntaxAnalyzerLex.curCh == '>') { GPDefSyntaxAnalyzerLex.curCh = ' '; // force GPDefSyntaxAnalyzerLex to get next character return; } break; default: GPDefSyntaxAnalyzerLex.NextCh(); break; } } } // P_source private static void NT_GPDefSyntaxAnalyzer() { for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: Lex.GETidentAttr(); break; case 2: NT_NonterminalDecl(); break; case 3: NT_TerminalDecl(); break; case 4: NT_RuleDef(); break; case 5: Lex.GETidentAttr(); break; } // switch } // for } // NT_GPDefSyntaxAnalyzer private static void NT_SemDecl() { for (;;) { switch (Syn.Interpret()) { case 0: return; } // switch } // for } // NT_SemDecl private static void NT_SemAction() { for (;;) { switch (Syn.Interpret()) { case 0: return; } // switch } // for } // NT_SemAction private static void NT_NonterminalDecl() { for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: Lex.GETidentAttr(); break; } // switch } // for } // NT_NonterminalDecl private static void NT_TerminalDecl() { for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: Lex.GETidentAttr(); break; case 2: NT_ConstraintDef(); break; } // switch } // for } // NT_TerminalDecl private static void NT_ConstraintDef() { for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: NT_ConstraintRule(); break; } // switch } // for } // NT_ConstraintDef private static void NT_ConstraintRule() { for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: Lex.GETidentAttr(); break; case 2: NT_SetDefinition(); break; } // switch } // for } // NT_ConstraintRule private static void NT_SetDefinition() { for (;;) { switch (Syn.Interpret()) { case 0: return; } // switch } // for } // NT_SetDefinition private static void NT_RuleDef() { for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: Lex.GETidentAttr(); break; case 2: NT_SemDecl(); break; case 3: NT_SynExpr(); break; } // switch } // for } // NT_RuleDef private static void NT_SynExpr() { for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: NT_SynTerm(); break; case 2: NT_SynTerm(); break; } // switch } // for } // NT_SynExpr private static void NT_SynTerm() { for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: NT_SynFact(); break; case 2: NT_SynFact(); break; } // switch } // for } // NT_SynTerm private static void NT_SynFact() { for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: Lex.GETidentAttr(); break; case 2: NT_SynExpr(); break; case 3: NT_SynExpr(); break; case 4: NT_SynExpr(); break; case 5: NT_SemAction(); break; } // switch } // for } // NT_SynFact public delegate void PragmaMethod(); public static PragmaMethod[] pragmaMethods = { new PragmaMethod(P_source) }; public static void StartSem() { //-----------------------------------|---------------------------------------- for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: NT_GPDefSyntaxAnalyzer(); break; } // switch } // for } // StartSem } // GPDefSyntaxAnalyzerSem // End of GPDefSyntaxAnalyzerSem.cs //=====================================|========================================