X-Git-Url: http://git.phpeclipse.com diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/SQLLexx.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/SQLLexx.java index e901266..42c6276 100644 --- a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/SQLLexx.java +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/SQLLexx.java @@ -130,22 +130,12 @@ public class SQLLexx { p.mark(); // If we have '/*', it's a comment till '*/' found or eof if (p.peek() == '*') { - StringBuffer value = new StringBuffer(); - c = p.getNext(); - value.append('/'); - while (!( c == '*' && p.peek() == '/' ) && !p.isDone()) { - value.append(c); - c = p.getNext(); - } - if (!p.isDone()){ - value.append(c); - c = p.getNext(); - value.append(c); - } - tokens.addElement(new Token(Token.COMMENT, value.toString(), offset, offset + value.length())); + tokens.addElement(tokenizeComment(p, offset)); } else { // It's not '/*' , so it's a group token - tokens.addElement(new Token(Token.GROUP, group, offset, offset + 1)); + // BCH ??? what's this business about groups? + // Shouldn't '/' be a divide operator? + tokens.addElement(new Token(Token.SYMBOL, new String(new char[] {c}) /*group*/, offset, offset + 1)); p.reset(); } // Adds SYMBOL token; @@ -163,4 +153,25 @@ public class SQLLexx { // } return tokens; } + /** + * @param tokens + * @param p + * @param offset + */ + private static Token tokenizeComment(StringPointer p, int offset) { + char c; + StringBuffer value = new StringBuffer(); + c = p.getNext(); + value.append('/'); + while (!( c == '*' && p.peek() == '/' ) && !p.isDone()) { + value.append(c); + c = p.getNext(); + } + if (!p.isDone()){ + value.append(c); + c = p.getNext(); + value.append(c); + } + return new Token(Token.COMMENT, value.toString(), offset, offset + value.length()); + } }