/* handling of pragma prefix */ public void pragmaPrefix() { String val = ""; jj_consume_token(IDLParserConstants.PRAGMA); jj_consume_token(IDLParserConstants.PRAGMAPREFIX); val = string_literal(); val = val.Trim(); if (m_lastPrefix.Equals(val)) { {if (true) return;} } // same pragma prefix, nothing to do if ( (!(val.Equals(""))) && (m_symbolTable.getCurrentScope() != m_symbolTable.getTopScope())) { {if (true) throw new ParseException("invalid scope for using a #pragma prefix, only usable outside of module declarations");} } if (m_symbolTable.isPragmaScopeOpen()) { // close the scopes up to the pragma-scope (incl. pragma scope) m_symbolTable.closePragmaScope(); // close module node for pragma jjtree.closeNodeScope(m_modForPrefix, true); jjtree.closeNodeScope(m_defForPrefix, true); m_modForPrefix = null; m_defForPrefix = null; // open scopes for new pragma, if val != "" m_symbolTable.openPragmaScope(val); } else { m_symbolTable.openPragmaScope(val); } // open a defintion and an included module node into the parse tree if val != "" --> insert a module opening for pragma prefix if (!(val.Equals(""))) { m_defForPrefix = new ASTdefinition(this, IDLParserTreeConstants.JJTDEFINITION); jjtree.openNodeScope(m_defForPrefix); m_modForPrefix = new ASTmodule(this, IDLParserTreeConstants.JJTMODULE); jjtree.openNodeScope(m_modForPrefix); m_modForPrefix.setIdent(val); } m_lastPrefix = val; }
/* Production 3, chapter 3.4 in CORBA 2.3.1 spec */ public void module() { /*@bgen(jjtree) module */ ASTmodule jjtn000 = new ASTmodule(this, IDLParserTreeConstants.JJTMODULE); bool jjtc000 = true; jjtree.openNodeScope(jjtn000);String ident = ""; try { jj_consume_token(13); ident = identifier(); m_symbolTable.openScope(ident, false); jj_consume_token(14); while (true) { definition(); switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) { case 13: case 16: case 17: case 18: case 22: case 23: case 32: case 48: case 49: case 61: case 62: case 66: case 76: case IDLParserConstants.PRAGMA: ; break; default: jj_la1[6] = jj_gen; goto label_2; break; } } label_2: ; jj_consume_token(15); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.setIdent(ident); // close scope for this module after parsing m_symbolTable.closeScope(); } catch (Exception jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } {if (true) throw ;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } }
/** * @see parser.IDLParserVisitor#visit(ASTmodule, Object) * @param data an instance of buildInfo is expected */ public Object visit(ASTmodule node, Object data) { CheckParameterForBuildInfo(data, node); Trace.WriteLine("accepting module with ident: " + node.getIdent()); BuildInfo info = (BuildInfo) data; // info contains the scope this module is defined in Scope enclosingScope = info.GetBuildScope(); Scope moduleScope = enclosingScope.getChildScope(node.getIdent()); BuildInfo modInfo = new BuildInfo(moduleScope, info.GetContainterType(), info.GetContainerSymbol()); node.childrenAccept(this, modInfo); Trace.WriteLine("module with ident sucessfully accepted: " + node.getIdent()); return null; }