当前位置: 首页>>代码示例>>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;未经允许,请勿转载。