Package com.intellij.psi.tree

Examples of com.intellij.psi.tree.IElementType


   *     current character offset
   * @return true, if the current offset is a closing quote
   */
  @Override
  public boolean isClosingQuote(HighlighterIterator iterator, int offset) {
    final IElementType tokenType = iterator.getTokenType();

    if (tokenType.equals(STRING_LITERAL_END)) {
      int start = iterator.getStart();
      int end = iterator.getEnd();
      return end - start >= 1 && offset == end - 1;
    }
    return false;
View Full Code Here


                                             @Nullable Alignment alignment,
                                             SpacingBuilder spacingBuilder,
                                             @Nullable Wrap wrap,
                                             CommonCodeStyleSettings codeStyleSettings,
                                             MathematicaCodeStyleSettings mathematicaSettings) {
    final IElementType elementType = node.getElementType();
    if (elementType == FUNCTION_CALL_EXPRESSION) {
      return new MathematicaFunctionBlock(node, alignment, spacingBuilder, wrap, codeStyleSettings, mathematicaSettings);
    } else if (elementType == LIST_EXPRESSION) {
      return new MathematicaListBlock(node, alignment, spacingBuilder, wrap, codeStyleSettings, mathematicaSettings);
    } else {
View Full Code Here

* @author patrick (11/1/13)
*/
public class MathematicaIndentProcessor {

  public static Indent getChildIndent(ASTNode node) {
    IElementType elementType = node.getElementType();
    ASTNode parent = node.getTreeParent();
    IElementType parentType = parent != null ? parent.getElementType() : null;
    ASTNode grandfather = parent != null ? parent.getTreeParent() : null;
    IElementType grandfatherType = grandfather != null ? grandfather.getElementType() : null;
    ASTNode prevSibling = FormatterUtil.getPreviousNonWhitespaceSibling(node);
    IElementType prevSiblingElementType = prevSibling != null ? prevSibling.getElementType() : null;


    if (parent == null ||
        elementType == COMMENT ||
        parentType == FILE) {
View Full Code Here

  @Override
  protected List<Block> buildChildren() {
    List<Block> blocks = new ArrayList<Block>();
    Alignment baseAlignment = Alignment.createAlignment();
    IElementType parentType = getNode().getElementType();
    PsiElement psi = getNode().getPsi();


    for (ASTNode child = myNode.getFirstChildNode(); child != null; child = child.getTreeNext()) {
      IElementType childType = child.getElementType();
      if (child.getTextRange().getLength() == 0 ||
          childType == WHITE_SPACE ||
          childType == LINE_BREAK) continue;

      blocks.add(createMathematicaBlock(child,
View Full Code Here

    List<Block> result = Lists.newArrayList();
    ChildState state = ChildState.BEFORE_BRACE;
    Alignment childAlignment = null;

    for (ASTNode child = getNode().getFirstChildNode(); child != null; child = child.getTreeNext()) {
      IElementType childType = child.getElementType();

      if (child.getTextRange().getLength() == 0 ||
          childType == WHITE_SPACE ||
          childType == LINE_BREAK) continue;
View Full Code Here

    List<Block> result = Lists.newArrayList();
    ChildState state = ChildState.BEFORE_BRACE;
    Alignment childAlignment = null;

    for (ASTNode child = getNode().getFirstChildNode(); child != null; child = child.getTreeNext()) {
      IElementType childType = child.getElementType();

      if (child.getTextRange().getLength() == 0 ||
          childType == WHITE_SPACE ||
          childType == LINE_BREAK) continue;
View Full Code Here

    PsiBuilder.Marker patternOptional = left.getMark().precede();
    parser.advanceLexer();
    MathematicaParser.Result result = parser.parseExpression(myPrecedence);

    IElementType expressionType = left.getToken().equals(MathematicaElementTypes.SYMBOL_EXPRESSION) ?
        MathematicaElementTypes.PATTERN_EXPRESSION : MathematicaElementTypes.OPTIONAL_EXPRESSION;

    if (!result.isParsed()) {
      parser.error(ParserBundle.message("Pattern.error"));
    }
View Full Code Here

  public MathematicaParser.Result parse(MathematicaParser parser) throws CriticalParserError {
    // should never happen
    if (!parser.getTokenType().equals(MathematicaElementTypes.LEFT_PAR)) {
      return MathematicaParser.notParsed();
    }
    IElementType token = ParseletProvider.getPrefixPsiElement(this);
    PsiBuilder.Marker groupMark = parser.mark();
    parser.advanceLexer();

    if (parser.eof()) {
      parser.error(ParserBundle.message("General.eof"));
View Full Code Here

  }

  @Override
  public MathematicaParser.Result parse(MathematicaParser parser) throws CriticalParserError {
    PsiBuilder.Marker blankMark = parser.mark();
    IElementType token = MathematicaElementTypes.BLANK_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

  }

  @Override
  public MathematicaParser.Result parse(MathematicaParser parser) throws CriticalParserError {
    PsiBuilder.Marker blankMark = parser.mark();
    IElementType token = MathematicaElementTypes.BLANK_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

TOP

Related Classes of com.intellij.psi.tree.IElementType

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.