Examples of IElementType


Examples of com.intellij.psi.tree.IElementType

   * @param parselet
   *     The parselet for which the node type is wanted
   * @return The node type.
   */
  public static IElementType getInfixPsiElement(InfixParselet parselet) {
    IElementType elm = INFIX_PARSELET_TO_PSI_ELEMENT.get(parselet);
    if (elm == null) {
      return MathematicaElementTypes.FAILBACK;
    }
    return elm;
  }
View Full Code Here

Examples of com.intellij.psi.tree.IElementType

   * @param parselet
   *     The parselet for which the type is wanted
   * @return The element of the node in the AST tree
   */
  public static IElementType getPrefixPsiElement(PrefixParselet parselet) {
    IElementType elm = PREFIX_TO_PSI_ELEMENT.get(parselet);
    if (elm == null) {
      return MathematicaElementTypes.FAILBACK;
    }
    return elm;
  }
View Full Code Here

Examples of com.intellij.psi.tree.IElementType

    this.myPrecedence = precedence;
  }

  @Override
  public MathematicaParser.Result parse(MathematicaParser parser, MathematicaParser.Result left) throws CriticalParserError {
    IElementType token = parser.getTokenType();
    IElementType psiElement = ParseletProvider.getInfixPsiElement(this);
    PsiBuilder.Marker postfixMarker = left.getMark().precede();
    parser.advanceLexer();
    postfixMarker.done(psiElement);
    return MathematicaParser.result(postfixMarker, token, true);
  }
View Full Code Here

Examples of com.intellij.psi.tree.IElementType

      tagSetMark.done(MathematicaElementTypes.TAG_SET_EXPRESSION);
      return MathematicaParser.result(tagSetMark, MathematicaElementTypes.TAG_SET_EXPRESSION, false);
    }

//    IElementType tokenType = parser.getTokenTypeSave(tagSetMark);
    IElementType tokenType = parser.getTokenType();

    if (tokenType == null) {
      parser.error(ParserBundle.message("TagSet.missing.set"));
      tagSetMark.done(MathematicaElementTypes.TAG_SET_EXPRESSION);
      return MathematicaParser.result(tagSetMark, MathematicaElementTypes.TAG_SET_EXPRESSION, false);
    }

    // Form expr0 /: expr1 =. where nothing needs to be parsed right of the =.
    if (tokenType.equals(MathematicaElementTypes.UNSET)) {
      parser.advanceLexer();
      tagSetMark.done(MathematicaElementTypes.TAG_UNSET_EXPRESSION);
      return MathematicaParser.result(tagSetMark, MathematicaElementTypes.TAG_UNSET_EXPRESSION, expr1.isParsed());
    }

    // Form expr0 /: expr1 := expr2 or expr0 /: expr1 = expr2 where we need to parse expr2
    if ((tokenType.equals(MathematicaElementTypes.SET)) || (tokenType.equals(MathematicaElementTypes.SET_DELAYED))) {
      parser.advanceLexer();
      MathematicaParser.Result expr2 = parser.parseExpression(myPrecedence);
      IElementType endType = tokenType.equals(MathematicaElementTypes.SET) ? MathematicaElementTypes.TAG_SET_EXPRESSION : MathematicaElementTypes.TAG_SET_DELAYED_EXPRESSION;
      if (!expr2.isValid()) {
        parser.error(ParserBundle.message("General.expr.expected"));
      }

      tagSetMark.done(endType);
View Full Code Here

Examples of com.intellij.psi.tree.IElementType

  }

  @Override
  public MathematicaParser.Result parse(MathematicaParser parser) throws CriticalParserError {
    PsiBuilder.Marker blankMark = parser.mark();
    IElementType token = BLANK_NULL_SEQUENCE_EXPRESSION;
    parser.advanceLexer();
    MathematicaParser.Result result = parser.parseExpression(myPrecedence);
    blankMark.done(token);
    return MathematicaParser.result(blankMark, token, !result.isValid() || result.isParsed());
  }
View Full Code Here

Examples of com.intellij.psi.tree.IElementType

  }

  @Override
  public MathematicaParser.Result parse(MathematicaParser parser) throws CriticalParserError {
    PsiBuilder.Marker symbolMark = parser.mark();
    final IElementType tokenType = parser.getTokenType();
    if (SLOTS.contains(tokenType)) {
      parser.advanceLexer();
      symbolMark.done(tokenType);
      return MathematicaParser.result(symbolMark, tokenType, true);
    } else {
View Full Code Here

Examples of com.intellij.psi.tree.IElementType

        return MathematicaParser.result(mainMark, MathematicaElementTypes.FUNCTION_CALL_EXPRESSION, true);
      }
    }

    parser.error(ParserBundle.message("General.closing", "']'"));
    IElementType expressionType = isPartExpr ? MathematicaElementTypes.PART_EXPRESSION : MathematicaElementTypes.FUNCTION_CALL_EXPRESSION;
    mainMark.done(expressionType);
    return MathematicaParser.result(mainMark, expressionType, false);

  }
View Full Code Here

Examples of com.intellij.psi.tree.IElementType

  @Override
  public MathematicaParser.Result parse(MathematicaParser parser, MathematicaParser.Result left) throws CriticalParserError {
    if (!left.isValid()) return MathematicaParser.notParsed();
    PsiBuilder.Marker compoundExprMark = left.getMark().precede();
    IElementType token = MathematicaElementTypes.COMPOUND_EXPRESSION_EXPRESSION;
    parser.advanceLexer();

    boolean ok = true;

    while (true) {
View Full Code Here

Examples of com.intellij.psi.tree.IElementType

  }

  @Override
  public MathematicaParser.Result parse(MathematicaParser parser) throws CriticalParserError {
    PsiBuilder.Marker symbolMark = parser.mark();
    IElementType finalExpressionType;
    final IElementType tokenType = parser.getTokenType();
    if (tokenType.equals(IDENTIFIER)) {
      finalExpressionType = SYMBOL_EXPRESSION;
    } else if (tokenType.equals(STRINGIFIED_IDENTIFIER)) {
      finalExpressionType = STRINGIFIED_SYMBOL_EXPRESSION;
    } else {
      return MathematicaParser.notParsed();
    }
    parser.advanceLexer();
View Full Code Here

Examples of com.intellij.psi.tree.IElementType

  public MathematicaParser.Result parse(MathematicaParser parser, MathematicaParser.Result left) throws CriticalParserError {
    if (!left.isValid()) {
      return MathematicaParser.notParsed();
    }
    PsiBuilder.Marker blankMark = left.getMark().precede();
    IElementType token = MathematicaElementTypes.BLANK_NULL_SEQUENCE_EXPRESSION;
    parser.advanceLexer();
    if (!parser.isNextWhitespace() && !parser.eof() && parser.getTokenType().equals(MathematicaElementTypes.IDENTIFIER)) {
      final PrefixParselet symbolParselet = ParseletProvider.getPrefixParselet(MathematicaElementTypes.IDENTIFIER);
      symbolParselet.parse(parser);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.