Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: compiler/java/com/google/dart/compiler/parser/DartScanner.java

Issue 9030028: Issue 1039: Nested comments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Expand CommentTest.java Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/parser/CommentTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/parser/DartScanner.java
diff --git a/compiler/java/com/google/dart/compiler/parser/DartScanner.java b/compiler/java/com/google/dart/compiler/parser/DartScanner.java
index 84a75a5fe62e210273335093b98de624c8ae7c06..38024deabc4ab7c02a9422c2edc2330bd6c94d07 100644
--- a/compiler/java/com/google/dart/compiler/parser/DartScanner.java
+++ b/compiler/java/com/google/dart/compiler/parser/DartScanner.java
@@ -1382,15 +1382,22 @@ public class DartScanner {
int start = currPos.pos - 1;
int line = currPos.line;
int col = currPos.col;
+ int commentDepth = 1;
advance();
while (!isEos()) {
int first = lookahead(0);
advance();
if (first == '*' && is('/')) {
- Token result = select(Token.COMMENT);
- int stop = internalState.lookaheadPos[0].pos;
- commentLocation(start, stop, line, internalState.lookaheadPos[0].line, col);
- return result;
+ if(--commentDepth == 0) {
+ Token result = select(Token.COMMENT);
+ int stop = internalState.lookaheadPos[0].pos;
+ commentLocation(start, stop, line, internalState.lookaheadPos[0].line, col);
+ return result;
+ }
+ advance();
+ } else if (first == '/' && is('*')) {
+ commentDepth++;
+ advance();
}
}
int stop = internalState.lookaheadPos[0].pos;
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/parser/CommentTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698