public void printNextToken(int expectedTokenType, boolean considerSpaceIfAny, int emptyLineRules) { // Set brace flag, it's useful for the scribe while preserving line breaks printComment(CodeFormatter.K_UNKNOWN, NO_TRAILING_COMMENT, emptyLineRules); try { this.currentToken = this.scanner.getNextToken(); if (expectedTokenType != this.currentToken) { throw new AbortFormatting("unexpected token type, expecting:"+expectedTokenType+", actual:"+this.currentToken);//$NON-NLS-1$//$NON-NLS-2$ } print(this.scanner.currentPosition - this.scanner.startPosition, considerSpaceIfAny); } catch (InvalidInputException e) { throw new AbortFormatting(e); } }
case TerminalTokens.TokenNameIdentifier : case TerminalTokens.TokenNameDOT : print(this.scanner.currentPosition - this.scanner.startPosition, false); currentTokenStartPosition = this.scanner.currentPosition; break;
break; case TerminalTokens.TokenNameSEMICOLON : print(this.scanner.currentPosition - this.scanner.startPosition, this.formatter.preferences.insert_space_before_semicolon); break; case TerminalTokens.TokenNameEOF :
hasModifiers = true; treatNextAsTypeAnnotation = true; print(this.scanner.currentPosition - this.scanner.startPosition, !isFirstModifier); isFirstModifier = false; currentTokenStartPosition = this.scanner.currentPosition;
break; case TerminalTokens.TokenNameSEMICOLON : print(this.scanner.currentPosition - this.scanner.startPosition, this.formatter.preferences.insert_space_before_semicolon); break; case TerminalTokens.TokenNameEOF :
case TerminalTokens.TokenNamestrictfp : hasModifiers = true; print(this.scanner.currentPosition - this.scanner.startPosition, !isFirstModifier); isFirstModifier = false; currentTokenStartPosition = this.scanner.currentPosition;
break; case TerminalTokens.TokenNameIdentifier : print(this.scanner.currentPosition - this.scanner.startPosition, false); currentTokenStartPosition = this.scanner.currentPosition; if (++ numberOfIdentifiers == numberOfTokens) { print(this.scanner.currentPosition - this.scanner.startPosition, false); currentTokenStartPosition = this.scanner.currentPosition; break;
public void printNextToken(int[] expectedTokenTypes, boolean considerSpaceIfAny){ printComment(CodeFormatter.K_UNKNOWN, NO_TRAILING_COMMENT); try { this.currentToken = this.scanner.getNextToken(); if (Arrays.binarySearch(expectedTokenTypes, this.currentToken) < 0) { StringBuffer expectations = new StringBuffer(5); for (int i = 0; i < expectedTokenTypes.length; i++){ if (i > 0) { expectations.append(','); } expectations.append(expectedTokenTypes[i]); } throw new AbortFormatting("unexpected token type, expecting:["+expectations.toString()+"], actual:"+this.currentToken);//$NON-NLS-1$//$NON-NLS-2$ } print(this.scanner.currentPosition - this.scanner.startPosition, considerSpaceIfAny); } catch (InvalidInputException e) { throw new AbortFormatting(e); } }
break; case TerminalTokens.TokenNameSEMICOLON : print(this.scanner.currentPosition - this.scanner.startPosition, this.formatter.preferences.insert_space_before_semicolon); break; case TerminalTokens.TokenNameEOF :
hasModifiers = true; treatNextAsTypeAnnotation = true; print(this.scanner.currentPosition - this.scanner.startPosition, !isFirstModifier); isFirstModifier = false; currentTokenStartPosition = this.scanner.currentPosition;
case TerminalTokens.TokenNameIdentifier : case TerminalTokens.TokenNameDOT : print(this.scanner.currentPosition - this.scanner.startPosition, false); currentTokenStartPosition = this.scanner.currentPosition; break;
public void printNextToken(int[] expectedTokenTypes, boolean considerSpaceIfAny){ printComment(CodeFormatter.K_UNKNOWN, NO_TRAILING_COMMENT); try { this.currentToken = this.scanner.getNextToken(); if (Arrays.binarySearch(expectedTokenTypes, this.currentToken) < 0) { StringBuffer expectations = new StringBuffer(5); for (int i = 0; i < expectedTokenTypes.length; i++){ if (i > 0) { expectations.append(','); } expectations.append(expectedTokenTypes[i]); } throw new AbortFormatting("unexpected token type, expecting:["+expectations.toString()+"], actual:"+this.currentToken);//$NON-NLS-1$//$NON-NLS-2$ } print(this.scanner.currentPosition - this.scanner.startPosition, considerSpaceIfAny); } catch (InvalidInputException e) { throw new AbortFormatting(e); } }
case TerminalTokens.TokenNameIdentifier : case TerminalTokens.TokenNameDOT : print(this.scanner.currentPosition - this.scanner.startPosition, false); currentTokenStartPosition = this.scanner.currentPosition; break;
public void printNextToken(int expectedTokenType, boolean considerSpaceIfAny, int emptyLineRules) { // Set brace flag, it's useful for the scribe while preserving line breaks printComment(CodeFormatter.K_UNKNOWN, NO_TRAILING_COMMENT, emptyLineRules); try { this.currentToken = this.scanner.getNextToken(); if (expectedTokenType != this.currentToken) { throw new AbortFormatting("unexpected token type, expecting:"+expectedTokenType+", actual:"+this.currentToken);//$NON-NLS-1$//$NON-NLS-2$ } print(this.scanner.currentPosition - this.scanner.startPosition, considerSpaceIfAny); } catch (InvalidInputException e) { throw new AbortFormatting(e); } }
public void printNextToken(int[] expectedTokenTypes, boolean considerSpaceIfAny){ printComment(CodeFormatter.K_UNKNOWN, NO_TRAILING_COMMENT); try { this.currentToken = this.scanner.getNextToken(); if (Arrays.binarySearch(expectedTokenTypes, this.currentToken) < 0) { StringBuffer expectations = new StringBuffer(5); for (int i = 0; i < expectedTokenTypes.length; i++){ if (i > 0) { expectations.append(','); } expectations.append(expectedTokenTypes[i]); } throw new AbortFormatting("unexpected token type, expecting:["+expectations.toString()+"], actual:"+this.currentToken);//$NON-NLS-1$//$NON-NLS-2$ } print(this.scanner.currentPosition - this.scanner.startPosition, considerSpaceIfAny); } catch (InvalidInputException e) { throw new AbortFormatting(e); } }
public void printNextToken(int expectedTokenType, boolean considerSpaceIfAny, int emptyLineRules) { // Set brace flag, it's useful for the scribe while preserving line breaks printComment(CodeFormatter.K_UNKNOWN, NO_TRAILING_COMMENT, emptyLineRules); try { this.currentToken = this.scanner.getNextToken(); if (expectedTokenType != this.currentToken) { throw new AbortFormatting("unexpected token type, expecting:"+expectedTokenType+", actual:"+this.currentToken);//$NON-NLS-1$//$NON-NLS-2$ } print(this.scanner.currentPosition - this.scanner.startPosition, considerSpaceIfAny); } catch (InvalidInputException e) { throw new AbortFormatting(e); } }