Example #1
0
/* 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;
  }
Example #2
0
/* Production 2, chapter 3.4 CORBA 2.3.1, added pragma id and prefix parsing, moved semicolon after value to production 14-17 */
  public void definition() {
 /*@bgen(jjtree) definition */
  ASTdefinition jjtn000 = new ASTdefinition(this, IDLParserTreeConstants.JJTDEFINITION);
  bool jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
      case 48:
      case 49:
      case 61:
      case 62:
      case 66:
        type_dcl();
        jj_consume_token(12);
        break;
      case 32:
        const_dcl();
        jj_consume_token(12);
        break;
      case 76:
        except_dcl();
        jj_consume_token(12);
        break;
      default:
        jj_la1[3] = jj_gen;
        if (jj_2_3(2)) {
          interfacex();
          jj_consume_token(12);
        } else {
          switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
          case 13:
            module();
            jj_consume_token(12);
            break;
          default:
            jj_la1[4] = jj_gen;
            if (jj_2_4(2)) {
              value();
            } else {
              switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
              case IDLParserConstants.PRAGMA:
                pragmaID();
                break;
              default:
                jj_la1[5] = jj_gen;
                jj_consume_token(-1);
                throw new ParseException();
                break;
              }
            }
            break;
          }
        }
        break;
      }
    } 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(ASTdefinition, Object)
  * @param data an instance of buildinfo is expected
  */
 public Object visit(ASTdefinition node, Object data) {
     CheckParameterForBuildInfo(data, node);
     node.childrenAccept(this, data);
     return null;
 }