diff --git a/jetc/JetParser.cpp b/jetc/JetParser.cpp
index 537259e..d4c792b 100755
--- a/jetc/JetParser.cpp
+++ b/jetc/JetParser.cpp
@@ -162,6 +162,48 @@ namespace jetc {
}
}
+ // Advances p from '<' of "... construct, including any nested
+ // tags, counted the same case-insensitive way everything else in this
+ // file matches tag names. Deliberately does NOT call skipOpenTag/
+ // skipQuotedValue/skipEmbeddedTag or any other quote- or tag-aware
+ // scanning on the body text - a comment containing an explanatory '"'
+ // or '\"' (about the code itself, say) previously fell through to
+ // parseFallback()'s generic path, which DOES apply those rules while
+ // hunting for this same closing tag, and silently mislocated it
+ // exactly like the already-documented JS-comment-corrupts-jetc bug
+ // class, just triggered from inside a instead of a //
+ // comment. This only ever advances past '<'/'>' boundaries it
+ // recognizes as comment open/close - nothing inside can affect it.
+ void Parser::skipCommentTag(size_t &p) {
+ p += 8; // "') {
+ if (s[p] == '/' && p + 1 < s.size() && s[p + 1] == '>') selfClosing = true;
+ p++;
+ }
+ if (p < s.size()) p++; // past '>'
+ if (selfClosing) return;
+ int depth = 1;
+ while (p < s.size()) {
+ if (matchTagOpen("comment", p)) {
+ depth++;
+ p++;
+ continue;
+ }
+ if (matchTagClose("comment", p)) {
+ p += 2; // ""
+ while (p < s.size() && isNameChar(s[p])) p++;
+ if (p < s.size() && s[p] == '>') p++;
+ depth--;
+ if (depth == 0) return;
+ continue;
+ }
+ p++;
+ }
+ }
+
bool Parser::skipOpenTag(size_t &p) {
p++; // '<'
while (p < s.size() && isNameChar(s[p])) p++;
@@ -555,6 +597,7 @@ namespace jetc {
continue;
}
if (matchTagOpen("container", pos)) { flush(); nodes.push_back(parseContainerSlot()); continue; }
+ if (matchTagOpen("comment", pos)) { flush(); skipCommentTag(pos); continue; }
if (topLevel && matchTagOpen("tag", pos)) { flush(); nodes.push_back(parseTagDef()); continue; }
flush();
nodes.push_back(parseFallback());
diff --git a/jetc/JetParser.h b/jetc/JetParser.h
index 5b97b05..3d36a18 100755
--- a/jetc/JetParser.h
+++ b/jetc/JetParser.h
@@ -61,6 +61,15 @@ namespace jetc {
void skipQuotedValue(size_t &p);
void skipEmbeddedTag(size_t &p);
+ // ... must be fully inert regardless of what's
+ // inside it - unlike the generic parseFallback/scanBody path this
+ // tag used to fall through to (which applies the same quote/
+ // backslash-escape and nested-tag scanning real Jet syntax needs),
+ // this tracks only same-tag-name nesting depth via matchTagOpen/
+ // matchTagClose and otherwise ignores every character. See its own
+ // definition for the quote-corruption bug this specifically closes.
+ void skipCommentTag(size_t &p);
+
std::map parseAttrs(bool &hasContainer);
// Scans forward from bodyStart (just after the opening tag's '>') for