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

Unified Diff: frog/minfrog

Issue 9111019: Support for nested comments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | frog/tokenizer.dart » ('j') | frog/tokenizer.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/minfrog
diff --git a/frog/minfrog b/frog/minfrog
index 49335215d9a7bdb04a858767a06b164eab2aec26..810609a6e63138850630df20f361ccbd16b1bd44 100755
--- a/frog/minfrog
+++ b/frog/minfrog
@@ -6965,23 +6965,30 @@ TokenizerBase.prototype.finishSingleLineComment = function() {
}
}
TokenizerBase.prototype.finishMultiLineComment = function() {
- while (true) {
+ var nesting = 1;
+ do {
var ch = this._nextChar();
if (ch == 0) {
return this._finishToken(67/*TokenKind.INCOMPLETE_COMMENT*/);
}
else if (ch == 42) {
if (this._maybeEatChar(47)) {
- if (this._skipWhitespace) {
- return this.next();
- }
- else {
- return this._finishToken(64/*TokenKind.COMMENT*/);
- }
+ nesting--;
}
}
+ else if (ch == 47) {
+ if (this._maybeEatChar(42)) {
+ nesting++;
+ }
+ }
+ }
+ while (nesting > 0)
+ if (this._skipWhitespace) {
+ return this.next();
+ }
+ else {
+ return this._finishToken(64/*TokenKind.COMMENT*/);
}
- return this._errorToken();
}
TokenizerBase.prototype.eatDigits = function() {
while (this._lang_index < this._text.length) {
« no previous file with comments | « no previous file | frog/tokenizer.dart » ('j') | frog/tokenizer.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698