當前位置: 首頁>>代碼示例>>Java>>正文


Java PsiBuilder.getTokenType方法代碼示例

本文整理匯總了Java中com.intellij.lang.PsiBuilder.getTokenType方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiBuilder.getTokenType方法的具體用法?Java PsiBuilder.getTokenType怎麽用?Java PsiBuilder.getTokenType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.lang.PsiBuilder的用法示例。


在下文中一共展示了PsiBuilder.getTokenType方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseApplicationHandlerDefinitionSignature

import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
public static boolean parseApplicationHandlerDefinitionSignature(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "parseApplicationHandlerDefinitionSignature")) return false;
  boolean r;
  //application handled definition in script only makes sense inside <using terms of> statement
  if (b.getUserData(IS_PARSING_USING_TERMS_FROM_STATEMENT) != Boolean.TRUE || b.getUserData(PARSING_TELL_COMPOUND_STATEMENT) == Boolean.TRUE) return false;

  StringHolder parsedCommandName = new StringHolder();
  String toldApplicationName = getTargetApplicationName(b);
  PsiBuilder.Marker m2 = enter_section_(b, l, _COLLAPSE_, "<parse Application Handler Definition");
  r = parseDictionaryCommandNameInner(b, l + 1, parsedCommandName, toldApplicationName, true, null);
  exit_section_(b, l, m2, DICTIONARY_COMMAND_NAME, r, false, null);

  if (!r) return false;
  // TODO: 06/12/15 may be try to avoid creating PSI here!..
  List<AppleScriptCommand> allCommandsWithName = getAllCommandsWithName(b, parsedCommandName.value, toldApplicationName, false, null);

  for (AppleScriptCommand command : allCommandsWithName) {
    r = parseParametersForCommand(b, l + 1, command);//custom parsing here
    if (r) {
      break;
    }
  }
  boolean incompleteHandlerCall = !r && allCommandsWithName.size() > 0 && (b.getTokenType() == NLS || b.eof());
  return r || incompleteHandlerCall;

}
 
開發者ID:ant-druha,項目名稱:AppleScript-IDEA,代碼行數:27,代碼來源:AppleScriptGeneratedParserUtil.java

示例2: parseCommandParameterSelector

import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
private static boolean parseCommandParameterSelector(PsiBuilder b, int l, AppleScriptCommand command,
                                                     StringHolder parsedParameterSelector) {
  if (!recursion_guard_(b, l, "parseCommandParameterSelector")) return false;
  boolean r = false;
  PsiBuilder.Marker m = enter_section_(b, l, _NONE_, "<parse Command Parameter Selector>");//todo check this _AND_
  parsedParameterSelector.value = b.getTokenText() == null ? "" : b.getTokenText();
  while (!b.eof() && b.getTokenType() != NLS && b.getTokenType() != COMMENT) {
    b.advanceLexer();
    if (command.getParameterByName(parsedParameterSelector.value) != null) {
      r = true;
      break;
    }
    parsedParameterSelector.value += " " + b.getTokenText();
  }
  exit_section_(b, l, m, COMMAND_PARAMETER_SELECTOR, r, false, null);
  return r;
}
 
開發者ID:ant-druha,項目名稱:AppleScript-IDEA,代碼行數:18,代碼來源:AppleScriptGeneratedParserUtil.java

示例3: parseCommandHandlerCallExpression

import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
/**
 * <<< COMMAND_HANDLER_CALL >>>
 */
// commandName commandParameters?
public static boolean parseCommandHandlerCallExpression(PsiBuilder b, int l) {
  if (!recursion_guard_(b, l, "parseCommandHandlerCallExpression")) return false;
  boolean r;

  if (nextTokenIs(b, NLS)) return false;
  final String s = b.getTokenText();

  if (s == null || s.length() == 0 || !AppleScriptNames.isIdentifierStart(s.charAt(0))) return false;
  StringHolder parsedCommandName = new StringHolder();
  //get current application name to which messages will be sent in the current block
  String toldApplicationName = getTargetApplicationName(b);
  //if there are <use statements> present in the script
  boolean areThereUseStatements = b.getUserData(WAS_USE_STATEMENT_USED) == Boolean.TRUE;
  Set<String> applicationsToImport = null;
  if (areThereUseStatements) {
    //adding list of application names from use statements
    applicationsToImport = b.getUserData(USED_APPLICATION_NAMES);
  }
  PsiBuilder.Marker m2 = enter_section_(b, l, _COLLAPSE_, "<parse Command Handler Call Expression>");
  // TODO: 19/12/15 need to parse command name together with parameters for each possible application in order to be
  // able to parse the longest possible application name ('open for access' std lib vs 'open' from application dict)
  r = parseDictionaryCommandNameInner(b, l + 1, parsedCommandName, toldApplicationName, areThereUseStatements, applicationsToImport);
  exit_section_(b, l, m2, DICTIONARY_COMMAND_NAME, r, false, null);

  if (!r) return false;
  // TODO: 06/12/15 may be try to avoid creating PSI here!..
  List<AppleScriptCommand> allCommandsWithName = getAllCommandsWithName(b, parsedCommandName.value, toldApplicationName, areThereUseStatements,
          applicationsToImport);

  for (AppleScriptCommand command : allCommandsWithName) {
    r = parseParametersForCommand(b, l + 1, command);
    if (r) {
      break;
    }
  }
  boolean incompleteHandlerCall = !r && allCommandsWithName.size() > 0 && (b.getTokenType() == NLS || b.eof());
  return r || incompleteHandlerCall;
}
 
開發者ID:ant-druha,項目名稱:AppleScript-IDEA,代碼行數:43,代碼來源:AppleScriptGeneratedParserUtil.java

示例4: parseArrow

import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
private void parseArrow(PsiBuilder builder, ParserState parserState) {
    parserState.dontMove = advance(builder);
    IElementType nextTokenType = builder.getTokenType();

    if (nextTokenType != m_types.LBRACE && parserState.isCurrentResolution(letNamedEqParameters)) {
        // let x = ($ANY) => <EXPR>
        parserState.currentScope = markCompleteScope(builder, parserState.scopes, letFunBody, m_types.LET_BINDING, scopeExpression, null);
    }
}
 
開發者ID:reasonml-editor,項目名稱:reasonml-idea-plugin,代碼行數:10,代碼來源:RmlParser.java

示例5: parseFile

import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
@Override
protected void parseFile(PsiBuilder builder, ParserState parserState) {
    IElementType tokenType = null;

    int c = current_position_(builder);
    while (true) {
        parserState.previousTokenType = tokenType;
        tokenType = builder.getTokenType();
        if (tokenType == null) {
            break;
        }

        if (tokenType == m_types.SEMI) {
            parseSemi(builder, parserState);
        } else if (tokenType == m_types.EQ) {
            parseEq(parserState);
        } else if (tokenType == m_types.ARROW) {
            parseArrow(builder, parserState);
        } else if (tokenType == m_types.TRY) {
            parseTry(builder, parserState);
        } else if (tokenType == m_types.SWITCH) {
            parseSwitch(builder, parserState);
        } else if (tokenType == m_types.LIDENT) {
            parseLIdent(builder, parserState);
        } else if (tokenType == m_types.UIDENT) {
            parseUIdent(builder, parserState);
        } else if (tokenType == m_types.ARROBASE) {
            parseArrobase(builder, parserState);
        } else if (tokenType == m_types.PERCENT) {
            parsePercent(builder, parserState);
        }
        // ( ... )
        else if (tokenType == m_types.LPAREN) {
            parseLParen(builder, parserState);
        } else if (tokenType == m_types.RPAREN) {
            parseRParen(builder, parserState);
        }
        // { ... }
        else if (tokenType == m_types.LBRACE) {
            parseLBrace(builder, parserState);
        } else if (tokenType == m_types.RBRACE) {
            parseRBrace(builder, parserState);
        }
        // [ ... ]
        else if (tokenType == m_types.LBRACKET) {
            parseLBracket(builder, parserState);
        } else if (tokenType == m_types.RBRACKET) {
            parseRBracket(builder, parserState);
        }
        // < ... >
        else if (tokenType == m_types.LT) {
            parseLt(builder, parserState);
        } else if (tokenType == m_types.GT || tokenType == m_types.TAG_AUTO_CLOSE) {
            parseGtAutoClose(builder, parserState);
        }
        // Starts an expression
        else if (tokenType == m_types.OPEN) {
            parseOpen(builder, parserState);
        } else if (tokenType == m_types.EXTERNAL) {
            parseExternal(builder, parserState);
        } else if (tokenType == m_types.TYPE) {
            parseType(builder, parserState);
        } else if (tokenType == m_types.MODULE) {
            parseModule(builder, parserState);
        } else if (tokenType == m_types.LET) {
            parseLet(builder, parserState);
        }

        if (parserState.dontMove) {
            parserState.dontMove = false;
        } else {
            builder.advanceLexer();
        }

        if (!empty_element_parsed_guard_(builder, "reasonFile", c)) {
            break;
        }

        c = builder.rawTokenIndex();
    }
}
 
開發者ID:reasonml-editor,項目名稱:reasonml-idea-plugin,代碼行數:82,代碼來源:RmlParser.java

示例6: separator

import com.intellij.lang.PsiBuilder; //導入方法依賴的package包/類
public static boolean separator(PsiBuilder builder, int tokenType) {
    return builder.getTokenType() == CsvTypes.COMMA && builder.getTokenText().equals(CsvCodeStyleSettings.getCurrentSeparator(builder.getProject()));
}
 
開發者ID:SeeSharpSoft,項目名稱:intellij-csv-validator,代碼行數:4,代碼來源:CsvParserUtil.java


注:本文中的com.intellij.lang.PsiBuilder.getTokenType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。