return;
}
List<String> lines = new ArrayList<String>(canvas.getLineCount());
LexerSource lexerSource = new ByteArrayLexerSource(title, utf8Script, lines, 0, true);
lexer.reset();
lexer.setSource(lexerSource);
lexer.setState(RubyYaccLexer.LexState.EXPR_BEG);
// remember bounds of current token
int leftTokenBorder = 0;
int rightTokenBorder = 0;
int t = 0;
int prevt = 0;
int lastCommentEnd = 0;
ArrayList<StyleRange> ranges = new ArrayList<StyleRange>(200);
ArrayList<Integer> intRanges = new ArrayList<Integer>(400);
try {
boolean keepParsing = true;
while (keepParsing) {
/* take care of comments, which are stripped out by the lexer */
int[] upcomingComment = null;
while ((rightTokenBorder >= lastCommentEnd || rightTokenBorder == 0 ) && (upcomingComment = getUpcomingCommentPos(utf8Script, rightTokenBorder)) != null){
leftTokenBorder = upcomingComment[0];
rightTokenBorder = leftTokenBorder + upcomingComment[1];
lastCommentEnd = rightTokenBorder;
//System.out.println("Found comment -> [" + leftTokenBorder + "," + rightTokenBorder + "]");
ranges.add(tokenToStyleRange(TOKEN_COMMENT, null, prevt));
int left = leftTokenBorder - encodingBytes[leftTokenBorder];
int right = rightTokenBorder-encodingBytes[rightTokenBorder]- left;
intRanges.add(left);
intRanges.add(right);
}
/* read language syntax */
int oldOffset = lexerSource.getOffset();
keepParsing = lexer.advance();
prevt = t;
t = lexer.token();
Object v = lexer.value();
leftTokenBorder = oldOffset;
if (leftTokenBorder < lastCommentEnd && lexerSource.getOffset() > lastCommentEnd){
leftTokenBorder = lastCommentEnd;
}
rightTokenBorder = lexerSource.getOffset();
//System.out.println("Found token " + t + " -> " + lexer.value() + " [" + leftTokenBorder + "," + rightTokenBorder + "]");
// skip whitespace and error formatting
if (t != '\n' && t != -1){