Package java_cup.runtime

Examples of java_cup.runtime.Symbol


    assert stInScriptin != -1;
    astLexer.yybegin(stInScriptin);

    tokens.clear();
    try {
      Symbol symbol = null;
      do {
        symbol = astLexer.next_token();
        tokens.add(symbol);
      } while (symbol != null && symbol.sym != 0);
    } catch (Exception e) {
View Full Code Here


   */
  public int getPreviousTokenEndOffset(Symbol token, int startOffset)
      throws CoreException {
    setOffset(startOffset);
    int res = startOffset;
    Symbol curr = readNext();
    while (curr != null && curr.sym != token.sym) {
      res = getCurrentEndOffset();
      curr = readNext();
    }
    return res;
View Full Code Here

      int newModifiers = (Integer) event.getNewValue();
      TextEditGroup editGroup = getEditGroup(event);

      TokenScanner scanner = getScanner();

      Symbol tok = scanner.readNext(offset/* , false */);
      int startPos = scanner.getCurrentStartOffset();
      int nextStart = startPos;
      // prepare the modifiers 'syms'
      PHPVersion phpVersion = this.scanner.getPHPVersion();
      int modifiers[] = new int[] {
View Full Code Here

          .getLocationInParent();
      if (propertyDescriptor == IfStatement.TRUE_STATEMENT_PROPERTY
          || propertyDescriptor == IfStatement.FALSE_STATEMENT_PROPERTY) {
        rewriteIfBlocks(node, editGroup, shouldBeCurly);
      } else if (propertyDescriptor == WhileStatement.BODY_PROPERTY) {
        Symbol symbol = SymbolsProvider.getSymbol(
            SymbolsProvider.END_WHILE_ID, scanner.getPHPVersion());
        rewriteBlock(node, editGroup, shouldBeCurly, "endwhile", symbol); //$NON-NLS-1$
      } else if (propertyDescriptor == ForStatement.BODY_PROPERTY) {
        Symbol symbol = SymbolsProvider.getSymbol(
            SymbolsProvider.END_FOR_ID, scanner.getPHPVersion());
        rewriteBlock(node, editGroup, shouldBeCurly, "endfor", symbol); //$NON-NLS-1$
      } else if (propertyDescriptor == ForEachStatement.STATEMENT_PROPERTY) {
        Symbol symbol = SymbolsProvider
            .getSymbol(SymbolsProvider.END_FOREACH_ID,
                scanner.getPHPVersion());
        rewriteBlock(node, editGroup, shouldBeCurly, "endforeach", //$NON-NLS-1$
            symbol);
      } else if (propertyDescriptor == SwitchStatement.BODY_PROPERTY) {
        Symbol symbol = SymbolsProvider.getSymbol(
            SymbolsProvider.END_SWITCH_ID, scanner.getPHPVersion());
        rewriteBlock(node, editGroup, shouldBeCurly, "endswitch", //$NON-NLS-1$
            symbol);
      }
    }
View Full Code Here

        doTextReplace(blockStart, 1, "{", editGroup); //$NON-NLS-1$
        // Change the closing mark to be a closing brace

        doTextInsert(blockEnd + 1, "\n}", editGroup); //$NON-NLS-1$
        // remove the endif token at this stage
        Symbol endIfSymbol = SymbolsProvider.getSymbol(
            SymbolsProvider.END_IF_ID, scanner.getPHPVersion());
        try {
          int endifPos = getScanner().getTokenStartOffset(
              endIfSymbol, blockEnd);
          // search for the semicolon that might appear after that
View Full Code Here

      } else {
        pos = doVisit(node, ForStatement.INITIALIZERS_PROPERTY, pos);
      }

      // position after first semicolon
      Symbol semicolonSym = SymbolsProvider.getSymbol(
          SymbolsProvider.SEMICOLON_ID, scanner.getPHPVersion());
      pos = getScanner().getTokenEndOffset(semicolonSym, pos);

      pos = rewriteNodeList(node, ForStatement.EXPRESSION_PROPERTY, pos,
          "", ", "); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

    }
    return result;
  }

  protected Symbol createSymbol(int symbolNumber) {
    Symbol symbol = super.createSymbol(symbolNumber);

    switch (symbolNumber) {
    case CompilerParserConstants.T_FUNCTION:
    case CompilerParserConstants.T_CONST:
    case CompilerParserConstants.T_VAR:
View Full Code Here

    final Scanner lexer = this.ast.lexer();
    final lr_parser phpParser = this.ast.parser();
    progressMonitor.worked(1);
    phpParser.setScanner(lexer);
    progressMonitor.worked(2);
    final Symbol symbol = phpParser.parse();
    progressMonitor.done();
    if (symbol == null || !(symbol.value instanceof Program)) {
      return null;
    }
    Program p = (Program) symbol.value;
View Full Code Here

    final Scanner lexer = getLexer(ast, reader, phpVersion, aspTagsAsPhp,
        useShortTags);
    final lr_parser phpParser = getParser(phpVersion, ast);
    phpParser.setScanner(lexer);

    final Symbol symbol = phpParser.parse();
    return symbol == null ? null : (Program) symbol.value;
  }
View Full Code Here

    }
    return result;
  }

  protected Symbol createSymbol(int symbolNumber) {
    Symbol symbol = super.createSymbol(symbolNumber);

    switch (symbolNumber) {
    case ParserConstants.T_FUNCTION:
    case ParserConstants.T_CONST:
    case ParserConstants.T_VAR:
View Full Code Here

TOP

Related Classes of java_cup.runtime.Symbol

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.