@Override protected boolean token(Token token, int index) { bufferWhitespaceBefore(token, index); List<Token> structure = token.getInternalStructure(); if (token.tokenType == TokenNameCOMMENT_LINE) { handleSingleLineComment(token, index); } else if (structure != null && !structure.isEmpty()) { handleMultiLineComment(token, index); } else { flushBuffer(token.originalStart); if (token.isToEscape()) { this.buffer.append(this.tm.toString(token)); flushBuffer(token.originalEnd + 1); } else { this.counter = token.originalEnd + 1; } } if (token.tokenType == TokenNameStringLiteral) this.stringLiteralsInLine.add(token); if (getNext() == null) { for (int i = 0; i < token.getLineBreaksAfter(); i++) bufferLineSeparator(null, i + 1 == token.getLineBreaksAfter()); char lastChar = this.source.charAt(this.sourceLimit - 1); if (token.getLineBreaksAfter() == 0 && (lastChar == '\r' || lastChar == '\n')) bufferLineSeparator(null, false); flushBuffer(this.sourceLimit); } return true; }
@Override protected boolean token(Token token, int index) { bufferWhitespaceBefore(token, index); List<Token> structure = token.getInternalStructure(); if (token.tokenType == TokenNameCOMMENT_LINE) { handleSingleLineComment(token, index); } else if (structure != null && !structure.isEmpty()) { handleMultiLineComment(token, index); } else { flushBuffer(token.originalStart); if (token.isToEscape()) { this.buffer.append(this.tm.toString(token)); flushBuffer(token.originalEnd + 1); } else { this.counter = token.originalEnd + 1; } } if (token.tokenType == TokenNameStringLiteral) this.stringLiteralsInLine.add(token); if (getNext() == null) { for (int i = 0; i < token.getLineBreaksAfter(); i++) bufferLineSeparator(null, i + 1 == token.getLineBreaksAfter()); char lastChar = this.source.charAt(this.sourceLimit - 1); if (token.getLineBreaksAfter() == 0 && (lastChar == '\r' || lastChar == '\n')) bufferLineSeparator(null, false); flushBuffer(this.sourceLimit); } return true; }
@Override protected boolean token(Token token, int index) { bufferWhitespaceBefore(token, index); List<Token> structure = token.getInternalStructure(); if (token.tokenType == TokenNameCOMMENT_LINE) { handleSingleLineComment(token, index); } else if (structure != null && !structure.isEmpty()) { handleMultiLineComment(token, index); } else { flushBuffer(token.originalStart); if (token.isToEscape()) { this.buffer.append(this.tm.toString(token)); flushBuffer(token.originalEnd + 1); } else { this.counter = token.originalEnd + 1; } } if (token.tokenType == TokenNameStringLiteral) this.stringLiteralsInLine.add(token); if (getNext() == null) { for (int i = 0; i < token.getLineBreaksAfter(); i++) bufferLineSeparator(null, i + 1 == token.getLineBreaksAfter()); char lastChar = this.source.charAt(this.sourceLimit - 1); if (token.getLineBreaksAfter() == 0 && (lastChar == '\r' || lastChar == '\n')) bufferLineSeparator(null, false); flushBuffer(this.sourceLimit); } return true; }