@@ -40,8 +40,8 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) {
4040 if ( member . kind === "node-list" ) {
4141 emit ( ` if (ast->${ member . name } ) {` ) ;
4242 emit ( ` ++indent_;` ) ;
43- emit ( ` out_ << cxx ::format("{:{}}", "", indent_ * 2);` ) ;
44- emit ( ` out_ << cxx ::format("{}\\n", "${ fieldName } ");` ) ;
43+ emit ( ` out_ << std ::format("{:{}}", "", indent_ * 2);` ) ;
44+ emit ( ` out_ << std ::format("{}\\n", "${ fieldName } ");` ) ;
4545 emit ( ` for (auto it = ast->${ member . name } ; it; it = it->next) {` ) ;
4646 emit ( ` accept(it->value);` ) ;
4747 emit ( ` }` ) ;
@@ -54,25 +54,25 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) {
5454 } else if ( member . kind == "attribute" && member . type === "bool" ) {
5555 emit ( ` if (ast->${ member . name } ) {` ) ;
5656 emit ( ` ++indent_;` ) ;
57- emit ( ` out_ << cxx ::format("{:{}}", "", indent_ * 2);` ) ;
57+ emit ( ` out_ << std ::format("{:{}}", "", indent_ * 2);` ) ;
5858 emit (
59- ` out_ << cxx ::format("${ fieldName } : {}\\n", ast->${ member . name } );` ,
59+ ` out_ << std ::format("${ fieldName } : {}\\n", ast->${ member . name } );`
6060 ) ;
6161 emit ( ` --indent_;` ) ;
6262 emit ( ` }` ) ;
6363 } else if ( member . kind == "attribute" && member . type === "int" ) {
6464 emit ( ` ++indent_;` ) ;
65- emit ( ` out_ << cxx ::format("{:{}}", "", indent_ * 2);` ) ;
65+ emit ( ` out_ << std ::format("{:{}}", "", indent_ * 2);` ) ;
6666 emit (
67- ` out_ << cxx ::format("${ fieldName } : {}\\n", ast->${ member . name } );` ,
67+ ` out_ << std ::format("${ fieldName } : {}\\n", ast->${ member . name } );`
6868 ) ;
6969 emit ( ` --indent_;` ) ;
7070 } else if ( member . kind == "attribute" && member . type . endsWith ( "Literal" ) ) {
7171 emit ( ` if (ast->${ member . name } ) {` ) ;
7272 emit ( ` ++indent_;` ) ;
73- emit ( ` out_ << cxx ::format("{:{}}", "", indent_ * 2);` ) ;
73+ emit ( ` out_ << std ::format("{:{}}", "", indent_ * 2);` ) ;
7474 emit (
75- ` out_ << cxx ::format("${ fieldName } : {}\\n", ast->${ member . name } ->value());` ,
75+ ` out_ << std ::format("${ fieldName } : {}\\n", ast->${ member . name } ->value());`
7676 ) ;
7777 emit ( ` --indent_;` ) ;
7878 emit ( ` }` ) ;
@@ -82,9 +82,9 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) {
8282 ) {
8383 emit ( ` if (ast->${ member . name } != TokenKind::T_EOF_SYMBOL) {` ) ;
8484 emit ( ` ++indent_;` ) ;
85- emit ( ` out_ << cxx ::format("{:{}}", "", indent_ * 2);` ) ;
85+ emit ( ` out_ << std ::format("{:{}}", "", indent_ * 2);` ) ;
8686 emit (
87- ` out_ << cxx ::format("${ fieldName } : {}\\n", Token::spell(ast->${ member . name } ));` ,
87+ ` out_ << std ::format("${ fieldName } : {}\\n", Token::spell(ast->${ member . name } ));`
8888 ) ;
8989 emit ( ` --indent_;` ) ;
9090 emit ( ` }` ) ;
@@ -93,9 +93,9 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) {
9393 member . type == "ImplicitCastKind"
9494 ) {
9595 emit ( ` ++indent_;` ) ;
96- emit ( ` out_ << cxx ::format("{:{}}", "", indent_ * 2);` ) ;
96+ emit ( ` out_ << std ::format("{:{}}", "", indent_ * 2);` ) ;
9797 emit (
98- ` out_ << cxx ::format("${ fieldName } : {}\\n", to_string(ast->${ member . name } ));` ,
98+ ` out_ << std ::format("${ fieldName } : {}\\n", to_string(ast->${ member . name } ));`
9999 ) ;
100100 emit ( ` --indent_;` ) ;
101101 }
@@ -105,7 +105,7 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) {
105105 nodes . forEach ( ( { name, base, members } ) => {
106106 emit ( ) ;
107107 emit ( `void ASTPrinter::visit(${ name } * ast) {` ) ;
108- emit ( ` out_ << cxx ::format("{}\\n", "${ astName ( name ) } ");` ) ;
108+ emit ( ` out_ << std ::format("{}\\n", "${ astName ( name ) } ");` ) ;
109109
110110 const baseMembers = ast . baseMembers . get ( base ) ;
111111
@@ -135,7 +135,7 @@ export function gen_ast_dump_cc({ ast, output }: { ast: AST; output: string }) {
135135#include <cxx/translation_unit.h>
136136#include <cxx/names.h>
137137#include <cxx/literals.h>
138- #include <cxx/private/ format.h >
138+ #include <format>
139139
140140#include <algorithm>
141141#include <iostream>
@@ -153,9 +153,9 @@ void ASTPrinter::operator()(AST* ast) {
153153void ASTPrinter::accept(AST* ast, std::string_view field) {
154154 if (!ast) return;
155155 ++indent_;
156- out_ << cxx ::format("{:{}}", "", indent_ * 2);
156+ out_ << std ::format("{:{}}", "", indent_ * 2);
157157 if (!field.empty()) {
158- out_ << cxx ::format("{}: ", field);
158+ out_ << std ::format("{}: ", field);
159159 }
160160 ast->accept(this);
161161 --indent_;
@@ -164,9 +164,9 @@ void ASTPrinter::accept(AST* ast, std::string_view field) {
164164void ASTPrinter::accept(const Identifier* id, std::string_view field) {
165165 if (!id) return;
166166 ++indent_;
167- out_ << cxx ::format("{:{}}", "", indent_ * 2);
168- if (!field.empty()) out_ << cxx ::format("{}: ", field);
169- out_ << cxx ::format("{}\\n", id->value());
167+ out_ << std ::format("{:{}}", "", indent_ * 2);
168+ if (!field.empty()) out_ << std ::format("{}: ", field);
169+ out_ << std ::format("{}\\n", id->value());
170170 --indent_;
171171}
172172
0 commit comments