From 0728dbd46328a1cc4ff67135d5e555059eaca29f Mon Sep 17 00:00:00 2001 From: mingodad Date: Tue, 15 Jul 2025 17:53:31 +0200 Subject: [PATCH] Add a comment in generated files pointing out the script generator --- packages/cxx-frontend/src/AST.ts | 1 + packages/cxx-frontend/src/ASTKind.ts | 1 + packages/cxx-frontend/src/ASTSlot.ts | 1 + packages/cxx-frontend/src/ASTVisitor.ts | 1 + packages/cxx-frontend/src/RecursiveASTVisitor.ts | 1 + packages/cxx-frontend/src/TokenKind.ts | 1 + packages/cxx-gen-ast/src/gen_ast_cc.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_decoder_cc.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_decoder_h.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_encoder_cc.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_encoder_h.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_fbs.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_fwd_h.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_h.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_kind_h.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_kind_ts.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_pretty_printer_cc.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_pretty_printer_h.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_printer_cc.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_printer_h.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_recursive_visitor_ts.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_slot_cc.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_slot_ts.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_ts.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_visitor_cc.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_visitor_h.ts | 3 ++- packages/cxx-gen-ast/src/gen_ast_visitor_ts.ts | 3 ++- packages/cxx-gen-ast/src/gen_syntax_cc.ts | 3 ++- packages/cxx-gen-ast/src/gen_syntax_h.ts | 3 ++- packages/cxx-gen-ast/src/gen_token_fwd_h.ts | 3 ++- packages/cxx-gen-ast/src/gen_tokenkind_ts.ts | 3 ++- packages/cxx-gen-ast/src/get_ast_slot_h.ts | 3 ++- packages/cxx-gen-ast/src/kwgen.ts | 1 + packages/cxx-gen-ast/src/new_ast_op_cc.ts | 3 ++- packages/cxx-gen-ast/src/new_ast_op_h.ts | 3 ++- packages/cxx-gen-ast/src/new_ast_rewriter_cc.ts | 3 ++- packages/cxx-gen-ast/src/new_ast_rewriter_h.ts | 3 ++- packages/cxx-gen-lsp/src/gen_enums_cc.ts | 1 + packages/cxx-gen-lsp/src/gen_enums_h.ts | 1 + packages/cxx-gen-lsp/src/gen_fwd_h.ts | 1 + packages/cxx-gen-lsp/src/gen_requests_cc.ts | 1 + packages/cxx-gen-lsp/src/gen_requests_h.ts | 1 + packages/cxx-gen-lsp/src/gen_types_cc.ts | 1 + packages/cxx-gen-lsp/src/gen_types_h.ts | 1 + src/parser/cxx/ast.cc | 1 + src/parser/cxx/ast.fbs | 1 + src/parser/cxx/ast.h | 1 + src/parser/cxx/ast_fwd.h | 1 + src/parser/cxx/ast_kind.h | 1 + src/parser/cxx/ast_pretty_printer.cc | 1 + src/parser/cxx/ast_pretty_printer.h | 1 + src/parser/cxx/ast_printer.cc | 1 + src/parser/cxx/ast_printer.h | 1 + src/parser/cxx/ast_slot.cc | 1 + src/parser/cxx/ast_slot.h | 1 + src/parser/cxx/ast_visitor.cc | 1 + src/parser/cxx/ast_visitor.h | 1 + src/parser/cxx/flatbuffers/ast_decoder.cc | 1 + src/parser/cxx/flatbuffers/ast_encoder.cc | 1 + src/parser/cxx/private/ast_decoder.h | 1 + src/parser/cxx/private/ast_encoder.h | 1 + src/parser/cxx/private/c_keywords-priv.h | 3 ++- src/parser/cxx/private/keywords-priv.h | 3 ++- src/parser/cxx/private/pp_directives-priv.h | 3 ++- src/parser/cxx/symbols.h | 4 ++-- src/parser/cxx/token_fwd.h | 1 + 66 files changed, 100 insertions(+), 35 deletions(-) diff --git a/packages/cxx-frontend/src/AST.ts b/packages/cxx-frontend/src/AST.ts index 8960a0ff..0fd08eb6 100644 --- a/packages/cxx-frontend/src/AST.ts +++ b/packages/cxx-frontend/src/AST.ts @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_ts.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/packages/cxx-frontend/src/ASTKind.ts b/packages/cxx-frontend/src/ASTKind.ts index 6de2d24b..1deae510 100644 --- a/packages/cxx-frontend/src/ASTKind.ts +++ b/packages/cxx-frontend/src/ASTKind.ts @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_kind_ts.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/packages/cxx-frontend/src/ASTSlot.ts b/packages/cxx-frontend/src/ASTSlot.ts index 46650475..0e91c095 100644 --- a/packages/cxx-frontend/src/ASTSlot.ts +++ b/packages/cxx-frontend/src/ASTSlot.ts @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_slot_ts.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/packages/cxx-frontend/src/ASTVisitor.ts b/packages/cxx-frontend/src/ASTVisitor.ts index 6936ac8d..89bc8e0f 100644 --- a/packages/cxx-frontend/src/ASTVisitor.ts +++ b/packages/cxx-frontend/src/ASTVisitor.ts @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_visitor_ts.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/packages/cxx-frontend/src/RecursiveASTVisitor.ts b/packages/cxx-frontend/src/RecursiveASTVisitor.ts index fd04e423..4834e138 100644 --- a/packages/cxx-frontend/src/RecursiveASTVisitor.ts +++ b/packages/cxx-frontend/src/RecursiveASTVisitor.ts @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_recursive_visitor_ts.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/packages/cxx-frontend/src/TokenKind.ts b/packages/cxx-frontend/src/TokenKind.ts index 5da53f8d..c3f30b62 100644 --- a/packages/cxx-frontend/src/TokenKind.ts +++ b/packages/cxx-frontend/src/TokenKind.ts @@ -1,3 +1,4 @@ +// Generated file by: gen_tokenkind_ts.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/packages/cxx-gen-ast/src/gen_ast_cc.ts b/packages/cxx-gen-ast/src/gen_ast_cc.ts index 3e301e46..8f33706a 100644 --- a/packages/cxx-gen-ast/src/gen_ast_cc.ts +++ b/packages/cxx-gen-ast/src/gen_ast_cc.ts @@ -71,7 +71,8 @@ export function gen_ast_cc({ ast, output }: { ast: AST; output: string }) { emit(` return kASTKindNames[int(kind)];`); emit(`}`); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_cc.ts +${cpy_header} #include namespace cxx { diff --git a/packages/cxx-gen-ast/src/gen_ast_decoder_cc.ts b/packages/cxx-gen-ast/src/gen_ast_decoder_cc.ts index 870d2435..22276f6a 100644 --- a/packages/cxx-gen-ast/src/gen_ast_decoder_cc.ts +++ b/packages/cxx-gen-ast/src/gen_ast_decoder_cc.ts @@ -148,7 +148,8 @@ export function gen_ast_decoder_cc({ }); }); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_decoder_cc.ts +${cpy_header} #include // cxx diff --git a/packages/cxx-gen-ast/src/gen_ast_decoder_h.ts b/packages/cxx-gen-ast/src/gen_ast_decoder_h.ts index 96ebba73..476203f8 100644 --- a/packages/cxx-gen-ast/src/gen_ast_decoder_h.ts +++ b/packages/cxx-gen-ast/src/gen_ast_decoder_h.ts @@ -70,7 +70,8 @@ export function gen_ast_decoder_h({ emit(` Arena* pool_ = nullptr;`); emit(`};`); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_decoder_h.ts +${cpy_header} #pragma once #include diff --git a/packages/cxx-gen-ast/src/gen_ast_encoder_cc.ts b/packages/cxx-gen-ast/src/gen_ast_encoder_cc.ts index ff1392e3..2311a24c 100644 --- a/packages/cxx-gen-ast/src/gen_ast_encoder_cc.ts +++ b/packages/cxx-gen-ast/src/gen_ast_encoder_cc.ts @@ -191,7 +191,8 @@ export function gen_ast_encoder_cc({ }); }); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_encoder_cc.ts +${cpy_header} #include // cxx diff --git a/packages/cxx-gen-ast/src/gen_ast_encoder_h.ts b/packages/cxx-gen-ast/src/gen_ast_encoder_h.ts index bdcd944f..6f70e7df 100644 --- a/packages/cxx-gen-ast/src/gen_ast_encoder_h.ts +++ b/packages/cxx-gen-ast/src/gen_ast_encoder_h.ts @@ -78,7 +78,8 @@ export function gen_ast_encoder_h({ emit(`};`); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_encoder_h.ts +${cpy_header} #pragma once #include diff --git a/packages/cxx-gen-ast/src/gen_ast_fbs.ts b/packages/cxx-gen-ast/src/gen_ast_fbs.ts index 8e65366e..646164df 100644 --- a/packages/cxx-gen-ast/src/gen_ast_fbs.ts +++ b/packages/cxx-gen-ast/src/gen_ast_fbs.ts @@ -112,7 +112,8 @@ export function gen_ast_fbs({ ast, output }: { ast: AST; output: string }) { }); } - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_fbs.ts +${cpy_header} namespace cxx.io; table Source { diff --git a/packages/cxx-gen-ast/src/gen_ast_fwd_h.ts b/packages/cxx-gen-ast/src/gen_ast_fwd_h.ts index c2bb569b..7461085a 100644 --- a/packages/cxx-gen-ast/src/gen_ast_fwd_h.ts +++ b/packages/cxx-gen-ast/src/gen_ast_fwd_h.ts @@ -47,7 +47,8 @@ export function gen_ast_fwd_h({ ast, output }: { ast: AST; output: string }) { }); }); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_fwd_h.ts +${cpy_header} #pragma once diff --git a/packages/cxx-gen-ast/src/gen_ast_h.ts b/packages/cxx-gen-ast/src/gen_ast_h.ts index 7c142fcc..cca4afca 100644 --- a/packages/cxx-gen-ast/src/gen_ast_h.ts +++ b/packages/cxx-gen-ast/src/gen_ast_h.ts @@ -138,7 +138,8 @@ template emit(`}`); }); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_h.ts +${cpy_header} #pragma once #include diff --git a/packages/cxx-gen-ast/src/gen_ast_kind_h.ts b/packages/cxx-gen-ast/src/gen_ast_kind_h.ts index b69476ad..02f357ed 100644 --- a/packages/cxx-gen-ast/src/gen_ast_kind_h.ts +++ b/packages/cxx-gen-ast/src/gen_ast_kind_h.ts @@ -43,7 +43,8 @@ export function gen_ast_kind_h({ ast, output }: { ast: AST; output: string }) { emit(`};`); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_kind_h.ts +${cpy_header} #pragma once diff --git a/packages/cxx-gen-ast/src/gen_ast_kind_ts.ts b/packages/cxx-gen-ast/src/gen_ast_kind_ts.ts index 3c9cf86b..213481bf 100644 --- a/packages/cxx-gen-ast/src/gen_ast_kind_ts.ts +++ b/packages/cxx-gen-ast/src/gen_ast_kind_ts.ts @@ -50,7 +50,8 @@ export async function gen_ast_kind_ts({ emit(`}`); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_kind_ts.ts +${cpy_header} ${code.join("\n")} `; diff --git a/packages/cxx-gen-ast/src/gen_ast_pretty_printer_cc.ts b/packages/cxx-gen-ast/src/gen_ast_pretty_printer_cc.ts index 2b87f3b3..34a17df5 100644 --- a/packages/cxx-gen-ast/src/gen_ast_pretty_printer_cc.ts +++ b/packages/cxx-gen-ast/src/gen_ast_pretty_printer_cc.ts @@ -366,7 +366,8 @@ if (ast->op == TokenKind::T_NEW_ARRAY) { }); }); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_pretty_printer_cc.ts +${cpy_header} #include diff --git a/packages/cxx-gen-ast/src/gen_ast_pretty_printer_h.ts b/packages/cxx-gen-ast/src/gen_ast_pretty_printer_h.ts index 618c6461..192a9456 100644 --- a/packages/cxx-gen-ast/src/gen_ast_pretty_printer_h.ts +++ b/packages/cxx-gen-ast/src/gen_ast_pretty_printer_h.ts @@ -62,7 +62,8 @@ export function gen_ast_pretty_printer_h({ emit(` struct ${className}Visitor;`); }); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_pretty_printer_h.ts +${cpy_header} #pragma once diff --git a/packages/cxx-gen-ast/src/gen_ast_printer_cc.ts b/packages/cxx-gen-ast/src/gen_ast_printer_cc.ts index 06374c0d..1e45ad91 100644 --- a/packages/cxx-gen-ast/src/gen_ast_printer_cc.ts +++ b/packages/cxx-gen-ast/src/gen_ast_printer_cc.ts @@ -144,7 +144,8 @@ export function gen_ast_printer_cc({ }); }); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_printer_cc.ts +${cpy_header} #include // cxx diff --git a/packages/cxx-gen-ast/src/gen_ast_printer_h.ts b/packages/cxx-gen-ast/src/gen_ast_printer_h.ts index fd750ef2..b41eb35e 100644 --- a/packages/cxx-gen-ast/src/gen_ast_printer_h.ts +++ b/packages/cxx-gen-ast/src/gen_ast_printer_h.ts @@ -56,7 +56,8 @@ export function gen_ast_printer_h({ emit(` int indent_ = -1;`); emit(`};`); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_printer_h.ts +${cpy_header} #pragma once #include diff --git a/packages/cxx-gen-ast/src/gen_ast_recursive_visitor_ts.ts b/packages/cxx-gen-ast/src/gen_ast_recursive_visitor_ts.ts index ce8fbd6e..3c7a0837 100644 --- a/packages/cxx-gen-ast/src/gen_ast_recursive_visitor_ts.ts +++ b/packages/cxx-gen-ast/src/gen_ast_recursive_visitor_ts.ts @@ -105,7 +105,8 @@ export async function gen_ast_recursive_visitor_ts({ emit(`}`); emit(); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_recursive_visitor_ts.ts +${cpy_header} import * as ast from "./AST"; import { ASTVisitor } from "./ASTVisitor"; ${code.join("\n")} diff --git a/packages/cxx-gen-ast/src/gen_ast_slot_cc.ts b/packages/cxx-gen-ast/src/gen_ast_slot_cc.ts index 40b9cd16..d21b53ac 100644 --- a/packages/cxx-gen-ast/src/gen_ast_slot_cc.ts +++ b/packages/cxx-gen-ast/src/gen_ast_slot_cc.ts @@ -145,7 +145,8 @@ export function gen_ast_slot_cc({ ast, output }: { ast: AST; output: string }) { }); }); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_slot_cc.ts +${cpy_header} #include #include #include diff --git a/packages/cxx-gen-ast/src/gen_ast_slot_ts.ts b/packages/cxx-gen-ast/src/gen_ast_slot_ts.ts index 1ea9192c..78b5c617 100644 --- a/packages/cxx-gen-ast/src/gen_ast_slot_ts.ts +++ b/packages/cxx-gen-ast/src/gen_ast_slot_ts.ts @@ -44,7 +44,8 @@ export async function gen_ast_slot_ts({ emit(`}`); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_slot_ts.ts +${cpy_header} ${code.join("\n")} `; diff --git a/packages/cxx-gen-ast/src/gen_ast_ts.ts b/packages/cxx-gen-ast/src/gen_ast_ts.ts index 457ac2bf..0b9ba62b 100644 --- a/packages/cxx-gen-ast/src/gen_ast_ts.ts +++ b/packages/cxx-gen-ast/src/gen_ast_ts.ts @@ -203,7 +203,8 @@ export async function gen_ast_ts({ }); emit(`];`); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_ts.ts +${cpy_header} import { cxx } from "./cxx"; import { SourceLocation } from "./SourceLocation"; import { ASTCursor } from "./ASTCursor"; diff --git a/packages/cxx-gen-ast/src/gen_ast_visitor_cc.ts b/packages/cxx-gen-ast/src/gen_ast_visitor_cc.ts index e1a6d091..5921f22e 100644 --- a/packages/cxx-gen-ast/src/gen_ast_visitor_cc.ts +++ b/packages/cxx-gen-ast/src/gen_ast_visitor_cc.ts @@ -62,7 +62,8 @@ export function gen_ast_visitor_cc({ }); }); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_visitor_cc.ts +${cpy_header} #include // cxx diff --git a/packages/cxx-gen-ast/src/gen_ast_visitor_h.ts b/packages/cxx-gen-ast/src/gen_ast_visitor_h.ts index e0e2a92c..a1f321cd 100644 --- a/packages/cxx-gen-ast/src/gen_ast_visitor_h.ts +++ b/packages/cxx-gen-ast/src/gen_ast_visitor_h.ts @@ -44,7 +44,8 @@ export function gen_ast_visitor_h({ }); }); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_visitor_h.ts +${cpy_header} #pragma once diff --git a/packages/cxx-gen-ast/src/gen_ast_visitor_ts.ts b/packages/cxx-gen-ast/src/gen_ast_visitor_ts.ts index 284ab3a2..9cfca6c9 100644 --- a/packages/cxx-gen-ast/src/gen_ast_visitor_ts.ts +++ b/packages/cxx-gen-ast/src/gen_ast_visitor_ts.ts @@ -73,7 +73,8 @@ export async function gen_ast_visitor_ts({ emit(`}`); emit(); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_visitor_ts.ts +${cpy_header} import * as ast from "./AST"; ${code.join("\n")} diff --git a/packages/cxx-gen-ast/src/gen_syntax_cc.ts b/packages/cxx-gen-ast/src/gen_syntax_cc.ts index 07821ce1..eb696b11 100644 --- a/packages/cxx-gen-ast/src/gen_syntax_cc.ts +++ b/packages/cxx-gen-ast/src/gen_syntax_cc.ts @@ -47,7 +47,8 @@ export function gen_syntax_cc({ ast, output }: { ast: AST; output: string }) { emit(`}`); }); - const out = `${cpy_header} + const out = `// Generated file by: gen_syntax_cc.ts +${cpy_header} #include #include diff --git a/packages/cxx-gen-ast/src/gen_syntax_h.ts b/packages/cxx-gen-ast/src/gen_syntax_h.ts index 581af37b..19b8751b 100644 --- a/packages/cxx-gen-ast/src/gen_syntax_h.ts +++ b/packages/cxx-gen-ast/src/gen_syntax_h.ts @@ -50,7 +50,8 @@ export function gen_syntax_h({ ast, output }: { ast: AST; output: string }) { emit(`auto from(${base}* ast) -> std::optional<${variantName}>;`); }); - const out = `${cpy_header} + const out = `// Generated file by: gen_syntax_h.ts +${cpy_header} #pragma once diff --git a/packages/cxx-gen-ast/src/gen_token_fwd_h.ts b/packages/cxx-gen-ast/src/gen_token_fwd_h.ts index bf2a44ce..2fb16a95 100644 --- a/packages/cxx-gen-ast/src/gen_token_fwd_h.ts +++ b/packages/cxx-gen-ast/src/gen_token_fwd_h.ts @@ -57,7 +57,8 @@ export function gen_token_fwd_h({ output }: { output: string }) { emit(` V(${tk.toUpperCase()}, ${other}) \\`), ); - const out = `${cpy_header} + const out = `// Generated file by: gen_token_fwd_h.ts +${cpy_header} #pragma once #include diff --git a/packages/cxx-gen-ast/src/gen_tokenkind_ts.ts b/packages/cxx-gen-ast/src/gen_tokenkind_ts.ts index 586ae9b3..54b9b64f 100644 --- a/packages/cxx-gen-ast/src/gen_tokenkind_ts.ts +++ b/packages/cxx-gen-ast/src/gen_tokenkind_ts.ts @@ -32,7 +32,8 @@ export function gen_tokenkind_ts({ output }: { output: string }) { tokens.C_AND_CXX_KEYWORDS.forEach((tk) => emit(` ${tk.toUpperCase()},`)); emit("}"); - const out = `${cpy_header} + const out = `// Generated file by: gen_tokenkind_ts.ts +${cpy_header} ${code.join("\n")} `; diff --git a/packages/cxx-gen-ast/src/get_ast_slot_h.ts b/packages/cxx-gen-ast/src/get_ast_slot_h.ts index 6a176b45..25742ab3 100644 --- a/packages/cxx-gen-ast/src/get_ast_slot_h.ts +++ b/packages/cxx-gen-ast/src/get_ast_slot_h.ts @@ -36,7 +36,8 @@ export function gen_ast_slot_h({ ast, output }: { ast: AST; output: string }) { }); }); - const out = `${cpy_header} + const out = `// Generated file by: gen_ast_slot_h.ts +${cpy_header} #pragma once #include diff --git a/packages/cxx-gen-ast/src/kwgen.ts b/packages/cxx-gen-ast/src/kwgen.ts index 2b3fedcc..9f3ae17b 100644 --- a/packages/cxx-gen-ast/src/kwgen.ts +++ b/packages/cxx-gen-ast/src/kwgen.ts @@ -28,6 +28,7 @@ export default function kwgen(options: Options) { const emit = (s: string) => out.push(s); if (copyright !== undefined) { + emit("// Generated file by: kwgen.ts"); emit(copyright); } diff --git a/packages/cxx-gen-ast/src/new_ast_op_cc.ts b/packages/cxx-gen-ast/src/new_ast_op_cc.ts index 35bc3cc4..81b39043 100644 --- a/packages/cxx-gen-ast/src/new_ast_op_cc.ts +++ b/packages/cxx-gen-ast/src/new_ast_op_cc.ts @@ -140,7 +140,8 @@ export function new_ast_op_cc({ }); }); - const out = `${cpy_header} + const out = `// Generated file by: new_ast_op_cc.ts +${cpy_header} #include diff --git a/packages/cxx-gen-ast/src/new_ast_op_h.ts b/packages/cxx-gen-ast/src/new_ast_op_h.ts index 80ae45fe..3a3056b5 100644 --- a/packages/cxx-gen-ast/src/new_ast_op_h.ts +++ b/packages/cxx-gen-ast/src/new_ast_op_h.ts @@ -76,7 +76,8 @@ export function new_ast_op_h({ emit(` [[nodiscard]] auto operator()(${name}* ast) -> ${resultTy};`); }); - const out = `${cpy_header} + const out = `// Generated file by: new_ast_op_h.ts +${cpy_header} #pragma once diff --git a/packages/cxx-gen-ast/src/new_ast_rewriter_cc.ts b/packages/cxx-gen-ast/src/new_ast_rewriter_cc.ts index 0e2749f5..84ba4d6c 100644 --- a/packages/cxx-gen-ast/src/new_ast_rewriter_cc.ts +++ b/packages/cxx-gen-ast/src/new_ast_rewriter_cc.ts @@ -396,7 +396,8 @@ if (auto param = symbol_cast(ast->symbol); }); }); - const out = `${cpy_header} + const out = `// Generated file by: new_ast_rewriter_cc.ts +${cpy_header} #include diff --git a/packages/cxx-gen-ast/src/new_ast_rewriter_h.ts b/packages/cxx-gen-ast/src/new_ast_rewriter_h.ts index e51a2968..f90ef547 100644 --- a/packages/cxx-gen-ast/src/new_ast_rewriter_h.ts +++ b/packages/cxx-gen-ast/src/new_ast_rewriter_h.ts @@ -72,7 +72,8 @@ export function new_ast_rewriter_h({ emit(` struct ${className}Visitor;`); }); - const out = `${cpy_header} + const out = `// Generated file by: new_ast_rewriter_h.ts +${cpy_header} #pragma once diff --git a/packages/cxx-gen-lsp/src/gen_enums_cc.ts b/packages/cxx-gen-lsp/src/gen_enums_cc.ts index f2e954b9..423f9bbe 100644 --- a/packages/cxx-gen-lsp/src/gen_enums_cc.ts +++ b/packages/cxx-gen-lsp/src/gen_enums_cc.ts @@ -31,6 +31,7 @@ export function gen_enums_cc({ model, outputDirectory }: { model: MetaModel; out out += `${s}\n`; }; + emit("// Generated file by: gen_enums_cc.ts"); emit(copyrightHeader); emit(); emit(`#include `); diff --git a/packages/cxx-gen-lsp/src/gen_enums_h.ts b/packages/cxx-gen-lsp/src/gen_enums_h.ts index d7d74d5a..37997c4b 100644 --- a/packages/cxx-gen-lsp/src/gen_enums_h.ts +++ b/packages/cxx-gen-lsp/src/gen_enums_h.ts @@ -31,6 +31,7 @@ export function gen_enums_h({ model, outputDirectory }: { model: MetaModel; outp out += `${s}\n`; }; + emit("// Generated file by: gen_enums_h.ts"); emit(copyrightHeader); emit(); emit(`#pragma once`); diff --git a/packages/cxx-gen-lsp/src/gen_fwd_h.ts b/packages/cxx-gen-lsp/src/gen_fwd_h.ts index 31325b30..24d88f2b 100644 --- a/packages/cxx-gen-lsp/src/gen_fwd_h.ts +++ b/packages/cxx-gen-lsp/src/gen_fwd_h.ts @@ -324,6 +324,7 @@ export function gen_fwd_h({ model, outputDirectory }: { model: MetaModel; output out += `${s}\n`; }; + emit("// Generated file by: gen_fwd_h.ts"); emit(copyrightHeader); emit(); emit(`#pragma once`); diff --git a/packages/cxx-gen-lsp/src/gen_requests_cc.ts b/packages/cxx-gen-lsp/src/gen_requests_cc.ts index cf6c9b50..cc359001 100644 --- a/packages/cxx-gen-lsp/src/gen_requests_cc.ts +++ b/packages/cxx-gen-lsp/src/gen_requests_cc.ts @@ -142,6 +142,7 @@ class RequestGenerator extends TypeGenerator { } begin() { + this.emit("// Generated file by: gen_requests_cc.ts"); this.emit(copyrightHeader); this.emit(); this.emit(`#include `); diff --git a/packages/cxx-gen-lsp/src/gen_requests_h.ts b/packages/cxx-gen-lsp/src/gen_requests_h.ts index 47e49296..b80a77be 100644 --- a/packages/cxx-gen-lsp/src/gen_requests_h.ts +++ b/packages/cxx-gen-lsp/src/gen_requests_h.ts @@ -40,6 +40,7 @@ export function gen_requests_h({ model, outputDirectory }: { model: MetaModel; o out += `${s}\n`; }; + emit("// Generated file by: gen_requests_h.ts"); emit(copyrightHeader); emit(beginHeaderFragment); diff --git a/packages/cxx-gen-lsp/src/gen_types_cc.ts b/packages/cxx-gen-lsp/src/gen_types_cc.ts index 7c314246..93ea392d 100644 --- a/packages/cxx-gen-lsp/src/gen_types_cc.ts +++ b/packages/cxx-gen-lsp/src/gen_types_cc.ts @@ -69,6 +69,7 @@ export class TypeGenerator { } begin() { + this.emit("// Generated file by: gen_types_cc.ts"); this.emit(copyrightHeader); this.emit(); this.emit(`#include `); diff --git a/packages/cxx-gen-lsp/src/gen_types_h.ts b/packages/cxx-gen-lsp/src/gen_types_h.ts index 31089537..c3a1f7f5 100644 --- a/packages/cxx-gen-lsp/src/gen_types_h.ts +++ b/packages/cxx-gen-lsp/src/gen_types_h.ts @@ -45,6 +45,7 @@ export function gen_types_h({ model, outputDirectory }: { model: MetaModel; outp return propertyType; }; + emit("// Generated file by: gen_types_h.ts"); emit(copyrightHeader); emit(); emit(`#pragma once`); diff --git a/src/parser/cxx/ast.cc b/src/parser/cxx/ast.cc index e8a6e2c2..f7a5abf8 100644 --- a/src/parser/cxx/ast.cc +++ b/src/parser/cxx/ast.cc @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_cc.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/ast.fbs b/src/parser/cxx/ast.fbs index 2d174d67..c982e23e 100644 --- a/src/parser/cxx/ast.fbs +++ b/src/parser/cxx/ast.fbs @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_fbs.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/ast.h b/src/parser/cxx/ast.h index e49d9e8c..d57314b0 100644 --- a/src/parser/cxx/ast.h +++ b/src/parser/cxx/ast.h @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_h.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/ast_fwd.h b/src/parser/cxx/ast_fwd.h index d43453c7..6b458dae 100644 --- a/src/parser/cxx/ast_fwd.h +++ b/src/parser/cxx/ast_fwd.h @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_fwd_h.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/ast_kind.h b/src/parser/cxx/ast_kind.h index b3d5f09a..6fa6ccee 100644 --- a/src/parser/cxx/ast_kind.h +++ b/src/parser/cxx/ast_kind.h @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_kind_h.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/ast_pretty_printer.cc b/src/parser/cxx/ast_pretty_printer.cc index 094bffed..b073b849 100644 --- a/src/parser/cxx/ast_pretty_printer.cc +++ b/src/parser/cxx/ast_pretty_printer.cc @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_pretty_printer_cc.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/ast_pretty_printer.h b/src/parser/cxx/ast_pretty_printer.h index 76476aa2..0eacb679 100644 --- a/src/parser/cxx/ast_pretty_printer.h +++ b/src/parser/cxx/ast_pretty_printer.h @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_pretty_printer_h.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/ast_printer.cc b/src/parser/cxx/ast_printer.cc index 649b33b6..ed21e206 100644 --- a/src/parser/cxx/ast_printer.cc +++ b/src/parser/cxx/ast_printer.cc @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_printer_cc.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/ast_printer.h b/src/parser/cxx/ast_printer.h index c0adf18c..9dd408bb 100644 --- a/src/parser/cxx/ast_printer.h +++ b/src/parser/cxx/ast_printer.h @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_printer_h.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/ast_slot.cc b/src/parser/cxx/ast_slot.cc index 64519fb9..f0edafec 100644 --- a/src/parser/cxx/ast_slot.cc +++ b/src/parser/cxx/ast_slot.cc @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_slot_cc.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/ast_slot.h b/src/parser/cxx/ast_slot.h index 28a1d781..86d14bd6 100644 --- a/src/parser/cxx/ast_slot.h +++ b/src/parser/cxx/ast_slot.h @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_slot_h.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/ast_visitor.cc b/src/parser/cxx/ast_visitor.cc index ba0ffc37..9a965ee9 100644 --- a/src/parser/cxx/ast_visitor.cc +++ b/src/parser/cxx/ast_visitor.cc @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_visitor_cc.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/ast_visitor.h b/src/parser/cxx/ast_visitor.h index c103da59..e56b1007 100644 --- a/src/parser/cxx/ast_visitor.h +++ b/src/parser/cxx/ast_visitor.h @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_visitor_h.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/flatbuffers/ast_decoder.cc b/src/parser/cxx/flatbuffers/ast_decoder.cc index 5adcb238..94a5298d 100644 --- a/src/parser/cxx/flatbuffers/ast_decoder.cc +++ b/src/parser/cxx/flatbuffers/ast_decoder.cc @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_decoder_cc.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/flatbuffers/ast_encoder.cc b/src/parser/cxx/flatbuffers/ast_encoder.cc index 6e5cd23f..b4350e75 100644 --- a/src/parser/cxx/flatbuffers/ast_encoder.cc +++ b/src/parser/cxx/flatbuffers/ast_encoder.cc @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_encoder_cc.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/private/ast_decoder.h b/src/parser/cxx/private/ast_decoder.h index 61b6e06c..7a4d81a2 100644 --- a/src/parser/cxx/private/ast_decoder.h +++ b/src/parser/cxx/private/ast_decoder.h @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_decoder_h.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/private/ast_encoder.h b/src/parser/cxx/private/ast_encoder.h index 438c09c4..5009061e 100644 --- a/src/parser/cxx/private/ast_encoder.h +++ b/src/parser/cxx/private/ast_encoder.h @@ -1,3 +1,4 @@ +// Generated file by: gen_ast_encoder_h.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/parser/cxx/private/c_keywords-priv.h b/src/parser/cxx/private/c_keywords-priv.h index 86bba309..0c542797 100644 --- a/src/parser/cxx/private/c_keywords-priv.h +++ b/src/parser/cxx/private/c_keywords-priv.h @@ -1,3 +1,4 @@ +// Generated file by: kwgen.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -1439,4 +1440,4 @@ static auto classifyC(const char* s, int n) -> cxx::TokenKind { default: return cxx::TokenKind::T_IDENTIFIER; } // switch -} \ No newline at end of file +} diff --git a/src/parser/cxx/private/keywords-priv.h b/src/parser/cxx/private/keywords-priv.h index 36c975e8..b602a7bf 100644 --- a/src/parser/cxx/private/keywords-priv.h +++ b/src/parser/cxx/private/keywords-priv.h @@ -1,3 +1,4 @@ +// Generated file by: kwgen.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -1821,4 +1822,4 @@ static auto classify(const char* s, int n) -> cxx::TokenKind { default: return cxx::TokenKind::T_IDENTIFIER; } // switch -} \ No newline at end of file +} diff --git a/src/parser/cxx/private/pp_directives-priv.h b/src/parser/cxx/private/pp_directives-priv.h index af0565ab..5a73e324 100644 --- a/src/parser/cxx/private/pp_directives-priv.h +++ b/src/parser/cxx/private/pp_directives-priv.h @@ -1,3 +1,4 @@ +// Generated file by: kwgen.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -280,4 +281,4 @@ static auto classifyDirective(const char* s, int n) default: return PreprocessorDirectiveKind::T_IDENTIFIER; } // switch -} \ No newline at end of file +} diff --git a/src/parser/cxx/symbols.h b/src/parser/cxx/symbols.h index 966b0f5f..d9fcfc47 100644 --- a/src/parser/cxx/symbols.h +++ b/src/parser/cxx/symbols.h @@ -136,7 +136,7 @@ class Symbol { [[nodiscard]] auto next() const -> Symbol*; #define PROCESS_SYMBOL(S) \ - [[nodiscard]] auto is##S() const -> bool { return kind_ == SymbolKind::k##S; } + [[nodiscard]] auto is##S() const->bool { return kind_ == SymbolKind::k##S; } CXX_FOR_EACH_SYMBOL(PROCESS_SYMBOL) #undef PROCESS_SYMBOL @@ -816,7 +816,7 @@ auto visit(Visitor&& visitor, Symbol* symbol) { } #define PROCESS_SYMBOL(S) \ - inline auto is##S##Symbol(Symbol* symbol) -> bool { \ + inline auto is##S##Symbol(Symbol* symbol)->bool { \ return symbol && symbol->kind() == SymbolKind::k##S; \ } diff --git a/src/parser/cxx/token_fwd.h b/src/parser/cxx/token_fwd.h index 0cd90209..8b4f97a0 100644 --- a/src/parser/cxx/token_fwd.h +++ b/src/parser/cxx/token_fwd.h @@ -1,3 +1,4 @@ +// Generated file by: gen_token_fwd_h.ts // Copyright (c) 2025 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy