public static boolean isNotInStreams(PsiBuilder builder, int level) { IElementType next1Element = builder.lookAhead(2); if (next1Element != null && next1Element != BallerinaTypes.WHERE) { return true; } return false; }
public static boolean isVarDef(PsiBuilder builder, int level) { IElementType lookAhead = builder.lookAhead(0); if (lookAhead == BallerinaTypes.LEFT_PARENTHESIS) { return false; } return false; }
public static boolean isGroupType(PsiBuilder builder, int level) { IElementType lookAhead = builder.lookAhead(1); if (lookAhead == BallerinaTypes.ADD || lookAhead == BallerinaTypes.SUB) { return false; } return false; }
public static boolean restDescriptorPredicate(PsiBuilder builder, int level) { IElementType next1Element = builder.lookAhead(-1); return next1Element != TokenType.WHITE_SPACE; }
public static boolean isNotARestParameter(PsiBuilder builder, int level) { IElementType lookAhead = builder.lookAhead(1); if (lookAhead == BallerinaTypes.ELLIPSIS) { return false; } if (lookAhead == BallerinaTypes.LEFT_BRACKET) { IElementType lookAhead3 = builder.lookAhead(3); if (lookAhead3 == BallerinaTypes.ELLIPSIS) { return false; } } return true; }
public static boolean shiftExprPredicate(PsiBuilder builder, int level) { IElementType next1Element = builder.lookAhead(-1); return next1Element != TokenType.WHITE_SPACE; }
public static boolean isNotAResourceDefinition(PsiBuilder builder, int level) { if (builder.getTokenType() != BallerinaTypes.IDENTIFIER) { return false; } IElementType next1Element = builder.lookAhead(1); if (next1Element != null && next1Element.toString().equals("(")) { return true; } return false; }
public static boolean isPackageExpected(PsiBuilder builder, int level) { IElementType next1Element = builder.lookAhead(1); if (next1Element == null || (next1Element != BallerinaTypes.COLON && next1Element != BallerinaTypes.RIGHT_PARENTHESIS)) { return true; IElementType next2Element = builder.lookAhead(2); if (next2Element == null || (next2Element != BallerinaTypes.IDENTIFIER && next2Element != BallerinaTypes.RIGHT_BRACE)) { return true; IElementType next3Element = builder.lookAhead(3);
public static boolean hasNextTokens(PsiBuilder builder, boolean enableWhitespace, IElementType... tokens) { for (int i = 0, tokensLength = tokens.length; i < tokensLength; i++) { IElementType lookAheadToken = enableWhitespace ? builder.rawLookup(i) : builder.lookAhead(i); if (lookAheadToken != tokens[i]) { return false; } } return true; }
public static boolean containsTokenInLookahead(PsiBuilder builder, IElementType token, int maxLookahead, boolean allowWhitespace) { int i = 0; while (i < maxLookahead) { IElementType current = allowWhitespace ? builder.lookAhead(i) : builder.rawLookup(i); if (current == null) { return false; } if (current == token) { return true; } i++; } return false; }
protected static boolean isEndTagAhead(PsiBuilder b, int l) { IElementType tokenType = b.getTokenType(); return (tokenType == TT2_OPEN_TAG || tokenType == TT2_OUTLINE_TAG) && b.lookAhead(1) == TT2_END; }
public static boolean parseLabelDeclaration(PsiBuilder b, @SuppressWarnings("unused") int l) { if (b.lookAhead(1) == COLON && b.getTokenType() != RESERVED_SUB) { String tokenText = b.getTokenText(); if (tokenText != null && IDENTIFIER_PATTERN.matcher(tokenText).matches()) { b.advanceLexer(); b.advanceLexer(); return true; } } return false; }