Skip to content

Commit 30203ff

Browse files
committed
Round 7: variable template specialization, local struct emit, pack expansion
Parser: - Variable template specialization: zero<float> = 0.0f consumed in parseFunctionOrVariableName - Local struct definition: emitted via CodeGen.generateNode including Point type - Args&&... variadic params: isVariadic tracked from type-level pack expansion - args... in call args: PostfixExpr wraps pack-expanded arguments CodeGen/CppBuild: - LambdaExpr.isMutable: emitted after params, before -> - FunctionDecl = default / = delete: properly set and emitted - TopLevelStatements hoisted to namespace scope - Explicit template instantiations emitted before namespace Processing - Trailing return type decltype(...): auto name(params) -> decltype(...)
1 parent b46149e commit 30203ff

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

mode/CppMode.jar

151 Bytes
Binary file not shown.

src/java/Parser.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,21 @@ private String parseFunctionOrVariableName() {
13221322
advance();
13231323
name += "::" + expectIdentifier().text();
13241324
}
1325+
// Variable template specialization: "zero<float>" -- consume <args>
1326+
if (checkOp("<") && looksLikeTemplateArgList()) {
1327+
StringBuilder sb = new StringBuilder(name);
1328+
sb.append("<");
1329+
advance(); // consume <
1330+
int depth = 1;
1331+
while (!isAtEnd() && depth > 0) {
1332+
if (checkOp("<")) { depth++; sb.append(advance().text()); }
1333+
else if (checkOp(">")) { depth--; if (depth > 0) sb.append(advance().text()); else advance(); }
1334+
else if (checkOp(">>")) { depth -= 2; splitTrailingShiftIntoTwoCloseAngles(); if (depth > 0) sb.append(advance().text()); else advance(); }
1335+
else sb.append(advance().text());
1336+
}
1337+
sb.append(">");
1338+
name = sb.toString();
1339+
}
13251340
return name;
13261341
}
13271342

0 commit comments

Comments
 (0)