From 2332ecff4811b8c97dfda8e825170e9397962519 Mon Sep 17 00:00:00 2001 From: Simen Wiik Date: Mon, 2 Feb 2026 00:05:29 +0100 Subject: [PATCH] v: refactor $var to ${var} across entire repository, make vfmt always output the newer form `${expr}` (#26494) --- .github/workflows/android_cross_compile.vsh | 14 ++-- cmd/tools/changelog_helper.v | 2 +- cmd/tools/fast/fast.v | 2 +- cmd/tools/git_pre_commit_hook.vsh | 2 +- cmd/tools/modules/scripting/scripting.v | 2 +- cmd/tools/modules/testing/common.v | 2 +- cmd/tools/modules/testing/output_normal.v | 2 +- cmd/tools/vbuild-tools.v | 4 +- cmd/tools/vcheck-md.v | 4 +- cmd/tools/vcomplete.v | 2 +- cmd/tools/vpm/install_version_test.v | 2 +- cmd/tools/vrepeat.v | 2 +- cmd/tools/vvet/tests/indent_with_space.vv | 2 +- cmd/tools/vwatch.v | 4 +- examples/brainvuck.v | 2 +- examples/graphs/dfs.v | 1 - examples/graphs/dfs2.v | 1 - .../chart/README.md | 4 +- .../js_dom_draw_benchmark_chart/chart/main.v | 2 +- examples/rule110.v | 2 +- .../sokol/06_obj_viewer/modules/obj/obj.v | 36 ++++----- .../sokol/06_obj_viewer/modules/obj/rend.v | 4 +- examples/sokol/06_obj_viewer/show_obj.v | 2 +- examples/sokol/sounds/wav_player.v | 12 +-- examples/term.ui/pong.v | 2 +- examples/term.ui/term_drawing.v | 2 +- examples/tetris/tetris.js.v | 2 +- examples/tetris/tetris.v | 2 +- examples/viewer/view.v | 4 +- examples/viewer/zip_container.v | 2 +- examples/websocket/client-server/client.v | 2 +- examples/websocket/ping.v | 6 +- vlib/builtin/array_test.v | 14 ++-- vlib/builtin/builtin_d_use_libbacktrace.c.v | 2 +- vlib/builtin/js/array_test.js.v | 6 +- vlib/builtin/js/builtin.v | 2 +- vlib/builtin/js/string_test.js.v | 12 +-- vlib/builtin/linux_bare/old/.checks/checks.v | 10 +-- vlib/builtin/linux_bare/old/array_bare.v | 4 +- vlib/builtin/sorting_test.v | 2 +- .../ed25519/internal/edwards25519/point.v | 4 +- vlib/db/redis/README.md | 2 +- vlib/db/sqlite/stmt.c.v | 2 +- vlib/encoding/utf8/utf8_util.v | 2 +- vlib/flag/flag.v | 4 +- vlib/gg/gg.c.v | 2 +- vlib/gg/gg_darwin.m | 2 +- vlib/gg/image.c.v | 4 +- vlib/gg/testdata/tweak_circles.vv | 2 +- vlib/gg/text_rendering.c.v | 4 +- vlib/io/os_file_reader_test.v | 2 +- vlib/io/util/util_test.v | 2 +- vlib/json/tests/json_test.v | 10 +-- vlib/log/file_log_test.v | 2 +- vlib/net/http/http.v | 2 +- vlib/net/http/request.v | 6 +- vlib/net/http/server_test.v | 2 +- .../tests/autobahn/autobahn_client_wss.v | 2 +- .../autobahn/local_run/autobahn_client_wss.v | 2 +- vlib/net/websocket/websocket_client.v | 2 +- vlib/os/file.c.v | 2 +- vlib/os/os_nix.c.v | 4 +- vlib/os/os_test.c.v | 28 +++---- vlib/rand/random_bytes_test.v | 4 +- vlib/rand/random_identifiers_test.v | 4 +- vlib/rand/random_numbers_test.v | 2 +- vlib/readline/readline_nix.c.v | 6 +- vlib/readline/readline_test.v | 8 +- vlib/regex/regex.v | 76 +++++++++--------- vlib/regex/regex_test.v | 10 +-- vlib/regex/regex_util.v | 20 ++--- vlib/stbi/stbi.c.v | 2 +- vlib/strconv/atof.c.v | 2 +- vlib/strconv/atof_test.c.v | 4 +- vlib/strconv/atoi.v | 10 +-- vlib/strconv/f32_f64_to_string_test.v | 4 +- vlib/strconv/f64_str.c.v | 6 +- vlib/strconv/f64_str.js.v | 6 +- vlib/strconv/format_mem.c.v | 2 +- vlib/strconv/format_test.v | 18 ++--- vlib/strconv/vprintf.c.v | 4 +- vlib/term/ui/input_windows.c.v | 2 +- vlib/term/ui/termios_nix.c.v | 2 +- vlib/time/parse.c.v | 4 +- vlib/toml/checker/checker.v | 2 +- vlib/toml/parser/parser.v | 6 +- vlib/toml/scanner/scanner.v | 4 +- vlib/toml/tests/iarna_toml_spec_test.v | 2 +- vlib/toml/tests/toml_lang_test.v | 2 +- vlib/toml/toml.v | 2 +- vlib/v/TEMPLATES.md | 6 +- vlib/v/ast/ast.v | 4 +- vlib/v/ast/scope.v | 2 +- vlib/v/ast/str.v | 57 +++---------- vlib/v/builder/builder.v | 10 +-- vlib/v/builder/cc.v | 4 +- vlib/v/builder/msvc_windows.v | 12 +-- vlib/v/builder/rebuilding.v | 10 +-- vlib/v/checker/check_types.v | 4 +- vlib/v/checker/checker.v | 6 +- vlib/v/checker/comptime.v | 4 +- vlib/v/checker/errors.v | 2 +- vlib/v/checker/fn.v | 4 +- vlib/v/checker/interface.v | 2 +- vlib/v/checker/struct.v | 4 +- .../tests/assign_expr_undefined_err_b.out | 2 +- .../tests/assign_expr_undefined_err_b.vv | 2 +- .../tests/assign_expr_undefined_err_c.out | 2 +- .../tests/assign_expr_undefined_err_c.vv | 2 +- .../tests/assign_expr_undefined_err_d.out | 6 +- .../tests/assign_expr_undefined_err_d.vv | 2 +- .../tests/assign_expr_undefined_err_f.out | 2 +- .../tests/assign_expr_undefined_err_f.vv | 2 +- .../tests/assign_expr_undefined_err_l.out | 2 +- .../tests/assign_expr_undefined_err_l.vv | 2 +- ...with_several_comments_with_crlf_ending.out | 16 ++-- ..._with_several_comments_with_crlf_ending.vv | 2 +- ...generics_struct_init_type_parameter_err.vv | 4 +- vlib/v/checker/tests/prefix_err.out | 2 +- vlib/v/checker/tests/void_option_err.vv | 2 +- vlib/v/debug/interactive_test.v | 2 +- vlib/v/debug/tracing_test.v | 2 +- vlib/v/eval/expr.c.v | 4 +- vlib/v/fmt/fmt.v | 17 ++-- vlib/v/fmt/struct.v | 2 +- vlib/v/fmt/tests/anon_fn_input.vv | 8 +- vlib/v/fmt/tests/expressions_input.vv | 4 +- vlib/v/gen/c/array.v | 4 +- vlib/v/gen/c/assert.v | 2 +- vlib/v/gen/c/auto_str_methods.v | 2 +- vlib/v/gen/c/autofree.v | 2 +- vlib/v/gen/c/cgen.v | 8 +- vlib/v/gen/c/comptime.v | 2 +- vlib/v/gen/c/consts_and_globals.v | 2 +- vlib/v/gen/c/coutput_test.v | 2 +- vlib/v/gen/c/dumpexpr.v | 2 +- vlib/v/gen/c/fn.v | 10 +-- vlib/v/gen/c/for.v | 8 +- vlib/v/gen/c/json.v | 2 +- vlib/v/gen/c/match.v | 4 +- vlib/v/gen/c/str.v | 2 +- vlib/v/gen/c/text_manipulation.v | 2 +- vlib/v/gen/golang/golang.v | 19 ++--- vlib/v/gen/golang/struct.v | 2 +- vlib/v/gen/golang/tests/string.go.vv | 4 +- vlib/v/gen/js/auto_str_methods.v | 10 +-- vlib/v/gen/js/builtin_types.v | 6 +- vlib/v/gen/js/deep_copy.v | 10 +-- vlib/v/gen/js/js.v | 8 +- vlib/v/gen/js/tests/interp.v | 34 ++++---- vlib/v/gen/native/amd64.v | 4 +- vlib/v/gen/native/arm64.v | 10 +-- vlib/v/gen/native/expr.v | 2 +- vlib/v/gen/native/gen.v | 2 +- vlib/v/gen/native/macho.v | 2 +- vlib/v/gen/native/stmt.c.v | 2 +- vlib/v/live/executable/reloader.c.v | 2 +- vlib/v/live/live_test.v | 4 +- vlib/v/markused/markused.v | 2 +- vlib/v/markused/walker.v | 2 +- vlib/v/parser/enum.v | 2 +- vlib/v/parser/fn.v | 2 +- vlib/v/parser/for.v | 2 +- vlib/v/parser/module.v | 2 +- vlib/v/parser/tests/const_decl_err.vv | 2 +- vlib/v/parser/tests/defer_propagate2.vv | 4 +- .../tests/multi_argumented_assign_err.out | 2 +- .../tests/multi_argumented_assign_err.vv | 2 +- vlib/v/parser/v_parser_test.v | 6 +- vlib/v/pref/default.v | 2 +- vlib/v/pref/pref.v | 4 +- vlib/v/pref/should_compile.v | 8 +- vlib/v/scanner/scanner.v | 2 +- .../undefined_ident_in_string_literal_err.out | 12 +-- .../undefined_ident_in_string_literal_err.vv | 2 +- vlib/v/slow_tests/assembly/asm_test.amd64.v | 2 +- .../inout/comptime_smartcast_variant.out | 4 +- .../dump_nested_generic_fn_call_ref_arg.out | 20 ++--- .../panic_array_decompose_extra_args.out | 6 +- .../v/slow_tests/map_issue_22145_clear_test.v | 2 +- vlib/v/slow_tests/prod_test.v | 2 +- vlib/v/slow_tests/repl/repl_test.v | 4 +- vlib/v/slow_tests/repl/runner/runner.v | 8 +- vlib/v/slow_tests/run_project_folders_test.v | 2 +- .../valgrind/1.strings_and_arrays.v | 4 +- .../str_gen_test.v | 4 +- ...ing_interpolation_with_inner_quotes_test.v | 16 ++-- vlib/v/tests/enums/enum_test.v | 8 +- ...ef_but_returning_struct_time_module_test.v | 2 +- vlib/v/tests/fns/fn_variadic_test.v | 2 +- vlib/v/tests/run_v_code_from_stdin_test.v | 4 +- ...sert_with_extra_message_works_test.run.out | 2 +- ...w_both_field_defaults_and_skip_flag_test.v | 6 +- .../sumtype_str_for_subtypes_with_str_test.v | 2 +- vlib/v/token/keywords_matcher_trie.v | 6 +- vlib/v/token/token.v | 2 +- vlib/v/util/util.v | 6 +- vlib/v/vcache/vcache_test.v | 2 +- vlib/v2/ast/ast.v | 2 +- vlib/v2/parser/parser.v | 20 ++--- vlib/v2/parser/type.v | 2 +- vlib/v2/tests/syntax.v_ | 26 +++--- vlib/v2/tests/syntax_generics.v_ | 4 +- vlib/v2/token/position.v | 12 +-- vlib/v2/types/checker.v | 80 +++++++++---------- vlib/v2/types/scope.v | 8 +- vlib/v2/types/types.v | 6 +- vlib/vweb/README.md | 18 ++--- vlib/vweb/assets/assets.v | 2 +- vlib/x/ttf/render_bmp.v | 26 +++--- vlib/x/ttf/render_sokol/cpu.v | 4 +- vlib/x/ttf/text_block.v | 8 +- vlib/x/ttf/ttf.v | 34 ++++---- vlib/x/ttf/ttf_test.v | 2 +- 214 files changed, 634 insertions(+), 683 deletions(-) diff --git a/.github/workflows/android_cross_compile.vsh b/.github/workflows/android_cross_compile.vsh index 764d281f2..a3ec4f740 100755 --- a/.github/workflows/android_cross_compile.vsh +++ b/.github/workflows/android_cross_compile.vsh @@ -24,8 +24,8 @@ fn main() { include_path := os.join_path(sysroot_path, 'usr', 'include') android_include_path := os.join_path(include_path, 'android') - //'-I"$include_path"' - cflags := ['-I"$android_include_path"', '-Wno-unused-value', '-Wno-implicit-function-declaration', + //'-I"${include_path}"' + cflags := ['-I"${android_include_path}"', '-Wno-unused-value', '-Wno-implicit-function-declaration', '-Wno-int-conversion'] for arch in ndk.supported_archs { for level in ['min', 'max'] { @@ -46,22 +46,22 @@ fn main() { o_file := os.join_path(work_dir, arch + '-' + level + '.o') // x.v -> x.c - v_compile_cmd := '$vexe -o $c_file -os android -gc none $v_example' + v_compile_cmd := '${vexe} -o ${c_file} -os android -gc none ${v_example}' vres := os.execute(v_compile_cmd) if vres.exit_code != 0 { - panic('"$v_compile_cmd" failed: $vres.output') + panic('"${v_compile_cmd}" failed: ${vres.output}') } assert os.exists(c_file) // x.c -> x.o - compile_cmd := '$compiler_api ${cflags.join(' ')} -c $c_file -o $o_file' + compile_cmd := '${compiler_api} ${cflags.join(' ')} -c ${c_file} -o ${o_file}' cres := os.execute(compile_cmd) if cres.exit_code != 0 { - panic('"$compile_cmd" failed: $cres.output') + panic('"${compile_cmd}" failed: ${cres.output}') } assert os.exists(o_file) compiler_exe_name := os.file_name(compiler_api) - println('Compiled examples/toml.v successfully for ($level) $arch $compiler_exe_name') + println('Compiled examples/toml.v successfully for (${level}) ${arch} ${compiler_exe_name}') } } } diff --git a/cmd/tools/changelog_helper.v b/cmd/tools/changelog_helper.v index d8af93609..2804f1b0f 100644 --- a/cmd/tools/changelog_helper.v +++ b/cmd/tools/changelog_helper.v @@ -162,7 +162,7 @@ fn (mut app App) process_line(text string) ! { category = .interpreter } else if is_examples(text) { category = .examples - // println("Skipping line (example) $text") + // println("Skipping line (example) ${text}") // return } else if is_skip(text) { // Always skip cleanups, typos etc diff --git a/cmd/tools/fast/fast.v b/cmd/tools/fast/fast.v index 2e42b84aa..31f386c55 100644 --- a/cmd/tools/fast/fast.v +++ b/cmd/tools/fast/fast.v @@ -123,7 +123,7 @@ fn main() { // measure diff1 := measure('${vdir}/vprod ${voptions} -o v.c cmd/v', 'v.c') diff2 := measure('${vdir}/vprod ${voptions} -cc ${ccompiler_path} -o v2 cmd/v', 'v2') - diff3 := 0 // measure('$vdir/vprod -native $vdir/cmd/tools/1mil.v', 'native 1mil') + diff3 := 0 // measure('${vdir}/vprod -native ${vdir}/cmd/tools/1mil.v', 'native 1mil') diff4 := measure('${vdir}/vprod ${voptions} -cc ${ccompiler_path} examples/hello_world.v', 'hello.v') vc_size := os.file_size('v.c') / 1000 diff --git a/cmd/tools/git_pre_commit_hook.vsh b/cmd/tools/git_pre_commit_hook.vsh index d992080e0..3da0e54b0 100755 --- a/cmd/tools/git_pre_commit_hook.vsh +++ b/cmd/tools/git_pre_commit_hook.vsh @@ -58,7 +58,7 @@ fn main() { eprintln('The V pre commit hook will format ${vfiles.len} V file(s):') // vfmt off for vfile in vfiles { - eprintln(' ${term.bold('$vfile')}') + eprintln(' ${term.bold('${vfile}')}') } // vfmt on all_vfiles_on_a_line := vfiles.map(os.quoted_path(it)).join(' ') diff --git a/cmd/tools/modules/scripting/scripting.v b/cmd/tools/modules/scripting/scripting.v index 5b710c697..034bff92b 100644 --- a/cmd/tools/modules/scripting/scripting.v +++ b/cmd/tools/modules/scripting/scripting.v @@ -195,6 +195,6 @@ pub fn used_tools_must_exist(tools []string) { pub fn show_sizes_of_files(files []string) { for f in files { size := os.file_size(f) - println('${size} ${f}') // println('${size:10d} $f') + println('${size} ${f}') // println('${size:10d} ${f}') } } diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index 4d464bf5a..34c1d992a 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -616,7 +616,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr { for cretry in 0 .. max_compilation_retries { compile_r = ts.execute(cmd, mtc) compile_cmd_duration = compile_d_cmd.elapsed() - // eprintln('>>>> cretry: $cretry | compile_r.exit_code: $compile_r.exit_code | compile_cmd_duration: ${compile_cmd_duration:8} | file: $normalised_relative_file') + // eprintln('>>>> cretry: ${cretry} | compile_r.exit_code: ${compile_r.exit_code} | compile_cmd_duration: ${compile_cmd_duration:8} | file: ${normalised_relative_file}') if compile_r.exit_code == 0 { break } diff --git a/cmd/tools/modules/testing/output_normal.v b/cmd/tools/modules/testing/output_normal.v index 0008d4e0d..cd9f1b6a1 100644 --- a/cmd/tools/modules/testing/output_normal.v +++ b/cmd/tools/modules/testing/output_normal.v @@ -134,7 +134,7 @@ pub fn (r &NormalReporter) session_stop(message string, mut ts TestSession) { // the most general form; it may be useful for other reporters // in the normal one, it currently does nothing pub fn (mut r NormalReporter) report(index int, message LogMessage) { - // eprintln('> ${@METHOD} index: $index | message: $message') + // eprintln('> ${@METHOD} index: ${index} | message: ${message}') if message.kind == .compile_begin { lock r.compiling { r.compiling[message.file] = message diff --git a/cmd/tools/vbuild-tools.v b/cmd/tools/vbuild-tools.v index 3768eff0a..975f905aa 100644 --- a/cmd/tools/vbuild-tools.v +++ b/cmd/tools/vbuild-tools.v @@ -42,8 +42,8 @@ fn main() { for stool in tools_in_subfolders { session.add(os.join_path(tfolder, stool)) } - // eprintln('> session.files: $session.files') - // eprintln('> session.skip_files: $session.skip_files') + // eprintln('> session.files: ${session.files}') + // eprintln('> session.skip_files: ${session.skip_files}') session.test() eprintln(session.benchmark.total_message(finish_label)) if session.failed_cmds.len > 0 { diff --git a/cmd/tools/vcheck-md.v b/cmd/tools/vcheck-md.v index 33e93e445..2f38670c0 100644 --- a/cmd/tools/vcheck-md.v +++ b/cmd/tools/vcheck-md.v @@ -213,7 +213,7 @@ fn (mut f MDFile) echeck(actual int, limit int, ctx CheckResultContext, msg_temp fn (mut f MDFile) check() CheckResult { mut anchor_data := AnchorData{} for j, line in f.lines { - // f.progress('line: $j') + // f.progress('line: ${j}') if !f.skip_line_length_check { ctx := CheckResultContext{f.path, j, line} if f.state == .vexample { @@ -466,7 +466,7 @@ fn (mut f MDFile) check_examples() { vfile := os.join_path(vcheckfolder, 'check_${fname}_example_${e.sline}__${e.eline}__${uid}.v') efile := os.join_path(vcheckfolder, 'check_${fname}_example_${e.sline}__${e.eline}__${uid}.exe') mut should_cleanup_vfile := true - // eprintln('>>> checking example $vfile ...') + // eprintln('>>> checking example ${vfile} ...') vcontent := e.text.join('\n') + '\n' os.write_file(vfile, vcontent) or { panic(err) } mut acommands := e.command.split(' ') diff --git a/cmd/tools/vcomplete.v b/cmd/tools/vcomplete.v index 75b9450c3..37645ab62 100644 --- a/cmd/tools/vcomplete.v +++ b/cmd/tools/vcomplete.v @@ -798,6 +798,6 @@ Register-ArgumentCompleter -Native -CommandName v -ScriptBlock { fn main() { args := os.args[1..] - // println('"$args"') + // println('"${args}"') auto_complete(args) } diff --git a/cmd/tools/vpm/install_version_test.v b/cmd/tools/vpm/install_version_test.v index 5f92a6fb0..9ffa31589 100644 --- a/cmd/tools/vpm/install_version_test.v +++ b/cmd/tools/vpm/install_version_test.v @@ -154,7 +154,7 @@ fn test_install_from_hg_url_with_version_tag() ! { res = os.execute('${vexe} install -v --hg http://127.0.0.1:${port}@v0.1.0') p.signal_kill() if res.exit_code != 0 { - assert false, 'location: $@LOCATION, res:\n${res}' + assert false, 'location: ${@LOCATION}, res:\n${res}' } // Get manifest from the vmodules directory. manifest := get_vmod('my_awesome_v_module') diff --git a/cmd/tools/vrepeat.v b/cmd/tools/vrepeat.v index f9d0995b6..58fe20123 100644 --- a/cmd/tools/vrepeat.v +++ b/cmd/tools/vrepeat.v @@ -127,7 +127,7 @@ fn new_aints(ovals []i64, extreme_mins int, extreme_maxs int) Aints { devsum += (x * x) } res.stddev = math.sqrt(devsum / f64(vals.len)) - // eprintln('\novals: $ovals\n vals: $vals\n vals.len: $vals.len | res.imin: $res.imin | res.imax: $res.imax | res.average: $res.average | res.stddev: $res.stddev') + // eprintln('\novals: ${ovals}\n vals: ${vals}\n vals.len: ${vals.len} | res.imin: ${res.imin} | res.imax: ${res.imax} | res.average: ${res.average} | res.stddev: ${res.stddev}') return res } diff --git a/cmd/tools/vvet/tests/indent_with_space.vv b/cmd/tools/vvet/tests/indent_with_space.vv index 9b466ef4b..1c68d8c41 100644 --- a/cmd/tools/vvet/tests/indent_with_space.vv +++ b/cmd/tools/vvet/tests/indent_with_space.vv @@ -19,6 +19,6 @@ fn space_inside_strings() { Here too." str2 := 'linebreak and space\n inside' // String interpolation - si1 := 'Error here $foo + si1 := 'Error here ${foo} and not here' } diff --git a/cmd/tools/vwatch.v b/cmd/tools/vwatch.v index 7424e8b12..95443a79c 100644 --- a/cmd/tools/vwatch.v +++ b/cmd/tools/vwatch.v @@ -185,7 +185,7 @@ fn (mut context Context) get_stats_for_affected_vfiles() []VFileStat { } } context.affected_paths = apaths.keys() - // context.elog('vfiles paths to be scanned: $context.affected_paths') + // context.elog('vfiles paths to be scanned: ${context.affected_paths}') } // scan all files in the found folders: mut newstats := []VFileStat{} @@ -346,7 +346,7 @@ fn (mut context Context) compilation_runner_loop() { should_restart := RerunCommand.restart in cmds cmds = [] if should_restart { - // context.elog('>>>>>>>> KILLING $context.child_process.pid') + // context.elog('>>>>>>>> KILLING ${context.child_process.pid}') context.kill_pgroup() break } diff --git a/examples/brainvuck.v b/examples/brainvuck.v index f7737de73..7d5396cc5 100644 --- a/examples/brainvuck.v +++ b/examples/brainvuck.v @@ -60,7 +60,7 @@ fn (mut state BFState) find_matching_pairs() { pc := stack.pop() state.targets[pc] = i + 1 state.targets[i] = pc + 1 - // eprintln('>>> found `[` at i $i; pc: $pc') + // eprintln('>>> found `[` at i ${i}; pc: ${pc}') } else {} } diff --git a/examples/graphs/dfs.v b/examples/graphs/dfs.v index 4b158336e..af334d327 100644 --- a/examples/graphs/dfs.v +++ b/examples/graphs/dfs.v @@ -23,7 +23,6 @@ fn main() { 'G': ['H'] 'H': ['E', 'F', 'G'] } - // println('Graph: $graph') path_01 := depth_first_search_path(graph_01, 'A', 'F') println('\n Graph_01: a first path from node A to node F is: ${path_01.reverse()}') path_02 := depth_first_search_path(graph_02, 'A', 'H') diff --git a/examples/graphs/dfs2.v b/examples/graphs/dfs2.v index 695cefb18..cf316c9fd 100644 --- a/examples/graphs/dfs2.v +++ b/examples/graphs/dfs2.v @@ -24,7 +24,6 @@ fn main() { 'H': ['E', 'F', 'G'] } - // println('Graph: $graph') path_01 := depth_first_search_path(graph_01, 'A', 'F') println('\n Graph_01: all path pattern from node A to node F is:') print_pattern(path_01) diff --git a/examples/js_dom_draw_benchmark_chart/chart/README.md b/examples/js_dom_draw_benchmark_chart/chart/README.md index b0effbdaf..f445a344d 100644 --- a/examples/js_dom_draw_benchmark_chart/chart/README.md +++ b/examples/js_dom_draw_benchmark_chart/chart/README.md @@ -66,7 +66,7 @@ Create a service to request the benchmarks data by http Decode the info to `FrameworkBenchmarkResponse` ```v ignore fn typescript_sqlite_memory() ?FrameworkBenchmarkResponse { - url := 'http://localhost:3000/sqlite-memory/$benchmark_loop_length' + url := 'http://localhost:3000/sqlite-memory/${benchmark_loop_length}' res := http.get(url) or { panic(err) } framework_benchmark_response := json.decode(FrameworkBenchmarkResponse, res.body)! return framework_benchmark_response @@ -78,7 +78,7 @@ Create a service to request the benchmarks data by http Decode the info to `FrameworkBenchmarkResponse` ```v ignore fn typescript_sqlite_memory() ?FrameworkBenchmarkResponse { - url := 'http://localhost:3000/sqlite-memory/$benchmark_loop_length' + url := 'http://localhost:3000/sqlite-memory/${benchmark_loop_length}' res := http.get(url) or { panic(err) } framework_benchmark_response := json.decode(FrameworkBenchmarkResponse, res.body)! return framework_benchmark_response diff --git a/examples/js_dom_draw_benchmark_chart/chart/main.v b/examples/js_dom_draw_benchmark_chart/chart/main.v index ce297269a..67912ba31 100644 --- a/examples/js_dom_draw_benchmark_chart/chart/main.v +++ b/examples/js_dom_draw_benchmark_chart/chart/main.v @@ -158,7 +158,7 @@ fn v_sqlite_memory() !FrameworkBenchmarkResponse { } fn v_sqlite_file() !FrameworkBenchmarkResponse { - // url := 'http://localhost:3000/sqlite-memory/$benchmark_loop_length' + // url := 'http://localhost:3000/sqlite-memory/${benchmark_loop_length}' // res := http.get(url) or { panic(err) } // framework_benchmark_response := json.decode(FrameworkBenchmarkResponse, res.body)! framework_benchmark_response := FrameworkBenchmarkResponse{ diff --git a/examples/rule110.v b/examples/rule110.v index 4eecd6228..292b7a75b 100644 --- a/examples/rule110.v +++ b/examples/rule110.v @@ -37,7 +37,7 @@ fn main() { } print('\n') - // println('Random generated first automaton content: $generation_bin') + // println('Random generated first automaton content: ${generation_bin}') for _ in 0 .. n { print_generation(generation_bin) next_generation(mut generation_bin) diff --git a/examples/sokol/06_obj_viewer/modules/obj/obj.v b/examples/sokol/06_obj_viewer/modules/obj/obj.v index f23b3d98f..139b2c0fb 100644 --- a/examples/sokol/06_obj_viewer/modules/obj/obj.v +++ b/examples/sokol/06_obj_viewer/modules/obj/obj.v @@ -64,7 +64,7 @@ fn get_int(s string, start_index int) (int, int) { if state == .ints { match c { `0`...`9` { - // println("$res => ${(int(c) - 48)}") + // println("${res} => ${(int(c) - 48)}") res = res * 10 + (int(c) - 48) i++ continue @@ -92,7 +92,7 @@ fn get_float(s string, start_index int) (f64, int) { } i++ } - // println(" get_float: ($start_index,$i) [${s[start_index..i]}]") + // println(" get_float: (${start_index},${i}) [${s[start_index..i]}]") // f_res := strconv.atof_quick(s[start_index..i]) f_res := strconv.atof_quick(s[i1..i]) return f_res, i @@ -105,11 +105,11 @@ fn parse_3f(row string, start_index int) m4.Vec4 { mut f1 := f64(0) mut f2 := f64(0) f0, mut p := get_float(row, i) - // print("Here f0: $f0 $p ") + // print("Here f0: ${f0} ${p} ") f1, p = get_float(row, p + 1) - // print("Here f1: $f1 $p ") + // print("Here f1: ${f1} ${p} ") f2, p = get_float(row, p + 1) - // print("Here f2: $f2 $p ") + // print("Here f2: ${f2} ${p} ") return m4.Vec4{ e: [f32(f0), f32(f1), f32(f2), 1]! } @@ -198,7 +198,7 @@ pub fn (mut obj_part ObjPart) parse_obj_buffer(rows []string, single_material bo obj_part.part << default_part // println("OBJ file has ${rows.len} rows") for c, row in rows { - // println("$c $row") + // println("${c} ${row}") mut i := 0 row_count++ for true { @@ -226,7 +226,7 @@ pub fn (mut obj_part ObjPart) parse_obj_buffer(rows []string, single_material bo `u` { if single_material == false && row[i..i + 6] == 'usemtl' { material := row[i + 7..].trim_space() - // println("material: $material") + // println("material: ${material}") // manage multiple materials in an part if obj_part.part[obj_part.part.len - 1].material.len > 0 { mat_count++ @@ -252,7 +252,7 @@ pub fn (mut obj_part ObjPart) parse_obj_buffer(rows []string, single_material bo // normals `n` { obj_part.vn << parse_3f(row, i + 2) - // println("Vertex line: $c") + // println("Vertex line: ${c}") break } // parameters uvw @@ -264,21 +264,21 @@ pub fn (mut obj_part ObjPart) parse_obj_buffer(rows []string, single_material bo // texture uvw `t` { obj_part.vt << obj_part.parse_floats(row, i + 2) - // println("Vertex line: $c") + // println("Vertex line: ${c}") break } else { obj_part.v << parse_3f(row, i + 1) - // println("$row => ${obj_part.v[obj_part.v.len-1]}") + // println("${row} => ${obj_part.v[obj_part.v.len-1]}") break } } } `f` { - // println("$c $row") + // println("${c} ${row}") obj_part.part[obj_part.part.len - 1].parse_faces(row, i, obj_part) // println(obj_part.part[obj_part.part.len - 1].faces.len) - // println("Faces line: $c") + // println("Faces line: ${c}") break } // end of the line, comments @@ -306,7 +306,7 @@ fn (mut obj_part ObjPart) load_materials() { rows := read_lines_from_file(obj_part.material_file) println('Material file [${obj_part.material_file}] ${rows.len} Rows.') for row in rows { - // println("$row") + // println("${row}") mut i := 0 for true { if i >= row.len { @@ -432,7 +432,7 @@ pub fn (mut obj_part ObjPart) get_buffer(in_part_list []int) Skl_buffer { for in_part in in_part_list { part := obj_part.part[in_part] for fc, face in part.faces { - // println("$fc $face") + // println("${fc} ${face}") // default 3 faces mut v_seq := [0, 1, 2] if face.len == 4 { @@ -503,7 +503,7 @@ pub fn (mut obj_part ObjPart) get_buffer(in_part_list []int) Skl_buffer { out_buf.ibuf << u32(v_count_index) v_count_index++ } else { - // println("Cache used! $key") + // println("Cache used! ${key}") out_buf.ibuf << u32(cache[key]) cache_hit++ } @@ -514,11 +514,11 @@ pub fn (mut obj_part ObjPart) get_buffer(in_part_list []int) Skl_buffer { /* println("------------") for c1, x1 in out_buf.vbuf[..10] { - println("$c1 $x1") + println("${c1} ${x1}") } println(out_buf.ibuf[..10]) */ - // println("vbuf size: ${out_buf.vbuf.len} ibuf size: ${out_buf.ibuf.len} Cache hit: $cache_hit") + // println("vbuf size: ${out_buf.vbuf.len} ibuf size: ${out_buf.ibuf.len} Cache hit: ${cache_hit}") out_buf.n_vertex = u32(out_buf.ibuf.len) return out_buf } @@ -585,7 +585,7 @@ pub fn tst() { ort := m4.ortho(0,300,0,200,0,0) println(ort) a := m4.vec3(0,0,0) - println("a: $a") + println("a: ${a}") res := m4.mul_vec(ort, a) println("res:\n${res}") */ diff --git a/examples/sokol/06_obj_viewer/modules/obj/rend.v b/examples/sokol/06_obj_viewer/modules/obj/rend.v index 7c4994c24..dcd244ca6 100644 --- a/examples/sokol/06_obj_viewer/modules/obj/rend.v +++ b/examples/sokol/06_obj_viewer/modules/obj/rend.v @@ -141,7 +141,7 @@ pub fn (mut obj_part ObjPart) create_pipeline(in_part []int, shader gfx.Shader, res.bind.fs.images[C.SLOT_tex] = texture res.bind.fs.samplers[C.SLOT_smp] = sampler res.pipeline = gfx.make_pipeline(&pipdesc) - // println('Buffers part [$in_part] init done!') + // println('Buffers part [${in_part}] init done!') return res } @@ -165,7 +165,7 @@ pub fn (mut obj_part ObjPart) init_render_data(texture gfx.Image, sampler gfx.Sa // println("Material dict: ${obj_part.mat_map.keys()}") for k, v in part_dict { - // println("$k => Parts $v") + // println("${k} => Parts ${v}") mut txt := texture mut smp := sampler diff --git a/examples/sokol/06_obj_viewer/show_obj.v b/examples/sokol/06_obj_viewer/show_obj.v index 1a99d4b27..74479f5f3 100644 --- a/examples/sokol/06_obj_viewer/show_obj.v +++ b/examples/sokol/06_obj_viewer/show_obj.v @@ -178,7 +178,7 @@ fn frame(mut app App) { */ draw_end_glsl(app) - // println("v:$n_vertex_drawn") + // println("v:${n_vertex_drawn}") app.frame_count++ } diff --git a/examples/sokol/sounds/wav_player.v b/examples/sokol/sounds/wav_player.v index c678cc553..bd4bc5905 100644 --- a/examples/sokol/sounds/wav_player.v +++ b/examples/sokol/sounds/wav_player.v @@ -123,12 +123,12 @@ struct RIFFFormat { fn read_wav_file_samples(fpath string) ![]f32 { mut res := []f32{} - // eprintln('> read_wav_file_samples: $fpath -------------------------------------------------') + // eprintln('> read_wav_file_samples: ${fpath} -------------------------------------------------') mut bytes := os.read_bytes(fpath)! mut pbytes := &u8(bytes.data) mut offset := u32(0) rh := unsafe { &RIFFHeader(pbytes) } - // eprintln('rh: $rh') + // eprintln('rh: ${rh}') if rh.riff != [u8(`R`), `I`, `F`, `F`]! { return error('WAV should start with `RIFF`') } @@ -147,8 +147,8 @@ fn read_wav_file_samples(fpath string) ![]f32 { // ch := unsafe { &RIFFChunkHeader(pbytes + offset) } offset += 8 + ch.chunk_size - // eprintln('ch: $ch') - // eprintln('p: $pbytes | offset: $offset | bytes.len: $bytes.len') + // eprintln('ch: ${ch}') + // eprintln('p: ${pbytes} | offset: ${offset} | bytes.len: ${bytes.len}') // //////// if ch.chunk_type == [u8(`L`), `I`, `S`, `T`]! { continue @@ -161,7 +161,7 @@ fn read_wav_file_samples(fpath string) ![]f32 { if ch.chunk_type == [u8(`f`), `m`, `t`, ` `]! { // eprintln('`fmt ` chunk') rf = unsafe { &RIFFFormat(&ch.chunk_data) } - // eprintln('fmt riff format: $rf') + // eprintln('fmt riff format: ${rf}') if rf.format_tag != 1 { return error('only PCM encoded WAVs are supported') } @@ -178,7 +178,7 @@ fn read_wav_file_samples(fpath string) ![]f32 { if unsafe { rf == 0 } { return error('`data` chunk should be after `fmt ` chunk') } - // eprintln('`fmt ` chunk: $rf\n`data` chunk: $ch') + // eprintln('`fmt ` chunk: ${rf}\n`data` chunk: ${ch}') mut doffset := 0 mut dp := unsafe { &u8(&ch.chunk_data) } for doffset < ch.chunk_size { diff --git a/examples/term.ui/pong.v b/examples/term.ui/pong.v index 1449d54aa..fb2209ee7 100644 --- a/examples/term.ui/pong.v +++ b/examples/term.ui/pong.v @@ -449,7 +449,7 @@ fn (mut g Game) draw() { } // Ball gfx.draw_point(int(g.ball.pos.x), int(g.ball.pos.y)) - // gfx.draw_text(22,2,'$g.ball.pos') + // gfx.draw_text(22,2,'${g.ball.pos}') gfx.reset_bg_color() } diff --git a/examples/term.ui/term_drawing.v b/examples/term.ui/term_drawing.v index 6198b3e98..4c12dc5e5 100644 --- a/examples/term.ui/term_drawing.v +++ b/examples/term.ui/term_drawing.v @@ -422,7 +422,7 @@ fn (mut app App) draw_header() { app.ui.draw_text(0, 0, ' ${app.msg} ') app.ui.reset() } - //'tick: $app.ui.frame_count | ' + + //'tick: ${app.ui.frame_count} | ' + app.ui.draw_text(3, 2, 'terminal size: (${app.ui.window_width}, ${app.ui.window_height}) | primary color: ${app.primary_color.hex()} | secondary color: ${app.secondary_color.hex()}') app.ui.horizontal_separator(3) } diff --git a/examples/tetris/tetris.js.v b/examples/tetris/tetris.js.v index b0e9003ef..2e3ead630 100644 --- a/examples/tetris/tetris.js.v +++ b/examples/tetris/tetris.js.v @@ -423,7 +423,7 @@ fn parse_binary_tetro(t_ int) []Block { } fn on_event(e &gg.Event, mut game Game) { - // println('code=$e.char_code') + // println('code=${e.char_code}') if e.typ == .key_down { game.key_down(e.key_code) } diff --git a/examples/tetris/tetris.v b/examples/tetris/tetris.v index 1666e1b51..19b79cc86 100644 --- a/examples/tetris/tetris.v +++ b/examples/tetris/tetris.v @@ -416,7 +416,7 @@ fn parse_binary_tetro(t_ int) []Block { } fn on_event(e &gg.Event, mut game Game) { - // println('code=$e.char_code') + // println('code=${e.char_code}') if e.typ == .key_down { game.key_down(e.key_code) } diff --git a/examples/viewer/view.v b/examples/viewer/view.v index a63514ff3..87a5bebb2 100644 --- a/examples/viewer/view.v +++ b/examples/viewer/view.v @@ -296,7 +296,7 @@ pub fn load_image(mut app App) { file_path := app.item_list.get_file_path() if file_path != '' { - // println("${app.item_list.lst[app.item_list.item_index]} $file_path ${app.item_list.lst.len}") + // println("${app.item_list.lst[app.item_list.item_index]} ${file_path} ${app.item_list.lst.len}") app.texture, app.sampler, app.img_w, app.img_h = app.load_texture_from_file(file_path) app.img_ratio = f32(app.img_w) / f32(app.img_h) // println("texture: [${app.img_w},${app.img_h}] ratio: ${app.img_ratio}") @@ -432,7 +432,7 @@ fn frame(mut app App) { w = w * reduction_factor } - // println("$w,$h") + // println("${w},${h}") // white multiplicator for now mut c := [u8(255), 255, 255]! sgl.begin_quads() diff --git a/examples/viewer/zip_container.v b/examples/viewer/zip_container.v index bb32e511a..d2a25a45f 100644 --- a/examples/viewer/zip_container.v +++ b/examples/viewer/zip_container.v @@ -21,7 +21,7 @@ fn (mut il Item_list) scan_zip(path string, in_index int) ! { is_dir := zp.is_dir()! name := zp.name() size := zp.size() - // println("$index ${name} ${size:10} $is_dir") + // println("${index} ${name} ${size:10} ${is_dir}") if !is_dir { ext := get_extension(name) diff --git a/examples/websocket/client-server/client.v b/examples/websocket/client-server/client.v index 49fdf37f7..aeebad1a0 100644 --- a/examples/websocket/client-server/client.v +++ b/examples/websocket/client-server/client.v @@ -58,6 +58,6 @@ fn start_client() !&websocket.Client { return err } - spawn ws.listen() // or { println(term.red('error on listen $err')) } + spawn ws.listen() // or { println(term.red('error on listen ${err}')) } return ws } diff --git a/examples/websocket/ping.v b/examples/websocket/ping.v index eca823f6e..ff3a8f7ef 100644 --- a/examples/websocket/ping.v +++ b/examples/websocket/ping.v @@ -52,7 +52,7 @@ fn start_server() ! { }) s.on_close(fn (mut ws websocket.Client, code int, reason string) ! { slog('s.on_close code: ${code}, reason: ${reason}') - // println('client ($ws.id) closed connection') + // println('client (${ws.id}) closed connection') }) s.listen() or { slog('s.listen err: ${err}') @@ -93,14 +93,14 @@ fn start_client() ! { // you can add any pointer reference to use in callback // t := TestRef{count: 10} // ws.on_message_ref(fn (mut ws websocket.Client, msg &websocket.Message, r &SomeRef) ? { - // // eprintln('type: $msg.opcode payload:\n$msg.payload ref: $r') + // // eprintln('type: ${msg.opcode} payload:\n${msg.payload} ref: ${r}') // }, &r) ws.connect() or { clog('ws.connect err: ${err}') return err } clog('ws.connect succeeded') - spawn write_echo(mut ws) // or { println('error on write_echo $err') } + spawn write_echo(mut ws) // or { println('error on write_echo ${err}') } ws.listen() or { clog('ws.listen err: ${err}') return err diff --git a/vlib/builtin/array_test.v b/vlib/builtin/array_test.v index 52f2d72ee..084a23b41 100644 --- a/vlib/builtin/array_test.v +++ b/vlib/builtin/array_test.v @@ -985,7 +985,7 @@ fn test_for_last() { numbers := [1, 2, 3, 4] mut s := '[' for num in numbers { - s += '$num' + s += '${num}' if !last { s += ', ' @@ -1084,31 +1084,31 @@ fn test_drop() { mut a := [1, 2] a << 3 // pushing assures reallocation; a.cap now should be bigger: assert a.cap > 3 - // eprintln('>>> a.cap: $a.cap | a.len: $a.len') + // eprintln('>>> a.cap: ${a.cap} | a.len: ${a.len}') a.drop(-1000) assert a == [1, 2, 3] // a.drop( negative ) should NOT modify the array - // eprintln('>>> a.cap: $a.cap | a.len: $a.len') + // eprintln('>>> a.cap: ${a.cap} | a.len: ${a.len}') a.drop(2) assert a == [3] assert a.cap > a.len - // eprintln('>>> a.cap: $a.cap | a.len: $a.len') + // eprintln('>>> a.cap: ${a.cap} | a.len: ${a.len}') a.drop(10) assert a == [] assert a.cap > a.len - // eprintln('>>> a.cap: $a.cap | a.len: $a.len') + // eprintln('>>> a.cap: ${a.cap} | a.len: ${a.len}') a << 123 a << 456 a << 789 - // eprintln('>>> a.cap: $a.cap | a.len: $a.len') + // eprintln('>>> a.cap: ${a.cap} | a.len: ${a.len}') assert a == [123, 456, 789] a.drop(10) assert a == [] - // eprintln('>>> a.cap: $a.cap | a.len: $a.len') + // eprintln('>>> a.cap: ${a.cap} | a.len: ${a.len}') unsafe { a.free() } // test offset OK } diff --git a/vlib/builtin/builtin_d_use_libbacktrace.c.v b/vlib/builtin/builtin_d_use_libbacktrace.c.v index 2c6c3d200..530388ecc 100644 --- a/vlib/builtin/builtin_d_use_libbacktrace.c.v +++ b/vlib/builtin/builtin_d_use_libbacktrace.c.v @@ -63,7 +63,7 @@ fn bt_print_callback(data &BacktraceOptions, pc voidptr, filename_ptr &char, lin fn bt_error_callback(data voidptr, msg_ptr &char, errnum int) { // if data != unsafe { nil } && data.state != unsafe { nil } && data.state.filename != unsafe { nil } { // filename := unsafe{ data.state.filename.vstring() } - // eprint('$filename: ') + // eprint('${filename}: ') // } msg := unsafe { msg_ptr.vstring() } diff --git a/vlib/builtin/js/array_test.js.v b/vlib/builtin/js/array_test.js.v index ec1008d8c..0407a31a0 100644 --- a/vlib/builtin/js/array_test.js.v +++ b/vlib/builtin/js/array_test.js.v @@ -972,7 +972,7 @@ fn test_for_last() { numbers := [1, 2, 3, 4] mut s := '[' for num in numbers { - s += '$num' + s += '${num}' if !last { s += ', ' @@ -1103,7 +1103,7 @@ fn test_multi_array_index() { assert '${a}' == '[[1, 0, 0], [0, 0, 0]]' // mut b := [[0].repeat(3)].repeat(2) // b[0][0] = 1 - // assert '$b' == '[[1, 0, 0], [0, 0, 0]]' + // assert '${b}' == '[[1, 0, 0], [0, 0, 0]]' } fn test_plus_assign_string() { @@ -1447,7 +1447,7 @@ fn test_array_of_map_insert() { x[2]['123'] = 123 // RTE println(x) println('TODO: Map eq') - // assert '$x' == "[{}, {}, {'123': 123}, {}]" + // assert '${x}' == "[{}, {}, {'123': 123}, {}]" } fn test_multi_fixed_array_init() { diff --git a/vlib/builtin/js/builtin.v b/vlib/builtin/js/builtin.v index 15596dc56..ba2c05407 100644 --- a/vlib/builtin/js/builtin.v +++ b/vlib/builtin/js/builtin.v @@ -142,7 +142,7 @@ pub fn error(message string) IError { // Example: if ouch { return error_with_code('an error occurred', 1) } @[inline] pub fn error_with_code(message string, code int) IError { - // trace_error('$message | code: $code') + // trace_error('${message} | code: ${code}') return &MessageError{ msg: message code: code diff --git a/vlib/builtin/js/string_test.js.v b/vlib/builtin/js/string_test.js.v index 427a96a82..a9f93cf3b 100644 --- a/vlib/builtin/js/string_test.js.v +++ b/vlib/builtin/js/string_test.js.v @@ -792,7 +792,7 @@ fn test_raw_with_quotes() { fn test_escape() { a := 10 println("\"${a}") - // assert "\"$a" == '"10' + // assert "\"${a}" == '"10' } fn test_atoi() { @@ -955,24 +955,24 @@ fn test_interpolation_after_quoted_variable_still_works() { tt := 'xyz' // Basic interpolation, no internal quotes - yy := 'Replacing $rr with $tt' + yy := 'Replacing ${rr} with ${tt}' assert yy == 'Replacing abc with xyz' // Interpolation after quoted variable ending with 'r'quote // that may be mistaken with the start of a raw string, // ensure that it is not. - ss := 'Replacing "$rr" with "$tt"' + ss := 'Replacing "${rr}" with "${tt}"' assert ss == 'Replacing "abc" with "xyz"' - zz := "Replacing '$rr' with '$tt'" + zz := "Replacing '${rr}' with '${tt}'" assert zz == "Replacing 'abc' with 'xyz'" // Interpolation after quoted variable ending with 'c'quote // may be mistaken with the start of a c string, so // check it is not. cc := 'abc' - ccc := "Replacing '$cc' with '$tt'" + ccc := "Replacing '${cc}' with '${tt}'" assert ccc == "Replacing 'abc' with 'xyz'" - cccq := 'Replacing "$cc" with "$tt"' + cccq := 'Replacing "${cc}" with "${tt}"' assert cccq == 'Replacing "abc" with "xyz"' } */ diff --git a/vlib/builtin/linux_bare/old/.checks/checks.v b/vlib/builtin/linux_bare/old/.checks/checks.v index 8fd3575d9..6a60b5e6e 100644 --- a/vlib/builtin/linux_bare/old/.checks/checks.v +++ b/vlib/builtin/linux_bare/old/.checks/checks.v @@ -3,23 +3,23 @@ module main import os fn failed (msg string) { - println ("!!! failed: $msg") + println ("!!! failed: ${msg}") } fn passed (msg string) { - println (">>> passed: $msg") + println (">>> passed: ${msg}") } fn vcheck(vfile string) { run_check := "v -user_mod_path . -freestanding run " - if 0 == os.system("$run_check $vfile/${vfile}.v") { + if 0 == os.system("${run_check} ${vfile}/${vfile}.v") { passed(run_check) } else { failed(run_check) } - os.system("ls -lh $vfile/$vfile") - os.system("rm -f $vfile/$vfile") + os.system("ls -lh ${vfile}/${vfile}") + os.system("rm -f ${vfile}/${vfile}") } fn main() { diff --git a/vlib/builtin/linux_bare/old/array_bare.v b/vlib/builtin/linux_bare/old/array_bare.v index 1de97d3bf..040610e56 100644 --- a/vlib/builtin/linux_bare/old/array_bare.v +++ b/vlib/builtin/linux_bare/old/array_bare.v @@ -22,7 +22,7 @@ fn new_array_from_c_array(len int, cap int, elm_size int, c_array voidptr) array // Private function. Used to implement array[] operator fn (a array) get(i int) voidptr { if i < 0 || i >= a.len { - panic('array.get: index out of range') // FIXME: (i == $i, a.len == $a.len)') + panic('array.get: index out of range') // FIXME: (i == ${i}, a.len == ${a.len})') } return a.data + i * a.element_size } @@ -30,7 +30,7 @@ fn (a array) get(i int) voidptr { // Private function. Used to implement assignment to the array element. fn (mut a array) set(i int, val voidptr) { if i < 0 || i >= a.len { - panic('array.set: index out of range') // FIXME: (i == $i, a.len == $a.len)') + panic('array.set: index out of range') // FIXME: (i == ${i}, a.len == ${a.len})') } mem_copy(a.data + a.element_size * i, val, a.element_size) } diff --git a/vlib/builtin/sorting_test.v b/vlib/builtin/sorting_test.v index e2f470680..80a6b617b 100644 --- a/vlib/builtin/sorting_test.v +++ b/vlib/builtin/sorting_test.v @@ -50,7 +50,7 @@ fn test_sorting_by_passing_a_mut_array_to_a_function() { fn test_sorting_by_passing_an_anonymous_sorting_function() { mut a := unsorted a.sort(fn(a &int, b &int) int { return *b - *a }) - println(' a: $a') + println(' a: ${a}') assert a == sort_desc } */ diff --git a/vlib/crypto/ed25519/internal/edwards25519/point.v b/vlib/crypto/ed25519/internal/edwards25519/point.v index 4661ed8c9..e8a6bec9b 100644 --- a/vlib/crypto/ed25519/internal/edwards25519/point.v +++ b/vlib/crypto/ed25519/internal/edwards25519/point.v @@ -530,7 +530,7 @@ fn check_on_curve(points ...Point) bool { } /* if lhs.equal(rhs) != 1 { - lg.error('X, Y, and Z do not specify a point on the curve\nX = $p.x \nY = $p.y\nZ = $p.z') + lg.error('X, Y, and Z do not specify a point on the curve\nX = ${p.x} \nY = ${p.y}\nZ = ${p.z}') }*/ // xy = T/Z @@ -538,7 +538,7 @@ fn check_on_curve(points ...Point) bool { rhs.multiply(p.z, p.t) /* if lhs.equal(rhs) != 1 { - lg.error('point $i is not valid\nX = $p.x\nY = $p.y\nZ = $p.z') + lg.error('point ${i} is not valid\nX = ${p.x}\nY = ${p.y}\nZ = ${p.z}') }*/ if lhs.equal(rhs) != 1 { return false diff --git a/vlib/db/redis/README.md b/vlib/db/redis/README.md index 27404a472..83f23f023 100644 --- a/vlib/db/redis/README.md +++ b/vlib/db/redis/README.md @@ -139,7 +139,7 @@ config := redis.Config{ mut db := redis.connect(config)! defer { - db.close() or { eprintln('Error closing connection: $err') } + db.close() or { eprintln('Error closing connection: ${err}') } } ``` diff --git a/vlib/db/sqlite/stmt.c.v b/vlib/db/sqlite/stmt.c.v index 56d63025d..f321b7349 100644 --- a/vlib/db/sqlite/stmt.c.v +++ b/vlib/db/sqlite/stmt.c.v @@ -8,7 +8,7 @@ fn C.sqlite3_bind_text(&C.sqlite3_stmt, int, &char, int, voidptr) int // Only for V ORM fn (db &DB) init_stmt(query string) (&C.sqlite3_stmt, int) { - // println('init_stmt("$query")') + // println('init_stmt("${query}")') stmt := &C.sqlite3_stmt(unsafe { nil }) err := C.sqlite3_prepare_v2(db.conn, &char(query.str), query.len, &stmt, 0) return stmt, err diff --git a/vlib/encoding/utf8/utf8_util.v b/vlib/encoding/utf8/utf8_util.v index 63f54e818..0970fbf81 100644 --- a/vlib/encoding/utf8/utf8_util.v +++ b/vlib/encoding/utf8/utf8_util.v @@ -431,7 +431,7 @@ fn convert_case(s string, upper_flag bool) string { lword = int(u32(lword) << 8 | u32(s[index + i])) } - // println("#${index} ($lword)") + // println("#${index} (${lword})") mut res := 0 diff --git a/vlib/flag/flag.v b/vlib/flag/flag.v index 2cfed2bc8..720c62b7b 100644 --- a/vlib/flag/flag.v +++ b/vlib/flag/flag.v @@ -82,8 +82,8 @@ pub: all_after_dashdash []string // all options after `--` are ignored, and will be passed to the application unmodified pub mut: usage_examples []string // when set, --help will print: - // Usage: $appname $usage_examples[0]` - // or: $appname $usage_examples[1]` + // Usage: ${appname} ${usage_examples[0]}` + // or: ${appname} ${usage_examples[1]}` // etc default_help_label string = 'display this help and exit' default_version_label string = 'output version information and exit' diff --git a/vlib/gg/gg.c.v b/vlib/gg/gg.c.v index 4268eab40..87e7304f4 100644 --- a/vlib/gg/gg.c.v +++ b/vlib/gg/gg.c.v @@ -248,7 +248,7 @@ fn gg_init_sokol_window(user_data voidptr) { // is_high_dpi := sapp.high_dpi() // fb_w := sapp.width() // fb_h := sapp.height() - // println('ctx.scale=$ctx.scale is_high_dpi=$is_high_dpi fb_w=$fb_w fb_h=$fb_h') + // println('ctx.scale=${ctx.scale} is_high_dpi=${is_high_dpi} fb_w=${fb_w} fb_h=${fb_h}') // if ctx.config.init_text { // `os.is_file()` won't work on Android if the font file is embedded into the APK exists := $if !android { os.is_file(ctx.config.font_path) } $else { true } diff --git a/vlib/gg/gg_darwin.m b/vlib/gg/gg_darwin.m index e2fa20d6c..5053d91f9 100644 --- a/vlib/gg/gg_darwin.m +++ b/vlib/gg/gg_darwin.m @@ -78,7 +78,7 @@ void darwin_draw_string(int x, int y, string s, gg__TextCfg cfg) { } int darwin_text_width(string s) { - // println('text_width "$s" len=$s.len') + // println('text_width "${s}" len=${s.len}') NSString* n = @""; if (s.len == 1) { // println('len=1') diff --git a/vlib/gg/image.c.v b/vlib/gg/image.c.v index fc1efc5a1..5f70be593 100644 --- a/vlib/gg/image.c.v +++ b/vlib/gg/image.c.v @@ -57,7 +57,7 @@ pub fn (mut ctx Context) create_image(file string) !Image { // return C.darwin_create_image(file) mut img := C.darwin_create_image(file) - // println('created macos image: $img.path w=$img.width') + // println('created macos image: ${img.path} w=${img.width}') // C.printf('p = %p\n', img.data) img.id = ctx.image_cache.len unsafe { @@ -97,7 +97,7 @@ pub fn (mut ctx Context) create_image(file string) !Image { // init_sokol_image initializes this `Image` for use with the // sokol graphical backend system. pub fn (mut img Image) init_sokol_image() &Image { - // println('\n init sokol image $img.path ok=$img.simg_ok') + // println('\n init sokol image ${img.path} ok=${img.simg_ok}') mut img_desc := gfx.ImageDesc{ width: img.width height: img.height diff --git a/vlib/gg/testdata/tweak_circles.vv b/vlib/gg/testdata/tweak_circles.vv index 8e68077ff..b16c40b69 100644 --- a/vlib/gg/testdata/tweak_circles.vv +++ b/vlib/gg/testdata/tweak_circles.vv @@ -43,6 +43,6 @@ fn frame(mut app App) { app.gg.begin() app.gg.draw_circle_empty(150, 150, f32(app.radius), gg.blue) app.gg.draw_text(20, 20, 'radius: ${app.radius}') - // app.gg.draw_text(20, 50, 'circle_segment_size: $circle_segment_size') + // app.gg.draw_text(20, 50, 'circle_segment_size: ${circle_segment_size}') app.gg.end() } diff --git a/vlib/gg/text_rendering.c.v b/vlib/gg/text_rendering.c.v index 55d71de57..6c104b248 100644 --- a/vlib/gg/text_rendering.c.v +++ b/vlib/gg/text_rendering.c.v @@ -276,7 +276,7 @@ pub fn (ctx &Context) text_width(s string) int { ctx.text_width('i') // TODO: fix this in fontstash? } res := int((buf[2] - buf[0]) / ctx.scale) - // println('TW "$s" = $res') + // println('TW "${s}" = ${res}') $if macos { if ctx.native_rendering { return res * 2 @@ -325,7 +325,7 @@ pub fn (ctx &Context) text_width_f(s string) f32 { ctx.text_width('i') // TODO: fix this in fontstash? } res := int((buf[2] - buf[0]) / ctx.scale) - // println('TW "$s" = $res') + // println('TW "${s}" = ${res}') $if macos { if ctx.native_rendering { return res * 2 diff --git a/vlib/io/os_file_reader_test.v b/vlib/io/os_file_reader_test.v index 1ed3a1f7f..bc179c9c0 100644 --- a/vlib/io/os_file_reader_test.v +++ b/vlib/io/os_file_reader_test.v @@ -11,7 +11,7 @@ fn read_file(file string, cap int) []string { for { l := r.read_line() or { break } lines << l - // println('Line: $l') + // println('Line: ${l}') } assert lines.len > 0 assert r.end_of_stream == true diff --git a/vlib/io/util/util_test.v b/vlib/io/util/util_test.v index 00376959e..ef3a3548b 100644 --- a/vlib/io/util/util_test.v +++ b/vlib/io/util/util_test.v @@ -19,7 +19,7 @@ fn testsuite_end() { os.chdir(os.wd_at_startup) or {} os.rmdir_all(tfolder) or {} assert !os.is_dir(tfolder) - // eprintln('testsuite_end , tfolder = $tfolder removed.') + // eprintln('testsuite_end , tfolder = ${tfolder} removed.') } fn test_temp_file() { diff --git a/vlib/json/tests/json_test.v b/vlib/json/tests/json_test.v index 522fda54d..a71934223 100644 --- a/vlib/json/tests/json_test.v +++ b/vlib/json/tests/json_test.v @@ -17,10 +17,10 @@ struct Employee { fn test_simple() { x := Employee{'Peter', 28, 95000.5, .worker} s := json.encode(x) - // eprintln('Employee x: $s') + // eprintln('Employee x: ${s}') assert s == '{"name":"Peter","age":28,"salary":95000.5,"title":"worker"}' y := json.decode(Employee, s)! - // eprintln('Employee y: $y') + // eprintln('Employee y: ${y}') assert y.name == 'Peter' assert y.age == 28 assert y.salary == 95000.5 @@ -90,15 +90,15 @@ fn test_encode_decode_sumtype() { t, ] } - // eprintln('Game: $game') + // eprintln('Game: ${game}') enc := json.encode(game) - // eprintln('Encoded Game: $enc') + // eprintln('Encoded Game: ${enc}') assert enc == '{"title":"Super Mega Game","player":{"name":"Monke","_type":"Human"},"other":[{"tag":"Pen","_type":"Item"},{"tag":"Cookie","_type":"Item"},"cat","Stool",{"_type":"Time","value":${t.unix()}}]}' dec := json.decode(SomeGame, enc)! - // eprintln('Decoded Game: $dec') + // eprintln('Decoded Game: ${dec}') assert game.title == dec.title assert game.player == dec.player diff --git a/vlib/log/file_log_test.v b/vlib/log/file_log_test.v index 9bed566a6..68ddf6857 100644 --- a/vlib/log/file_log_test.v +++ b/vlib/log/file_log_test.v @@ -26,7 +26,7 @@ fn test_reopen() { l.warn('third warning') l.flush() l.close() - // os.system('ls -la $lpath1 $lpath2') + // os.system('ls -la ${lpath1} ${lpath2}') lcontent1 := os.read_file(lpath1)! lcontent2 := os.read_file(lpath2)! assert lcontent1.len > 0 diff --git a/vlib/net/http/http.v b/vlib/net/http/http.v index 984b78bd0..de235e634 100644 --- a/vlib/net/http/http.v +++ b/vlib/net/http/http.v @@ -46,7 +46,7 @@ pub mut: // `data`. pub fn new_request(method Method, url_ string, data string) Request { url := if method == .get && !url_.contains('?') { url_ + '?' + data } else { url_ } - // println('new req() method=$method url="$url" dta="$data"') + // println('new req() method=${method} url="${url}" dta="${data}"') return Request{ method: method url: url diff --git a/vlib/net/http/request.v b/vlib/net/http/request.v index 55adfa5cc..b8565626a 100644 --- a/vlib/net/http/request.v +++ b/vlib/net/http/request.v @@ -145,9 +145,9 @@ fn (req &Request) method_and_url_to_response(method Method, url urllib.URL) !Res nport = 443 } } - // println('fetch $method, $scheme, $host_name, $nport, $path ') + // println('fetch ${method}, ${scheme}, ${host_name}, ${nport}, ${path} ') if scheme == 'https' && req.proxy == unsafe { nil } { - // println('ssl_do( $nport, $method, $host_name, $path )') + // println('ssl_do( ${nport}, ${method}, ${host_name}, ${path} )') for i in 0 .. req.max_retries { res := req.ssl_do(nport, method, host_name, path) or { if i == req.max_retries - 1 || is_no_need_retry_error(err.code()) { @@ -158,7 +158,7 @@ fn (req &Request) method_and_url_to_response(method Method, url urllib.URL) !Res return res } } else if scheme == 'http' && req.proxy == unsafe { nil } { - // println('http_do( $nport, $method, $host_name, $path )') + // println('http_do( ${nport}, ${method}, ${host_name}, ${path} )') for i in 0 .. req.max_retries { res := req.http_do('${host_name}:${nport}', method, path) or { if i == req.max_retries - 1 || is_no_need_retry_error(err.code()) { diff --git a/vlib/net/http/server_test.v b/vlib/net/http/server_test.v index c107defb3..7e6b429b4 100644 --- a/vlib/net/http/server_test.v +++ b/vlib/net/http/server_test.v @@ -83,7 +83,7 @@ mut: fn (mut handler MyHttpHandler) handle(req http.Request) http.Response { handler.counter++ - // eprintln('$time.now() | counter: $handler.counter | $req.method $req.url\n$req.header\n$req.data - 200 OK\n') + // eprintln('${time.now()} | counter: ${handler.counter} | ${req.method} ${req.url}\n${req.header}\n${req.data} - 200 OK\n') mut r := http.Response{ body: req.data + ', ${req.url}' header: req.header diff --git a/vlib/net/websocket/tests/autobahn/autobahn_client_wss.v b/vlib/net/websocket/tests/autobahn/autobahn_client_wss.v index 4a03f83da..3a0627fae 100644 --- a/vlib/net/websocket/tests/autobahn/autobahn_client_wss.v +++ b/vlib/net/websocket/tests/autobahn/autobahn_client_wss.v @@ -18,7 +18,7 @@ fn main() { fn handle_case(case_nr int) ! { uri := 'wss://autobahn_server_wss:9002/runCase?case=${case_nr}&agent=v-client' - // uri := 'wss://localhost:9002/runCase?case=$case_nr&agent=v-client' + // uri := 'wss://localhost:9002/runCase?case=${case_nr}&agent=v-client' mut ws := websocket.new_client(uri)! ws.on_message(on_message) ws.connect()! diff --git a/vlib/net/websocket/tests/autobahn/local_run/autobahn_client_wss.v b/vlib/net/websocket/tests/autobahn/local_run/autobahn_client_wss.v index 4a03f83da..3a0627fae 100644 --- a/vlib/net/websocket/tests/autobahn/local_run/autobahn_client_wss.v +++ b/vlib/net/websocket/tests/autobahn/local_run/autobahn_client_wss.v @@ -18,7 +18,7 @@ fn main() { fn handle_case(case_nr int) ! { uri := 'wss://autobahn_server_wss:9002/runCase?case=${case_nr}&agent=v-client' - // uri := 'wss://localhost:9002/runCase?case=$case_nr&agent=v-client' + // uri := 'wss://localhost:9002/runCase?case=${case_nr}&agent=v-client' mut ws := websocket.new_client(uri)! ws.on_message(on_message) ws.connect()! diff --git a/vlib/net/websocket/websocket_client.v b/vlib/net/websocket/websocket_client.v index d3b702674..ac4d5652a 100644 --- a/vlib/net/websocket/websocket_client.v +++ b/vlib/net/websocket/websocket_client.v @@ -243,7 +243,7 @@ pub fn (mut ws Client) pong() ! { // write_ptr writes len bytes provided a byteptr with a websocket messagetype pub fn (mut ws Client) write_ptr(bytes &u8, payload_len int, code OPCode) !int { - // ws.debug_log('write_ptr code: $code') + // ws.debug_log('write_ptr code: ${code}') if ws.get_state() != .open || ws.conn.sock.handle < 1 { // todo: send error here later return error('trying to write on a closed socket!') diff --git a/vlib/os/file.c.v b/vlib/os/file.c.v index bdb1c6d73..a97052b74 100644 --- a/vlib/os/file.c.v +++ b/vlib/os/file.c.v @@ -128,7 +128,7 @@ pub fn open(path string) !File { $if !android { fd := C.syscall(sys_open, path.str, 511) if fd == -1 { - return error('failed to open file "$path"') + return error('failed to open file "${path}"') } return File{ fd: fd diff --git a/vlib/os/os_nix.c.v b/vlib/os/os_nix.c.v index 4b09e02f0..f1d008a6c 100644 --- a/vlib/os/os_nix.c.v +++ b/vlib/os/os_nix.c.v @@ -270,9 +270,9 @@ pub fn loginname() !string { // entries := os.ls(os.home_dir()) or { [] } // for entry in entries { // if os.is_dir(os.join_path(os.home_dir(), entry)) { -// println('dir: $entry') +// println('dir: ${entry}') // } else { -// println('file: $entry') +// println('file: ${entry}') // } // } // ``` diff --git a/vlib/os/os_test.c.v b/vlib/os/os_test.c.v index b6d34c479..b9c3caa02 100644 --- a/vlib/os/os_test.c.v +++ b/vlib/os/os_test.c.v @@ -17,7 +17,7 @@ fn testsuite_begin() { os.mkdir_all(tfolder) or { panic(err) } os.chdir(tfolder) or {} assert os.is_dir(tfolder) - // println('args_at_start: $args_at_start') + // println('args_at_start: ${args_at_start}') assert args_at_start.len > 0 assert args_at_start == os.args } @@ -26,7 +26,7 @@ fn testsuite_end() { os.chdir(os.wd_at_startup) or {} os.rmdir_all(tfolder) or {} // assert !os.is_dir(tfolder) - // eprintln('testsuite_end , tfolder = $tfolder removed.') + // eprintln('testsuite_end , tfolder = ${tfolder} removed.') } fn test_open_file() { @@ -100,8 +100,8 @@ fn test_open_file_binary() { // } // f.close() // // -// eprintln('line1: $line1 $line1.bytes()') -// eprintln('line2: $line2 $line2.bytes()') +// eprintln('line1: ${line1} ${line1.bytes()}') +// eprintln('line2: ${line2} ${line2.bytes()}') // assert line1 == 'line 1\n' // assert line2 == 'line 2' // } @@ -187,8 +187,8 @@ fn test_write_and_read_bytes() { // We only need to test read_bytes because this function calls // read_bytes_at with second parameter zeroed (size, 0). rbytes := file_read.read_bytes(5) - // eprintln('rbytes: $rbytes') - // eprintln('payload: $payload') + // eprintln('rbytes: ${rbytes}') + // eprintln('payload: ${payload}') assert rbytes == payload // check that trying to read data from EOF doesn't error and returns 0 mut a := []u8{len: 5} @@ -881,7 +881,7 @@ fn test_stdout_capture() { cmd.start() for !cmd.eof { line := cmd.read_line() - println('line="$line"') + println('line="${line}"') } cmd.close() */ @@ -1018,10 +1018,10 @@ fn test_execute() { } result := os.execute('${os.quoted_path(@VEXE)} run ${os.quoted_path(print0script)}') hexresult := result.output.hex() - // println('exit_code: $result.exit_code') - // println('output: |$result.output|') - // println('output.len: $result.output.len') - // println('output hexresult: $hexresult') + // println('exit_code: ${result.exit_code}') + // println('output: |${result.output}|') + // println('output.len: ${result.output.len}') + // println('output hexresult: ${hexresult}') assert result.exit_code == 0 assert hexresult.starts_with('7374617274004d4944444c450066696e697368') assert hexresult.ends_with('0a7878') @@ -1097,7 +1097,7 @@ fn move_across_partitions_using_function(f fn (src string, dst string, opts os.M eprintln('skipping test_mv_by_cp, because bindfs was not present') return } - // eprintln('>> $bindfs') + // eprintln('>> ${bindfs}') pfolder := os.join_path(tfolder, 'parent') cfolder := os.join_path(pfolder, 'child') mfolder := os.join_path(pfolder, 'mountpoint') @@ -1110,7 +1110,7 @@ fn move_across_partitions_using_function(f fn (src string, dst string, opts os.M target_path := os.join_path(cdeepfolder, 'target.txt') os.write_file(original_path, 'text')! os.write_file(os.join_path(cdeepfolder, 'x.txt'), 'some text')! - // os.system('tree $pfolder') + // os.system('tree ${pfolder}') /* /tmp/v_1000/v/tests/os_test/parent ├── child @@ -1124,7 +1124,7 @@ fn move_across_partitions_using_function(f fn (src string, dst string, opts os.M defer { os.system('sync; umount ${mfolder}') } - // os.system('tree $pfolder') + // os.system('tree ${pfolder}') /* /tmp/v_1000/v/tests/os_test/parent ├── child diff --git a/vlib/rand/random_bytes_test.v b/vlib/rand/random_bytes_test.v index de0a3b8f2..81750974a 100644 --- a/vlib/rand/random_bytes_test.v +++ b/vlib/rand/random_bytes_test.v @@ -52,7 +52,7 @@ fn test_rand_read() { for k in j + 1 .. max { end := '00'.repeat(max - k) middle := '00'.repeat(k - j) - // eprintln('> j: $j | k: $k | start: $start | middle: $middle | end: $end') + // eprintln('> j: ${j} | k: ${k} | start: ${start} | middle: ${middle} | end: ${end}') for i in 0 .. max { a[i] = 0 } @@ -82,7 +82,7 @@ fn test_prng_rand_read() { for k in j + 1 .. max { end := '00'.repeat(max - k) middle := '00'.repeat(k - j) - // eprintln('> j: $j | k: $k | start: $start | middle: $middle | end: $end') + // eprintln('> j: ${j} | k: ${k} | start: ${start} | middle: ${middle} | end: ${end}') for i in 0 .. max { a[i] = 0 } diff --git a/vlib/rand/random_identifiers_test.v b/vlib/rand/random_identifiers_test.v index 5a931531f..8aa7cc180 100644 --- a/vlib/rand/random_identifiers_test.v +++ b/vlib/rand/random_identifiers_test.v @@ -124,9 +124,9 @@ fn test_ulids_should_be_lexicographically_ordered_when_not_in_same_millisecond() time.sleep(1 * time.millisecond) ulid3 := rand.ulid() mut all := [ulid3, ulid2, ulid1] - // eprintln('all before: $all') + // eprintln('all before: ${all}') all.sort() - // eprintln('all after: $all') + // eprintln('all after: ${all}') s1 := all[0] s2 := all[1] s3 := all[2] diff --git a/vlib/rand/random_numbers_test.v b/vlib/rand/random_numbers_test.v index 1e8952624..ef57b3366 100644 --- a/vlib/rand/random_numbers_test.v +++ b/vlib/rand/random_numbers_test.v @@ -435,7 +435,7 @@ fn test_shuffle() { for idx in 0 .. 10 { assert digits[digit][idx] >= 10 } - // eprintln('digits[$digit]: ${digits[digit]}') + // eprintln('digits[${digit}]: ${digits[digit]}') } } diff --git a/vlib/readline/readline_nix.c.v b/vlib/readline/readline_nix.c.v index 64b01b81e..1a475f349 100644 --- a/vlib/readline/readline_nix.c.v +++ b/vlib/readline/readline_nix.c.v @@ -51,15 +51,15 @@ pub fn (mut r Readline) enable_raw_mode() { return } mut raw := r.orig_termios - // println('> r.orig_termios: $r.orig_termios') - // println('> raw: $raw') + // println('> r.orig_termios: ${r.orig_termios}') + // println('> raw: ${raw}') raw.c_iflag &= termios.invert(C.BRKINT | C.ICRNL | C.INPCK | C.ISTRIP | C.IXON) raw.c_cflag |= termios.flag(C.CS8) raw.c_lflag &= termios.invert(C.ECHO | C.ICANON | C.IEXTEN | C.ISIG) raw.c_cc[C.VMIN] = u8(1) raw.c_cc[C.VTIME] = u8(0) termios.tcsetattr(0, C.TCSADRAIN, mut raw) - // println('> after raw: $raw') + // println('> after raw: ${raw}') r.is_raw = true r.is_tty = true } diff --git a/vlib/readline/readline_test.v b/vlib/readline/readline_test.v index a3613e85a..2358d73de 100644 --- a/vlib/readline/readline_test.v +++ b/vlib/readline/readline_test.v @@ -6,15 +6,15 @@ fn no_lines(s string) string { fn test_struct_readline() { // mut rl := readline.Readline{} - // eprintln('rl: $rl') + // eprintln('rl: ${rl}') // line := rl.read_line('Please, enter your name: ') or { panic(err) } - // eprintln('line: $line') + // eprintln('line: ${line}') mut methods := []string{} $for method in Readline.methods { - // eprintln(' method: $method.name | ' + no_lines('$method')) + // eprintln(' method: ${method.name} | ' + no_lines('${method}')) methods << method.name } - // eprintln('methods: $methods') + // eprintln('methods: ${methods}') assert 'read_line_utf8' in methods assert 'read_line' in methods } diff --git a/vlib/regex/regex.v b/vlib/regex/regex.v index 48922b5f2..60ffac32f 100644 --- a/vlib/regex/regex.v +++ b/vlib/regex/regex.v @@ -773,7 +773,7 @@ fn (re &RE) parse_quantifier(in_txt string, in_i int) (int, int, int, bool) { unsafe { ch = in_txt.str[i] } - // println("${ch:c} status: $status") + // println("${ch:c} status: ${status}") // exit on no compatible char with {} quantifier if utf8util_char_len(ch) != 1 { @@ -1039,7 +1039,7 @@ fn (mut re RE) impl_compile(in_txt string) (int, int) { return err_group_qm_notation, next_i } - // println("Parse group: [$tmp_res, $cgroup_flag, ($i,$next_i), '${in_txt[i..next_i]}' ]") + // println("Parse group: [${tmp_res}, ${cgroup_flag}, (${i},${next_i}), '${in_txt[i..next_i]}' ]") i = next_i if cgroup_flag == true { @@ -1188,7 +1188,7 @@ fn (mut re RE) impl_compile(in_txt string) (int, int) { min, max, tmp, greedy := re.parse_quantifier(in_txt, i + 1) // it is a quantifier if min >= 0 { - // println("{$min,$max}\n str:[${in_txt[i..i+tmp]}] greedy:$greedy") + // println("{${min},${max}}\n str:[${in_txt[i..i+tmp]}] greedy:${greedy}") i = i + tmp re.prog[pc - 1].rep_min = min re.prog[pc - 1].rep_max = max @@ -1229,7 +1229,7 @@ fn (mut re RE) impl_compile(in_txt string) (int, int) { if u8(char_tmp) == `[` { cc_index, tmp, cc_type := re.parse_char_class(in_txt, i + 1) if cc_index >= 0 { - // println("index: $cc_index str:${in_txt[i..i+tmp]}") + // println("index: ${cc_index} str:${in_txt[i..i+tmp]}") i = i + tmp re.prog[pc].ist = u32(0) | cc_type re.prog[pc].cc_index = cc_index @@ -1346,7 +1346,7 @@ fn (mut re RE) impl_compile(in_txt string) (int, int) { mut last_dot_char_pc := -1 for pc1 < pc { if re.prog[pc1].ist == ist_dot_char { - // println("Dot_char pc: $pc1") + // println("Dot_char pc: ${pc1}") last_dot_char_pc = pc1 dot_char_count++ mut pc2 := pc1 + 1 @@ -1392,7 +1392,7 @@ fn (mut re RE) impl_compile(in_txt string) (int, int) { mut last_bsls_char_pc := -1 for pc1 < pc { if re.prog[pc1].ist == ist_bsls_char { - // println("bsls_char pc: $pc1") + // println("bsls_char pc: ${pc1}") last_bsls_char_pc = pc1 bsls_char_count++ mut pc2 := pc1 + 1 @@ -1472,7 +1472,7 @@ fn (mut re RE) impl_compile(in_txt string) (int, int) { // set the jump in the right places pc1 = 0 for pc1 < pc - 2 { - // println("Here $pc1 ${pc-2}") + // println("Here ${pc1} ${pc-2}") // println("source index: ${pc1 + 1} => ${re.prog[pc1+1].source_index}") if re.prog[pc1 + 1].ist == ist_or_branch { // two consecutive OR are a syntax error @@ -1512,7 +1512,7 @@ fn (mut re RE) impl_compile(in_txt string) (int, int) { if re.prog[pc1 + 1].rep_max == pc1 { re.prog[pc1 + 1].rep_max = 3 } - // println("Compile OR postproc. [$pc1,OR ${pc1+1},$pc2]") + // println("Compile OR postproc. [${pc1},OR ${pc1+1},${pc2}]") pc1 = pc2 continue } @@ -1955,7 +1955,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { for state.group_index >= 0 { tmp_pc := re.group_data[state.group_index] re.prog[tmp_pc].group_rep++ - // println("Closing group $state.group_index {${re.prog[tmp_pc].rep_min},${re.prog[tmp_pc].rep_max}}:${re.prog[tmp_pc].group_rep}") + // println("Closing group ${state.group_index} {${re.prog[tmp_pc].rep_min},${re.prog[tmp_pc].rep_max}}:${re.prog[tmp_pc].group_rep}") if re.prog[tmp_pc].group_rep >= re.prog[tmp_pc].rep_min && re.prog[tmp_pc].group_id >= 0 { @@ -1998,7 +1998,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { } // println("Finished text!!") - // println("Instruction: ${ist:08x} pc: $state.pc") + // println("Instruction: ${ist:08x} pc: ${state.pc}") // println("min_rep: ${re.prog[state.pc].rep_min} max_rep: ${re.prog[state.pc].rep_max} rep: ${re.prog[state.pc].rep}") // program end @@ -2147,7 +2147,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { state.group_index++ re.group_data[state.group_index] = re.prog[state.pc].goto_pc // save where is ist_group_end, we will use it for escape re.group_stack[state.group_index] = state.i // index where we start to manage - // println("group_index $state.group_index rep ${re.prog[re.prog[state.pc].goto_pc].group_rep}") + // println("group_index ${state.group_index} rep ${re.prog[re.prog[state.pc].goto_pc].group_rep}") m_state = .ist_next continue @@ -2183,14 +2183,14 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { re.groups[g_index + 1] = in_txt_len - 1 } - // println("GROUP ${re.prog[state.pc].group_id} END [${re.groups[g_index]}, ${re.groups[g_index+1]}] i: $state.i in_txt_len: $in_txt_len") + // println("GROUP ${re.prog[state.pc].group_id} END [${re.groups[g_index]}, ${re.groups[g_index+1]}] i: ${state.i} in_txt_len: ${in_txt_len}") // continuous save, save until we have space re.group_continuous_save(g_index) } re.prog[state.pc].group_rep++ // increase repetitions - // println("GROUP $group_index END ${re.prog[state.pc].group_rep}") + // println("GROUP ${group_index} END ${re.prog[state.pc].group_rep}") if re.prog[state.pc].group_rep > in_txt_len - 1 { m_state = .ist_quant_ng continue @@ -2207,10 +2207,10 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { else if ist == ist_or_branch { if state.match_index >= 0 { state.pc = re.prog[state.pc].rep_max - // println("ist_or_branch True pc: $state.pc") + // println("ist_or_branch True pc: ${state.pc}") } else { state.pc = re.prog[state.pc].rep_min - // println("ist_or_branch False pc: $state.pc") + // println("ist_or_branch False pc: ${state.pc}") } re.prog[state.pc].reset() m_state = .ist_load @@ -2242,7 +2242,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { if re.prog[chk_pc].ch == ch_t { next_check_flag = true } - // println("Check [ist_simple_char] [${re.prog[chk_pc].ch}]==[${ch_t:c}] => $next_check_flag") + // println("Check [ist_simple_char] [${re.prog[chk_pc].ch}]==[${ch_t:c}] => ${next_check_flag}") } // char char_class else if re.prog[chk_pc].ist == ist_char_class_pos @@ -2257,12 +2257,12 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { cc_res = !cc_res } next_check_flag = cc_res - // println("Check [ist_char_class] => $next_check_flag") + // println("Check [ist_char_class] => ${next_check_flag}") } // check bsls else if re.prog[chk_pc].ist == ist_bsls_char { next_check_flag = re.prog[chk_pc].validator(u8(ch_t)) - // println("Check [ist_bsls_char] => $next_check_flag") + // println("Check [ist_bsls_char] => ${next_check_flag}") } } @@ -2328,7 +2328,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { if re.prog[chk_pc].ch == ch_t { next_check_flag = true } - // println("Check [ist_simple_char] [${re.prog[chk_pc].ch}]==[${ch_t:c}] => $next_check_flag") + // println("Check [ist_simple_char] [${re.prog[chk_pc].ch}]==[${ch_t:c}] => ${next_check_flag}") } // char char_class else if re.prog[chk_pc].ist == ist_char_class_pos @@ -2343,12 +2343,12 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { cc_res = !cc_res } next_check_flag = cc_res - // println("Check [ist_char_class] => $next_check_flag") + // println("Check [ist_char_class] => ${next_check_flag}") } // check bsls else if re.prog[chk_pc].ist == ist_bsls_char { next_check_flag = re.prog[chk_pc].validator(u8(ch_t)) - // println("Check [ist_bsls_char] => $next_check_flag") + // println("Check [ist_bsls_char] => ${next_check_flag}") } } @@ -2441,7 +2441,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { if re.prog[chk_pc].ch == ch_t { next_check_flag = true } - // println("Check [ist_simple_char] [${re.prog[chk_pc].ch}]==[${ch_t:c}] => $next_check_flag") + // println("Check [ist_simple_char] [${re.prog[chk_pc].ch}]==[${ch_t:c}] => ${next_check_flag}") } // char char_class else if re.prog[chk_pc].ist == ist_char_class_pos @@ -2456,12 +2456,12 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { cc_res = !cc_res } next_check_flag = cc_res - // println("Check [ist_char_class] => $next_check_flag") + // println("Check [ist_char_class] => ${next_check_flag}") } // check bsls else if re.prog[chk_pc].ist == ist_bsls_char { next_check_flag = re.prog[chk_pc].validator(u8(ch_t)) - // println("Check [ist_bsls_char] => $next_check_flag") + // println("Check [ist_bsls_char] => ${next_check_flag}") } } @@ -2535,7 +2535,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { continue } // UNREACHABLE - // println("PANIC2!! state: $m_state") + // println("PANIC2!! state: ${m_state}") return err_internal_error, state.i } /*********************************** @@ -2555,10 +2555,10 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { rep := re.prog[tmp_pc].group_rep // use a temp variable re.prog[tmp_pc].group_rep = 0 // clear the repetitions - // println(".ist_quant_ng group_pc_end: $tmp_pc rep: $rep") + // println(".ist_quant_ng group_pc_end: ${tmp_pc} rep: ${rep}") if rep >= re.prog[tmp_pc].rep_min { - // println("ist_quant_ng GROUP CLOSED OK group_index: $state.group_index") + // println("ist_quant_ng GROUP CLOSED OK group_index: ${state.group_index}") state.i = re.group_stack[state.group_index] state.pc = tmp_pc @@ -2574,7 +2574,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { m_state = .ist_next continue } else if rep > 0 && rep < re.prog[tmp_pc].rep_min { - // println("ist_quant_ng UNDER THE MINIMUM g.i: $state.group_index") + // println("ist_quant_ng UNDER THE MINIMUM g.i: ${state.group_index}") // check if we are inside a group, if yes exit from the nested groups if state.group_index > 0 { @@ -2595,7 +2595,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { m_state = .stop continue } else if rep == 0 && rep < re.prog[tmp_pc].rep_min { - // println("ist_quant_ng c_zero UNDER THE MINIMUM g.i: $state.group_index") + // println("ist_quant_ng c_zero UNDER THE MINIMUM g.i: ${state.group_index}") if state.group_index > 0 { state.group_index-- @@ -2609,7 +2609,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { continue } - // println("DO NOT STAY HERE!! {${re.prog[tmp_pc].rep_min},${re.prog[tmp_pc].rep_max}}:$rep") + // println("DO NOT STAY HERE!! {${re.prog[tmp_pc].rep_min},${re.prog[tmp_pc].rep_max}}:${rep}") // UNREACHABLE return err_internal_error, state.i } @@ -2643,7 +2643,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { continue } else if rep >= re.prog[tmp_pc].rep_min { - // println("ist_quant_pg IN RANGE group_index:$state.group_index") + // println("ist_quant_pg IN RANGE group_index:${state.group_index}") // check greedy flag, if true exit on minimum if re.prog[tmp_pc].greedy == true { @@ -2660,13 +2660,13 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { } // UNREACHABLE - // println("PANIC3!! state: $m_state") + // println("PANIC3!! state: ${m_state}") return err_internal_error, state.i } // ist_quant_n => quantifier negative test on token else if m_state == .ist_quant_n { rep := re.prog[state.pc].rep - // println("Here!! PC $state.pc is_next_or: ${re.prog[state.pc].next_is_or}") + // println("Here!! PC ${state.pc} is_next_or: ${re.prog[state.pc].next_is_or}") // zero quantifier * or ? if rep == 0 && re.prog[state.pc].rep_min == 0 { @@ -2691,7 +2691,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { // we are in a group manage no match from here if state.group_index >= 0 { - // println("ist_quant_n FAILED insied a GROUP group_index:$state.group_index") + // println("ist_quant_n FAILED insied a GROUP group_index:${state.group_index}") m_state = .ist_quant_ng continue } @@ -2747,7 +2747,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { } } // UNREACHABLE - // println("PANIC4!! state: $m_state") + // println("PANIC4!! state: ${m_state}") return err_internal_error, state.i } @@ -2767,11 +2767,11 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { } } - // println("No Group here, natural end [$state.first_match,$state.i] state: ${state_str(m_state)} ist: $ist pgr_end: $re.prog.len") + // println("No Group here, natural end [${state.first_match},${state.i}] state: ${state_str(m_state)} ist: ${ist} pgr_end: ${re.prog.len}") if re.prog[state.pc + 1].ist == ist_prog_end || re.prog[state.pc].ist == ist_prog_end { rep := re.prog[state.pc].rep - // println("rep: $rep re.prog[state.pc].rep_min: ${re.prog[state.pc].rep_min} re.prog[state.pc].rep_max: ${re.prog[state.pc].rep_max}") + // println("rep: ${rep} re.prog[state.pc].rep_min: ${re.prog[state.pc].rep_min} re.prog[state.pc].rep_max: ${re.prog[state.pc].rep_max}") if rep >= re.prog[state.pc].rep_min && rep <= re.prog[state.pc].rep_max { return state.first_match, state.i } @@ -2786,7 +2786,7 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) { return no_match_found, state.i } else { // println("Group match! OK") - // println("first_match: $state.first_match, i: $state.i") + // println("first_match: ${state.first_match}, i: ${state.i}") // println("Skip last group") return state.first_match, state.i diff --git a/vlib/regex/regex_test.v b/vlib/regex/regex_test.v index 0227c50ef..66865ab71 100644 --- a/vlib/regex/regex_test.v +++ b/vlib/regex/regex_test.v @@ -645,7 +645,7 @@ fn test_regex() { continue } // q_str := re.get_query() - // eprintln("Query: $q_str") + // eprintln("Query: ${q_str}") start, end := re.find(to.src) if start != to.s || end != to.e { @@ -654,7 +654,7 @@ fn test_regex() { assert false } else { // tmp_str := text[start..end] - // println("found in [$start, $end] => [$tmp_str]") + // println("found in [${start}, ${end}] => [${tmp_str}]") assert true } continue @@ -669,7 +669,7 @@ fn test_regex() { assert false continue } - // println("#$c [$to.src] q[$to.q]") + // println("#${c} [${to.src}] q[${to.q}]") start, end := re.match_string(to.src) mut tmp_str := '' @@ -904,7 +904,7 @@ fn test_long_query() { // test 1 mut re := regex.regex_opt(query) or { panic(err) } mut start, mut end := re.match_string(base_string) - // println("$start, $end") + // println("${start}, ${end}") assert start >= 0 && end == base_string.len // test 2 @@ -919,7 +919,7 @@ fn test_long_query() { query = buf.str() re = regex.regex_opt(query) or { panic(err) } start, end = re.match_string(base_string) - // println("$start, $end") + // println("${start}, ${end}") assert start >= 0 && end == base_string.len } diff --git a/vlib/regex/regex_util.v b/vlib/regex/regex_util.v index ddefb5730..8cf628650 100644 --- a/vlib/regex/regex_util.v +++ b/vlib/regex/regex_util.v @@ -166,7 +166,7 @@ fn (mut re RE) find_imp(in_txt string) (int,int) { re.flag |= f_src // enable search mode start, mut end := re.match_base(in_txt.str, in_txt.len + 1) - //print("Find [$start,$end] '${in_txt[start..end]}'") + //print("Find [${start},${end}] '${in_txt[start..end]}'") if end > in_txt.len { end = in_txt.len } @@ -191,7 +191,7 @@ pub fn (mut re RE) find(in_txt string) (int, int) { mut e := -1 unsafe { // tmp_str := tos(in_txt.str + i, in_txt.len - i) - // println("Check: [$tmp_str]") + // println("Check: [${tmp_str}]") s, e = re.match_base(in_txt.str + i, in_txt.len - i + 1) if s >= 0 && e > s { @@ -281,7 +281,7 @@ pub fn (mut re RE) find_all(in_txt string) []int { unsafe { // tmp_str := in_txt[i..] // tmp_str := tos(in_txt.str + i, in_txt.len - i) - // println("Check: [$tmp_str]") + // println("Check: [${tmp_str}]") s, e = re.match_base(in_txt.str + i, in_txt.len + 1 - i) if s >= 0 && e > s { @@ -345,13 +345,13 @@ pub fn (mut re RE) find_all_str(in_txt string) []string { unsafe { // tmp_str := in_txt[i..] // tmp_str := tos(in_txt.str + i, in_txt.len - i) - // println("Check: [$tmp_str]") + // println("Check: [${tmp_str}]") s, e = re.match_base(in_txt.str + i, in_txt.len + 1 - i) if s >= 0 && e > s { tmp_str := tos(in_txt.str + i, in_txt.len - i) mut tmp_e := if e > tmp_str.len { tmp_str.len } else { e } - // println("Found: $s:$e [${tmp_str[s..e]}]") + // println("Found: ${s}:${e} [${tmp_str[s..e]}]") res << tmp_str[..tmp_e] i += e continue @@ -412,7 +412,7 @@ pub fn (mut re RE) replace_by_fn(in_txt string, repl_fn FnReplace) string { mut last_end := 0 for i < in_txt.len { - // println("Find Start. $i [${in_txt[i..]}]") + // println("Find Start. ${i} [${in_txt[i..]}]") s, e := re.find_from(in_txt, i) // println("Find End.") if s >= 0 && e > s { @@ -428,7 +428,7 @@ pub fn (mut re RE) replace_by_fn(in_txt string, repl_fn FnReplace) string { } */ repl := repl_fn(re, in_txt, s, e) - // println("repl res: $repl") + // println("repl res: ${repl}") res.write_string(repl) // res.write_string("[[${in_txt[s..e]}]]") @@ -456,7 +456,7 @@ fn (re &RE) parsed_replace_string(in_txt string, repl string) string { if tmp.len > 0 && tmp[0] >= `0` && tmp[0] <= `9` { group_id := int(tmp[0] - `0`) group := re.get_group_by_id(in_txt, group_id) - // println("group: $group_id [$group]") + // println("group: ${group_id} [${group}]") res += '${group}${tmp[1..]}' } else { res += '\\' + tmp @@ -474,7 +474,7 @@ pub fn (mut re RE) replace(in_txt string, repl_str string) string { mut last_end := 0 for i < in_txt.len { - // println("Find Start. $i [${in_txt[i..]}]") + // println("Find Start. ${i} [${in_txt[i..]}]") s, e := re.find_from(in_txt, i) // println("Find End.") if s >= 0 && e > s { @@ -491,7 +491,7 @@ pub fn (mut re RE) replace(in_txt string, repl_str string) string { */ // repl := repl_fn(re, in_txt, s, e) repl := re.parsed_replace_string(in_txt, repl_str) - // println("repl res: $repl") + // println("repl res: ${repl}") res.write_string(repl) // res.write_string("[[${in_txt[s..e]}]]") diff --git a/vlib/stbi/stbi.c.v b/vlib/stbi/stbi.c.v index 7e7d66321..6df7cf4a8 100644 --- a/vlib/stbi/stbi.c.v +++ b/vlib/stbi/stbi.c.v @@ -246,7 +246,7 @@ pub fn stbi_write_jpg(path string, w int, h int, comp int, buf &u8, quality int) /* pub fn stbi_write_hdr(path string, w int, h int, comp int, buf &u8) ! { if 0 == C.stbi_write_hdr(&char(path.str), w , h , comp , buf){ - return error('stbi_image failed to write hdr file to "$path"') + return error('stbi_image failed to write hdr file to "${path}"') } } */ diff --git a/vlib/strconv/atof.c.v b/vlib/strconv/atof.c.v index eb75d2296..36689d9cb 100644 --- a/vlib/strconv/atof.c.v +++ b/vlib/strconv/atof.c.v @@ -146,7 +146,7 @@ fn parser(s string) (ParserState, PrepNumber) { // read mantissa for i < s.len && s[i].is_digit() { - // println("$i => ${s[i]}") + // println("${i} => ${s[i]}") if digx < digits { pn.mantissa *= 10 pn.mantissa += u64(s[i] - c_zero) diff --git a/vlib/strconv/atof_test.c.v b/vlib/strconv/atof_test.c.v index 877da75ab..6d4dab2c7 100644 --- a/vlib/strconv/atof_test.c.v +++ b/vlib/strconv/atof_test.c.v @@ -49,13 +49,13 @@ fn test_atof() { mut s1 := (strconv.atof_quick(src_num_str[c]).str()) mut s2 := (x.str()) delta := s1.f64() - s2.f64() - // println("$s1 $s2 $delta") + // println("${s1} ${s2} ${delta}") assert delta < f64(1e-16) // test C.atof n1 := x.strsci(18) n2 := f64(C.atof(&char(src_num_str[c].str))).strsci(18) - // println("$n1 $n2") + // println("${n1} ${n2}") assert n1 == n2 } diff --git a/vlib/strconv/atoi.v b/vlib/strconv/atoi.v index 50b66ca91..fbcc3ea14 100644 --- a/vlib/strconv/atoi.v +++ b/vlib/strconv/atoi.v @@ -131,14 +131,14 @@ pub fn common_parse_uint2(s string, _base int, _bit_size int) (u64, int) { // check if we are in the cutoff zone if n >= cutoff { // n*base overflows - // return error('parse_uint: range error $s') + // return error('parse_uint: range error ${s}') return max_val, -3 } n *= u64(base) n1 := n + u64(c) if n1 < n || n1 > max_val { // n+v overflows - // return error('parse_uint: range error $s') + // return error('parse_uint: range error ${s}') return max_val, -3 } n = n1 @@ -156,7 +156,7 @@ pub fn parse_uint(s string, _base int, _bit_size int) !u64 { @[direct_array_access] pub fn common_parse_int(_s string, base int, _bit_size int, error_on_non_digit bool, error_on_high_digit bool) !i64 { if _s == '' { - // return error('parse_int: syntax error $s') + // return error('parse_int: syntax error ${s}') return i64(0) } mut bit_size := _bit_size @@ -190,11 +190,11 @@ pub fn common_parse_int(_s string, base int, _bit_size int, error_on_non_digit b // TODO: check should u64(bit_size-1) be size of int (32)? cutoff := u64(1) << u64(bit_size - 1) if !neg && un >= cutoff { - // return error('parse_int: range error $s0') + // return error('parse_int: range error ${s0}') return i64(cutoff - u64(1)) } if neg && un > cutoff { - // return error('parse_int: range error $s0') + // return error('parse_int: range error ${s0}') return -i64(cutoff) } return if neg { -i64(un) } else { i64(un) } diff --git a/vlib/strconv/f32_f64_to_string_test.v b/vlib/strconv/f32_f64_to_string_test.v index d1ed8c6bc..fa0864dce 100644 --- a/vlib/strconv/f32_f64_to_string_test.v +++ b/vlib/strconv/f32_f64_to_string_test.v @@ -141,7 +141,7 @@ fn test_float_to_str() { // println(x) s := strconv.f32_to_str(x, 8) s1 := exp_result_f32[c] - // println("$s1 $s") + // println("${s1} ${s}") assert s == s1 } @@ -149,7 +149,7 @@ fn test_float_to_str() { for c, x in test_cases_f64 { s := strconv.f64_to_str(x, 17) s1 := exp_result_f64[c] - // println("$s1 $s") + // println("${s1} ${s}") assert s == s1 } diff --git a/vlib/strconv/f64_str.c.v b/vlib/strconv/f64_str.c.v index 5d0329ce1..ede990b1e 100644 --- a/vlib/strconv/f64_str.c.v +++ b/vlib/strconv/f64_str.c.v @@ -50,10 +50,10 @@ fn (d Dec64) get_string_64(neg bool, i_n_digit int, i_pad_digit int) string { // rounding last used digit if n_digit < out_len { - // println("out:[$out]") + // println("out:[${out}]") out += ten_pow_table_64[out_len - n_digit - 1] * 5 // round to up out /= ten_pow_table_64[out_len - n_digit] - // println("out1:[$out] ${d.m / ten_pow_table_64[out_len - n_digit ]}") + // println("out1:[${out}] ${d.m / ten_pow_table_64[out_len - n_digit ]}") // fix issue #22424 out_div := d.m / ten_pow_table_64[out_len - n_digit] if out_div < out && dec_digits(out_div) < dec_digits(out) { @@ -65,7 +65,7 @@ fn (d Dec64) get_string_64(neg bool, i_n_digit int, i_pad_digit int) string { // println("cmp: ${d.m/ten_pow_table_64[out_len - n_digit ]} ${out/ten_pow_table_64[out_len - n_digit ]}") out_len = n_digit - // println("orig: ${out_len_original} new len: ${out_len} out:[$out]") + // println("orig: ${out_len_original} new len: ${out_len} out:[${out}]") } y := i + out_len diff --git a/vlib/strconv/f64_str.js.v b/vlib/strconv/f64_str.js.v index 199f3de13..47daaaf32 100644 --- a/vlib/strconv/f64_str.js.v +++ b/vlib/strconv/f64_str.js.v @@ -31,10 +31,10 @@ fn (d Dec64) get_string_64(neg bool, i_n_digit int, i_pad_digit int) string { // rounding last used digit if n_digit < out_len { - // println("out:[$out]") + // println("out:[${out}]") out += ten_pow_table_64[out_len - n_digit - 1] * 5 // round to up out /= ten_pow_table_64[out_len - n_digit] - // println("out1:[$out] ${d.m / ten_pow_table_64[out_len - n_digit ]}") + // println("out1:[${out}] ${d.m / ten_pow_table_64[out_len - n_digit ]}") if d.m / ten_pow_table_64[out_len - n_digit] < out { d_exp++ n_digit++ @@ -43,7 +43,7 @@ fn (d Dec64) get_string_64(neg bool, i_n_digit int, i_pad_digit int) string { // println("cmp: ${d.m/ten_pow_table_64[out_len - n_digit ]} ${out/ten_pow_table_64[out_len - n_digit ]}") out_len = n_digit - // println("orig: ${out_len_original} new len: ${out_len} out:[$out]") + // println("orig: ${out_len_original} new len: ${out_len} out:[${out}]") } y := i + out_len diff --git a/vlib/strconv/format_mem.c.v b/vlib/strconv/format_mem.c.v index e079c609a..b8037713f 100644 --- a/vlib/strconv/format_mem.c.v +++ b/vlib/strconv/format_mem.c.v @@ -247,7 +247,7 @@ pub fn f64_to_str_lnd1(f f64, dec_digit int) string { r_i++ exp-- } - // println("exp: $exp $r_i $dot_res_sp") + // println("exp: ${exp} ${r_i} ${dot_res_sp}") } else { mut dot_p := true for exp > 0 { diff --git a/vlib/strconv/format_test.v b/vlib/strconv/format_test.v index 69705afdf..59b9debea 100644 --- a/vlib/strconv/format_test.v +++ b/vlib/strconv/format_test.v @@ -17,7 +17,7 @@ fn test_format() { temp_s = unsafe { strconv.v_sprintf(sc0, a0, b0, c0, s0, b0, f0, f1, ch0) } tmp_str = 'ciao: [10 ] 200 12 [ ciAo] [000000C8] [0.3123 ] [200000.0000 ] [B]' // C.printf(sc0.str,a0 ,b0 ,c0 ,s0.str ,b0 ,f0, f1, ch0) - // println("\n$temp_s") + // println("\n${temp_s}") assert tmp_str == temp_s a := u8(12) @@ -28,7 +28,7 @@ fn test_format() { temp_s = unsafe { strconv.v_sprintf(sc1, a, b, c, d) } tmp_str = '==>12 13 14 15' // C.printf(sc1.str, a ,b ,c, d) - // println("\n$temp_s") + // println("\n${temp_s}") assert tmp_str == temp_s a1 := u8(0xff) @@ -39,28 +39,28 @@ fn test_format() { temp_s = unsafe { strconv.v_sprintf(sc2, a1, b1, c1, d1) } tmp_str = '255 65535 4294967295 18446744073709551615' // C.printf(sc2.str, a1 ,b1 ,c1, d1) - // println("\n$temp_s") + // println("\n${temp_s}") assert tmp_str == temp_s sc3 := '%hhx %hx %x %lx' temp_s = unsafe { strconv.v_sprintf(sc3, a1, b1, c1, d1) } tmp_str = 'ff ffff ffffffff ffffffffffffffff' // C.printf(sc3.str, a1 ,b1 ,c1, d1) - // println("\n$temp_s") + // println("\n${temp_s}") assert tmp_str == temp_s sc4 := '[%-20.3e] [%20.3e] [%-020.3e] [%-020.3E] [%-020.3e] [%-020.3e]' temp_s = unsafe { strconv.v_sprintf(sc4, f0, f1, f1, f1, f2, f3) } tmp_str = '[3.123e-01 ] [ 2.000e+05] [2.000e+05 ] [2.000E+05 ] [-1.234e+09 ] [1.234e-03 ]' // C.printf(sc4.str, f0, f1, f1, f1, f2, f3) - // println("\n$temp_s") + // println("\n${temp_s}") assert tmp_str == temp_s sc5 := '[%.3f] [%0.3f] [%0.3F] [%0.3f] [%0.3F]' temp_s = unsafe { strconv.v_sprintf(sc5, f0, f1, f1, f2, f3) } tmp_str = '[0.312] [200000.000] [200000.000] [-1234300000.000] [0.001]' // C.printf(sc5.str, f0, f1, f1, f2, f3, f3) - // println("\n$temp_s") + // println("\n${temp_s}") assert tmp_str == temp_s ml := 3 @@ -68,7 +68,7 @@ fn test_format() { temp_s = unsafe { strconv.v_sprintf(sc6, ml, s0, a) } tmp_str = 'ciA [0000C]' // C.printf(sc6.str, ml, s0.str, a) - // println("\n$temp_s") + // println("\n${temp_s}") assert tmp_str == temp_s a2 := 125 @@ -76,7 +76,7 @@ fn test_format() { temp_s = unsafe { strconv.v_sprintf(sc7, a2, a2, a2, a2, a2, a2) } tmp_str = '[ 7d] [ 7D] [7d ] [7D ] [00000007d] [00000007D]' // C.printf(sc7.str, a2, a2, a2, a2, a2, a2) - // println("\n$temp_s") + // println("\n${temp_s}") assert tmp_str == temp_s g_test := [ @@ -101,7 +101,7 @@ fn test_format() { for x < 12 { temp_s = unsafe { strconv.v_sprintf(sc8, ft, ft) } // C.printf(sc8.str, ft, ft) - // println("\n$temp_s") + // println("\n${temp_s}") assert temp_s == g_test[cnt] ft = ft * 10.0 x++ diff --git a/vlib/strconv/vprintf.c.v b/vlib/strconv/vprintf.c.v index b21842fe2..a986f2598 100644 --- a/vlib/strconv/vprintf.c.v +++ b/vlib/strconv/vprintf.c.v @@ -246,7 +246,7 @@ pub fn v_sprintf(str string, pt ...voidptr) string { mut d1 := u64(0) mut positive := true - // println("$ch1 $ch2") + // println("${ch1} ${ch2}") match ch1 { // h for 16 bit int // hh for 8 bit int @@ -482,7 +482,7 @@ pub fn v_sprintf(str string, pt ...voidptr) string { mut s := '' tx := fabs(x) if tx < 999_999.0 && tx >= 0.00001 { - // println("Here g format_fl [$tx]") + // println("Here g format_fl [${tx}]") len1 = if len1 >= 0 { len1 + 1 } else { def_len1 } tmp := s s = format_fl_old(x, diff --git a/vlib/term/ui/input_windows.c.v b/vlib/term/ui/input_windows.c.v index 074287536..d43b148d2 100644 --- a/vlib/term/ui/input_windows.c.v +++ b/vlib/term/ui/input_windows.c.v @@ -135,7 +135,7 @@ fn (mut ctx Context) parse_events() { return } - // print('$nr_events | ') + // print('${nr_events} | ') if !C.ReadConsoleInput(ctx.stdin_handle, &ctx.read_buf[0], buf_size, &nr_events) { panic('could not read from stdin') } diff --git a/vlib/term/ui/termios_nix.c.v b/vlib/term/ui/termios_nix.c.v index 6f6f65545..6ef91ea43 100644 --- a/vlib/term/ui/termios_nix.c.v +++ b/vlib/term/ui/termios_nix.c.v @@ -224,7 +224,7 @@ fn (mut ctx Context) termios_loop() { ctx.init() init_called = true } - // println('SLEEPING: $sleep_len') + // println('SLEEPING: ${sleep_len}') if sleep_len > 0 { time.sleep(sleep_len * time.microsecond) } diff --git a/vlib/time/parse.c.v b/vlib/time/parse.c.v index 175f49041..e802a7ac9 100644 --- a/vlib/time/parse.c.v +++ b/vlib/time/parse.c.v @@ -323,7 +323,7 @@ pub fn parse(s string) !Time { return error_invalid_time(0, 'invalid second format: ${second_}') } - // eprintln('>> iyear: $iyear | imonth: $imonth | iday: $iday | ihour: $ihour | iminute: $iminute | isecond: $isecond') + // eprintln('>> iyear: ${iyear} | imonth: ${imonth} | iday: ${iday} | ihour: ${ihour} | iminute: ${iminute} | isecond: ${isecond}') if iyear > 9999 || iyear < -9999 { return error_invalid_time(3, 'year must be between -10000 and 10000') } @@ -533,6 +533,6 @@ fn parse_iso8601_time(s string) !(int, int, int, int, int, i64, bool) { if plus_min_z == `+` { unix_offset *= -1 } - // eprintln('parse_iso8601_time s: $s | hour_: $hour_ | minute_: $minute_ | second_: $second_ | microsecond_: $microsecond_ | nanosecond_: $nanosecond_ | unix_offset: $unix_offset | is_local: $is_local_time') + // eprintln('parse_iso8601_time s: ${s} | hour_: ${hour_} | minute_: ${minute_} | second_: ${second_} | microsecond_: ${microsecond_} | nanosecond_: ${nanosecond_} | unix_offset: ${unix_offset} | is_local: ${is_local_time}') return hour_, minute_, second_, microsecond_, nanosecond_, unix_offset, is_local_time } diff --git a/vlib/toml/checker/checker.v b/vlib/toml/checker/checker.v index c95bb4481..6a26a777e 100644 --- a/vlib/toml/checker/checker.v +++ b/vlib/toml/checker/checker.v @@ -617,7 +617,7 @@ fn (c &Checker) check_unicode_escape(esc_unicode string) ! { sequence = sequence[..hex_digits_len] // TODO: not enforced in BurnSushi testsuite?? // if !sequence.is_upper() { - // return error('Unicode escape sequence `$esc_unicode` is not in all uppercase.') + // return error('Unicode escape sequence `${esc_unicode}` is not in all uppercase.') //} validate_utf8_codepoint_string(sequence.to_upper())! if is_long_esc_type { diff --git a/vlib/toml/parser/parser.v b/vlib/toml/parser/parser.v index fade39351..3e643ab32 100644 --- a/vlib/toml/parser/parser.v +++ b/vlib/toml/parser/parser.v @@ -810,7 +810,7 @@ pub fn (mut p Parser) inline_table(mut tbl map[string]ast.Value) ! { .whitespace, .tab { /* if !p.scanner.config.tokenize_formatting { - util.printdbg(@MOD + '.' + @STRUCT + '.' + @FN, 'skipping "$p.tok.kind" "$p.tok.lit"') + util.printdbg(@MOD + '.' + @STRUCT + '.' + @FN, 'skipping "${p.tok.kind}" "${p.tok.lit}"') continue }*/ util.printdbg(@MOD + '.' + @STRUCT + '.' + @FN, 'skipping formatting "${p.tok.kind}" "${p.tok.lit}"') @@ -1314,8 +1314,8 @@ pub fn (mut p Parser) key() !ast.Key { } // NOTE kept for eased debugging - // util.printdbg(@MOD +'.' + @STRUCT + '.' + @FN, 'parsed key "$p.tok.lit"') - // panic(@MOD + '.' + @STRUCT + '.' + @FN + ' could not parse ${p.tok.kind} ("${p.tok.lit}") token \n$p.tok') + // util.printdbg(@MOD +'.' + @STRUCT + '.' + @FN, 'parsed key "${p.tok.lit}"') + // panic(@MOD + '.' + @STRUCT + '.' + @FN + ' could not parse ${p.tok.kind} ("${p.tok.lit}") token \n${p.tok}') // return ast.Key(ast.Bare{}) if key is ast.Null { diff --git a/vlib/toml/scanner/scanner.v b/vlib/toml/scanner/scanner.v index 4e4750424..ac596f1c6 100644 --- a/vlib/toml/scanner/scanner.v +++ b/vlib/toml/scanner/scanner.v @@ -162,7 +162,7 @@ pub fn (mut s Scanner) scan() !token.Token { } // Date-Time in RFC 3339 is allowed to have a space between the date and time in supplement to the 'T' // so we allow space characters to slip through to the parser if the space is between two digits... - // util.printdbg(@MOD + '.' + @STRUCT + '.' + @FN, '"'+u8(s.peek(-1)).ascii_str()+'" < "$ascii" > "'+u8(s.at()).ascii_str()+'"') + // util.printdbg(@MOD + '.' + @STRUCT + '.' + @FN, '"'+u8(s.peek(-1)).ascii_str()+'" < "${ascii}" > "'+u8(s.at()).ascii_str()+'"') if c == ` ` && u8(s.peek(-1)).is_digit() && u8(s.at()).is_digit() { util.printdbg(@MOD + '.' + @STRUCT + '.' + @FN, 'identified, what could be, a space between a RFC 3339 date and time ("${ascii}") (${ascii.len})') return s.new_token(token.Kind.whitespace, ascii, ascii.len) @@ -341,7 +341,7 @@ pub fn (mut s Scanner) reset() { // new_token returns a new `token.Token`. @[inline] fn (mut s Scanner) new_token(kind token.Kind, lit string, len int) token.Token { - // println('new_token($lit)') + // println('new_token(${lit})') mut col := s.col - len + 1 if s.line_nr == 1 { col -= s.header_len diff --git a/vlib/toml/tests/iarna_toml_spec_test.v b/vlib/toml/tests/iarna_toml_spec_test.v index 460dc187f..05be5e929 100644 --- a/vlib/toml/tests/iarna_toml_spec_test.v +++ b/vlib/toml/tests/iarna_toml_spec_test.v @@ -179,7 +179,7 @@ fn test_iarna_toml_spec_tests() { // NOTE there's known errors with the python convention method. // For now we just ignore them as it's a broken tool - not a wrong test-case. // Uncomment this print to see/check them. - // eprintln(err.msg() + '\n$contents') + // eprintln(err.msg() + '\n${contents}') e++ println('ERR [${i + 1}/${valid_test_files.len}] "${valid_test_file}" EXCEPTION [${e}/${valid_value_exceptions.len}]...') continue diff --git a/vlib/toml/tests/toml_lang_test.v b/vlib/toml/tests/toml_lang_test.v index 3cd359d94..b17a85e57 100644 --- a/vlib/toml/tests/toml_lang_test.v +++ b/vlib/toml/tests/toml_lang_test.v @@ -142,7 +142,7 @@ fn test_toml_lang_tomltest() { println('OK [${i + 1}/${valid_test_files.len}] "${valid_test_file}"...') } toml_doc := toml.parse_file(valid_test_file)! - // eprintln(' relative: $relative parsed') + // eprintln(' relative: ${relative} parsed') v_toml_json_path := os.join_path(compare_work_dir_root, os.file_name(valid_test_file).all_before_last('.') + '.v.json') diff --git a/vlib/toml/toml.v b/vlib/toml/toml.v index 2233d4b7e..56fc1bfc0 100644 --- a/vlib/toml/toml.v +++ b/vlib/toml/toml.v @@ -538,6 +538,6 @@ pub fn ast_to_any(value ast.Value) Any { return null // TODO: decide this - // panic(@MOD + '.' + @STRUCT + '.' + @FN + ' can\'t convert "$value"') + // panic(@MOD + '.' + @STRUCT + '.' + @FN + ' can\'t convert "${value}"') // return Any('') } diff --git a/vlib/v/TEMPLATES.md b/vlib/v/TEMPLATES.md index 791a54510..c0ffffea5 100644 --- a/vlib/v/TEMPLATES.md +++ b/vlib/v/TEMPLATES.md @@ -76,14 +76,14 @@ where you can write text, rendered for each iteration of the loop: ```html @for i, val in my_vals { - $i - $val + ${i} - ${val} } ``` One-liner: ```html -@for i, val in my_vals { $i - $val } +@for i, val in my_vals { ${i} - ${val} } ``` The first example would result in: @@ -108,7 +108,7 @@ You can also write (and all other for condition syntaxes that are allowed in V): ```html @for i = 0; i < 5; i++ { - $i + ${i} } ``` diff --git a/vlib/v/ast/ast.v b/vlib/v/ast/ast.v index 56c277564..35fff8ffa 100644 --- a/vlib/v/ast/ast.v +++ b/vlib/v/ast/ast.v @@ -259,7 +259,7 @@ pub: pos token.Pos } -// 'name: $name' +// 'name: ${name}' pub struct StringInterLiteral { pub: vals []string @@ -727,7 +727,7 @@ pub mut: ctdefine_idx int // the index of the attribute, containing the compile time define [if mytag] from_embedded_type Type // for interface only, fn from the embedded interface // - is_expand_simple_interpolation bool // for tagging b.f(s string), which is then called with `b.f('some $x $y')`, + is_expand_simple_interpolation bool // for tagging b.f(s string), which is then called with `b.f('some ${x} ${y}')`, // when that call, should be expanded to `b.f('some '); b.f(x); b.f(' '); b.f(y);` // Note: the same type, has to support also a .write_decimal(n i64) method. } diff --git a/vlib/v/ast/scope.v b/vlib/v/ast/scope.v index e975046c7..82ebe7309 100644 --- a/vlib/v/ast/scope.v +++ b/vlib/v/ast/scope.v @@ -213,7 +213,7 @@ pub fn (s &Scope) innermost(pos int) &Scope { mut last := s.children.len - 1 mut middle := last / 2 for first <= last { - // println('FIRST: $first, LAST: $last, LEN: $s.children.len-1') + // println('FIRST: ${first}, LAST: ${last}, LEN: ${s.children.len-1}') s1 := s.children[middle] if s1.end_pos < pos { first = middle + 1 diff --git a/vlib/v/ast/str.v b/vlib/v/ast/str.v index a0511723d..4ffd9651c 100644 --- a/vlib/v/ast/str.v +++ b/vlib/v/ast/str.v @@ -345,49 +345,13 @@ fn shorten_full_name_based_on_aliases(input string, m2a map[string]string) strin return res } -// Expressions in string interpolations may have to be put in braces if they -// are non-trivial, if they would interfere with the next character or if a -// format specification is given. In the latter case -// the format specifier must be appended, separated by a colon: -// '$z $z.b $z.c.x ${x[4]} ${z:8.3f} ${a:-20} ${a>b+2}' // This method creates the format specifier (including the colon) or an empty -// string if none is needed and also returns (as bool) if the expression -// must be enclosed in braces. -pub fn (lit &StringInterLiteral) get_fspec_braces(i int) (string, bool) { +// string if none is needed. For example, '${z:8.3f} ${a:-20} ${a>b+2}' +pub fn (lit &StringInterLiteral) get_fspec(i int) string { mut res := []string{} needs_fspec := lit.need_fmts[i] || lit.pluss[i] || (lit.fills[i] && lit.fwidths[i] >= 0) || lit.fwidths[i] != 0 || lit.precisions[i] != 987698 - mut needs_braces := needs_fspec - sx := lit.exprs[i].str() - if sx.contains(r'"') || sx.contains(r"'") { - needs_braces = true - } - if !needs_braces { - if i + 1 < lit.vals.len && lit.vals[i + 1].len > 0 { - next_char := lit.vals[i + 1][0] - if util.is_func_char(next_char) || next_char == `.` || next_char == `(` { - needs_braces = true - } - } - } - if !needs_braces { - mut sub_expr := lit.exprs[i] - for { - match mut sub_expr { - Ident { - if sub_expr.name[0] == `@` { - needs_braces = true - } - break - } - else { - needs_braces = true - break - } - } - } - } if needs_fspec { res << ':' if lit.pluss[i] { @@ -406,7 +370,7 @@ pub fn (lit &StringInterLiteral) get_fspec_braces(i int) (string, bool) { res << '${lit.fmts[i]:c}' } } - return res.join(''), needs_braces + return res.join('') } __global nested_expr_str_calls = i64(0) @@ -639,15 +603,12 @@ pub fn (x Expr) str() string { break } res.write_string('$') - fspec_str, needs_braces := x.get_fspec_braces(i) - if needs_braces { - res.write_string('{') - res.write_string(x.exprs[i].str()) - res.write_string(fspec_str) - res.write_string('}') - } else { - res.write_string(x.exprs[i].str()) - } + fspec_str := x.get_fspec(i) + + res.write_string('{') + res.write_string(x.exprs[i].str()) + res.write_string(fspec_str) + res.write_string('}') } res.write_string("'") return res.str() diff --git a/vlib/v/builder/builder.v b/vlib/v/builder/builder.v index 3796a56b5..f4c9d3b72 100644 --- a/vlib/v/builder/builder.v +++ b/vlib/v/builder/builder.v @@ -236,7 +236,7 @@ pub fn (mut b Builder) parse_imports() { continue } import_path := b.find_module_path(mod, ast_file.path) or { - // v.parsers[i].error_with_token_index('cannot import module "$mod" (not found)', v.parsers[i].import_ast.get_import_tok_idx(mod)) + // v.parsers[i].error_with_token_index('cannot import module "${mod}" (not found)', v.parsers[i].import_ast.get_import_tok_idx(mod)) // break b.parsed_files[i].errors << b.error_with_pos('cannot import module "${mod}" (not found)', ast_file.path, imp.pos) @@ -244,12 +244,12 @@ pub fn (mut b Builder) parse_imports() { } v_files := b.v_files_from_dir(import_path) if v_files.len == 0 { - // v.parsers[i].error_with_token_index('cannot import module "$mod" (no .v files in "$import_path")', v.parsers[i].import_ast.get_import_tok_idx(mod)) + // v.parsers[i].error_with_token_index('cannot import module "${mod}" (no .v files in "${import_path}")', v.parsers[i].import_ast.get_import_tok_idx(mod)) b.parsed_files[i].errors << b.error_with_pos('cannot import module "${mod}" (no .v files in "${import_path}")', ast_file.path, imp.pos) continue } - // eprintln('>> ast_file.path: $ast_file.path , done: $done_imports, `import $mod` => $v_files') + // eprintln('>> ast_file.path: ${ast_file.path} , done: ${done_imports}, `import ${mod}` => ${v_files}') // Add all imports referenced by these libs parsed_files := parser.parse_files(v_files, mut b.table, b.pref) for file in parsed_files { @@ -330,7 +330,7 @@ pub fn (mut b Builder) resolve_deps() { for pf in b.parsed_files { if m == pf.mod.name { reordered_parsed_files << pf - // eprintln('pf.mod.name: $pf.mod.name | pf.path: $pf.path') + // eprintln('pf.mod.name: ${pf.mod.name} | pf.path: ${pf.path}') } } } @@ -344,7 +344,7 @@ pub fn (b &Builder) import_graph() &depgraph.DepGraph { builtins := util.builtin_module_parts.clone() mut graph := depgraph.new_dep_graph() for p in b.parsed_files { - // eprintln('p.path: $p.path') + // eprintln('p.path: ${p.path}') mut deps := []string{} if p.mod.name !in builtins { deps << 'builtin' diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index 5aa623f30..2d75e0896 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -850,7 +850,7 @@ pub fn (mut v Builder) cc() { } } // if v.pref.os == .ios { - // ret := os.system('ldid2 -S $v.pref.out_name') + // ret := os.system('ldid2 -S ${v.pref.out_name}') // if ret != 0 { // eprintln('failed to run ldid2, try: brew install ldid') // } @@ -1152,7 +1152,7 @@ fn (mut c Builder) cc_windows_cross() { all_args << c.pref.ldflags c.dump_c_options(all_args) mut cmd := cross_compiler_name_path + ' ' + all_args.join(' ') - // cmd := 'clang -o $obj_name -w $include -m32 -c -target x86_64-win32 ${pref.default_module_path}/$c.out_name_c' + // cmd := 'clang -o ${obj_name} -w ${include} -m32 -c -target x86_64-win32 ${pref.default_module_path}/${c.out_name_c}' if c.pref.is_verbose || c.pref.show_cc { println(cmd) } diff --git a/vlib/v/builder/msvc_windows.v b/vlib/v/builder/msvc_windows.v index b6ebf306e..d96f325d4 100644 --- a/vlib/v/builder/msvc_windows.v +++ b/vlib/v/builder/msvc_windows.v @@ -162,7 +162,7 @@ fn find_vs_by_reg(vswhere_dir string, host_arch string, target_arch string) !VsI // If its not there then end user needs to update their visual studio // installation! res := os.execute('"${vswhere_dir}\\Microsoft Visual Studio\\Installer\\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath') - // println('res: "$res"') + // println('res: "${res}"') if res.exit_code != 0 { return error_with_code(res.output, res.exit_code) } @@ -171,13 +171,13 @@ fn find_vs_by_reg(vswhere_dir string, host_arch string, target_arch string) !VsI // println('Unable to find msvc version') return error('Unable to find vs installation') } - // println('version: $version') + // println('version: ${version}') v := version.trim_space() lib_path := '${res_output}\\VC\\Tools\\MSVC\\${v}\\lib\\${target_arch}' include_path := '${res_output}\\VC\\Tools\\MSVC\\${v}\\include' if os.exists('${lib_path}\\vcruntime.lib') { p := '${res_output}\\VC\\Tools\\MSVC\\${v}\\bin\\Host${host_arch}\\${target_arch}' - // println('$lib_path $include_path') + // println('${lib_path} ${include_path}') return VsInstallation{ exe_path: p lib_path: lib_path @@ -318,7 +318,7 @@ pub fn (mut v Builder) cc_msvc() { eprintln('Sanitize not supported on msvc.') } // The C file we are compiling - // a << '"$TmpPath/$v.out_name_c"' + // a << '"$TmpPath/${v.out_name_c}"' a << '"' + os.real_path(v.out_name_c) + '"' if !v.ccoptions.debug_mode { v.pref.cleanup_files << os.real_path(v.out_name_c) @@ -426,7 +426,7 @@ fn (mut v Builder) build_thirdparty_obj_file_with_msvc(_mod string, path string, } obj_path = os.real_path(obj_path) if os.exists(obj_path) { - // println('$obj_path already built.') + // println('${obj_path} already built.') return } if trace_thirdparty_obj_files { @@ -530,7 +530,7 @@ pub fn (mut v Builder) msvc_string_flags(cflags []cflag.CFlag) MsvcStringFlags { mut defines := []string{} mut other_flags := []string{} for flag in cflags { - // println('fl: $flag.name | flag arg: $flag.value') + // println('fl: ${flag.name} | flag arg: ${flag.value}') // We need to see if the flag contains -l // -l isnt recognised and these libs will be passed straight to the linker // by the compiler diff --git a/vlib/v/builder/rebuilding.v b/vlib/v/builder/rebuilding.v index f90054d72..64d2ad08c 100644 --- a/vlib/v/builder/rebuilding.v +++ b/vlib/v/builder/rebuilding.v @@ -49,7 +49,7 @@ pub fn (mut b Builder) find_invalidated_modules_by_files(all_files []string) []s cpath := x[1] old_hashes[cpath] = chash } - // eprintln('old_hashes: $old_hashes') + // eprintln('old_hashes: ${old_hashes}') for cpath in all_files { ccontent := util.read_file(cpath) or { '' } chash := hash.sum64_string(ccontent, 7).hex_full() @@ -60,7 +60,7 @@ pub fn (mut b Builder) find_invalidated_modules_by_files(all_files []string) []s sb_new_hashes.write_u8(`\n`) } snew_hashes := sb_new_hashes.str() - // eprintln('new_hashes: $new_hashes') + // eprintln('new_hashes: ${new_hashes}') // eprintln('> new_hashes != old_hashes: ' + ( old_hashes != new_hashes ).str()) // eprintln(snew_hashes) cm.save('.hashes', 'all_files', snew_hashes) or {} @@ -69,9 +69,9 @@ pub fn (mut b Builder) find_invalidated_modules_by_files(all_files []string) []s mut invalidations := []string{} if new_hashes != old_hashes { util.timing_start('${@METHOD} rebuilding') - // eprintln('> b.mod_invalidates_paths: $b.mod_invalidates_paths') - // eprintln('> b.mod_invalidates_mods: $b.mod_invalidates_mods') - // eprintln('> b.path_invalidates_mods: $b.path_invalidates_mods') + // eprintln('> b.mod_invalidates_paths: ${b.mod_invalidates_paths}') + // eprintln('> b.mod_invalidates_mods: ${b.mod_invalidates_mods}') + // eprintln('> b.path_invalidates_mods: ${b.path_invalidates_mods}') $if trace_invalidations ? { for k, v in b.mod_invalidates_paths { mut m := map[string]bool{} diff --git a/vlib/v/checker/check_types.v b/vlib/v/checker/check_types.v index 61ff40552..20f822b7a 100644 --- a/vlib/v/checker/check_types.v +++ b/vlib/v/checker/check_types.v @@ -614,7 +614,7 @@ fn (mut c Checker) check_shift(mut node ast.InfixExpr, left_type_ ast.Type, righ } } // if node.ct_left_value_evaled && node.ct_right_value_evaled { - // c.note('>>> node.ct_left_value: $node.ct_left_value | node.ct_right_value: $node.ct_right_value', node.pos) + // c.note('>>> node.ct_left_value: ${node.ct_left_value} | node.ct_right_value: ${node.ct_right_value}', node.pos) // } match node.op { .left_shift, .right_shift, .unsigned_right_shift { @@ -703,7 +703,7 @@ fn (mut c Checker) check_shift(mut node ast.InfixExpr, left_type_ ast.Type, righ } } } else { - // c.note('can not evaluate "$node.right" at comptime, err: $err', node.pos) + // c.note('can not evaluate "${node.right}" at comptime, err: ${err}', node.pos) return left_type } } diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index adef2c2f8..32b034573 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -365,7 +365,7 @@ pub fn (mut c Checker) check_scope_vars(sc &ast.Scope) { } // if obj.is_mut && !obj.is_changed && !c.is_builtin_mod && obj.name != 'it' { // if obj.is_mut && !obj.is_changed && !c.is_builtin { //TODO C error bad field not checked - // c.warn('`$obj.name` is declared as mutable, but it was never changed', + // c.warn('`${obj.name}` is declared as mutable, but it was never changed', // obj.pos) // } } @@ -945,7 +945,7 @@ fn (mut c Checker) sumtype_has_circular_ref(sum_typ ast.Type, target_typ ast.Typ } fn (mut c Checker) expand_iface_embeds(idecl &ast.InterfaceDecl, level int, iface_embeds []ast.InterfaceEmbedding) []ast.InterfaceEmbedding { - // eprintln('> expand_iface_embeds: idecl.name: $idecl.name | level: $level | iface_embeds.len: $iface_embeds.len') + // eprintln('> expand_iface_embeds: idecl.name: ${idecl.name} | level: ${level} | iface_embeds.len: ${iface_embeds.len}') if level > iface_level_cutoff_limit { c.error('too many interface embedding levels: ${level}, for interface `${idecl.name}`', idecl.pos) @@ -3683,7 +3683,7 @@ pub fn (mut c Checker) expr(mut node ast.Expr) ast.Type { // return c.table.bitsize_to_type(bit_size) // } // } -// c.error('invalid register name: `$name`', node.pos) +// c.error('invalid register name: `${name}`', node.pos) // return ast.void_type // } diff --git a/vlib/v/checker/comptime.v b/vlib/v/checker/comptime.v index fef603098..8ebbda05c 100644 --- a/vlib/v/checker/comptime.v +++ b/vlib/v/checker/comptime.v @@ -720,10 +720,10 @@ fn (mut c Checker) eval_comptime_const_expr(expr ast.Expr, nlevel int) ?ast.Comp } // ast.ArrayInit {} // ast.PrefixExpr { - // c.note('prefixexpr: $expr', expr.pos) + // c.note('prefixexpr: ${expr}', expr.pos) // } else { - // eprintln('>>> nlevel: $nlevel | another $expr.type_name() | $expr ') + // eprintln('>>> nlevel: ${nlevel} | another ${expr.type_name()} | ${expr} ') return none } } diff --git a/vlib/v/checker/errors.v b/vlib/v/checker/errors.v index 6e06dd227..b7e2d3013 100644 --- a/vlib/v/checker/errors.v +++ b/vlib/v/checker/errors.v @@ -205,7 +205,7 @@ fn (mut c Checker) trace[T](fbase string, x &T) { } fn (mut c Checker) deprecate(kind string, name string, attrs []ast.Attr, pos token.Pos) { - // println('deprecate kind=${kind} name=${name} attrs=$attrs') + // println('deprecate kind=${kind} name=${name} attrs=${attrs}') // print_backtrace() mut deprecation_message := '' now := time.now() diff --git a/vlib/v/checker/fn.v b/vlib/v/checker/fn.v index 9334e5ba1..3d25cdd2b 100644 --- a/vlib/v/checker/fn.v +++ b/vlib/v/checker/fn.v @@ -912,7 +912,7 @@ fn (mut c Checker) builtin_args(mut node ast.CallExpr, fn_name string, func &ast prtyp_sym := c.table.sym(prtyp) prtyp_is_ptr := prtyp.is_ptr() prhas_str, prexpects_ptr, prnr_args := prtyp_sym.str_method_info() - eprintln('>>> println hack typ: ${prtyp} | sym.name: ${prtyp_sym.name} | is_ptr: $prtyp_is_ptr | has_str: $prhas_str | expects_ptr: $prexpects_ptr | nr_args: $prnr_args | expr: ${prexpr.str()} ') + eprintln('>>> println hack typ: ${prtyp} | sym.name: ${prtyp_sym.name} | is_ptr: ${prtyp_is_ptr} | has_str: ${prhas_str} | expects_ptr: ${prexpects_ptr} | nr_args: ${prnr_args} | expr: ${prexpr.str()} ') */ } @@ -2503,7 +2503,7 @@ fn (mut c Checker) method_call(mut node ast.CallExpr, mut continue_check &bool) if !method.is_pub && method.mod != c.mod { // If a private method is called outside of the module // its receiver type is defined in, show an error. - // println('warn $method_name lef.mod=$left_type_sym.mod c.mod=$c.mod') + // println('warn ${method_name} lef.mod=${left_type_sym.mod} c.mod=${c.mod}') c.error('method `${left_sym.name}.${method_name}` is private', node.pos) } rec_share := method.params[0].typ.share() diff --git a/vlib/v/checker/interface.v b/vlib/v/checker/interface.v index 8a42c1da2..e7a313992 100644 --- a/vlib/v/checker/interface.v +++ b/vlib/v/checker/interface.v @@ -14,7 +14,7 @@ fn (mut c Checker) interface_decl(mut node ast.InterfaceDecl) { mut has_generic_types := false if node.embeds.len > 0 { all_embeds := c.expand_iface_embeds(node, 0, node.embeds) - // eprintln('> node.name: $node.name | node.embeds.len: $node.embeds.len | all_embeds: $all_embeds.len') + // eprintln('> node.name: ${node.name} | node.embeds.len: ${node.embeds.len} | all_embeds: ${all_embeds.len}') node.embeds = all_embeds mut emnames := map[string]int{} mut emnames_ds := map[string]bool{} diff --git a/vlib/v/checker/struct.v b/vlib/v/checker/struct.v index 745884a5b..54cdc52cb 100644 --- a/vlib/v/checker/struct.v +++ b/vlib/v/checker/struct.v @@ -950,7 +950,7 @@ or use an explicit `unsafe{ a[..] }`, if you do not want a copy of the slice.', c.check_uninitialized_struct_fields_and_embeds(node, type_sym, mut info, mut inited_fields) } - // println('>> checked_types.len: $checked_types.len | checked_types: $checked_types | type_sym: $type_sym.name ') + // println('>> checked_types.len: ${checked_types.len} | checked_types: ${checked_types} | type_sym: ${type_sym.name} ') } .sum_type { first_typ := (type_sym.info as ast.SumType).variants[0] @@ -1158,7 +1158,7 @@ fn (mut c Checker) check_uninitialized_struct_fields_and_embeds(node ast.StructI /* sym := c.table.sym(field.typ) if sym.kind == .sum_type { - c.warn('sum type field `${type_sym.name}.$field.name` must be initialized', + c.warn('sum type field `${type_sym.name}.${field.name}` must be initialized', node.pos) } */ diff --git a/vlib/v/checker/tests/assign_expr_undefined_err_b.out b/vlib/v/checker/tests/assign_expr_undefined_err_b.out index f43a641af..660f78576 100644 --- a/vlib/v/checker/tests/assign_expr_undefined_err_b.out +++ b/vlib/v/checker/tests/assign_expr_undefined_err_b.out @@ -2,5 +2,5 @@ vlib/v/checker/tests/assign_expr_undefined_err_b.vv:2:10: error: undefined varia 1 | fn main() { 2 | a, b := a, b | ^ - 3 | println('$a, $b') + 3 | println('${a}, ${b}') 4 | } diff --git a/vlib/v/checker/tests/assign_expr_undefined_err_b.vv b/vlib/v/checker/tests/assign_expr_undefined_err_b.vv index b77ab6cbd..af86fb645 100644 --- a/vlib/v/checker/tests/assign_expr_undefined_err_b.vv +++ b/vlib/v/checker/tests/assign_expr_undefined_err_b.vv @@ -1,4 +1,4 @@ fn main() { a, b := a, b - println('$a, $b') + println('${a}, ${b}') } diff --git a/vlib/v/checker/tests/assign_expr_undefined_err_c.out b/vlib/v/checker/tests/assign_expr_undefined_err_c.out index a68f329f6..83b0d5382 100644 --- a/vlib/v/checker/tests/assign_expr_undefined_err_c.out +++ b/vlib/v/checker/tests/assign_expr_undefined_err_c.out @@ -2,5 +2,5 @@ vlib/v/checker/tests/assign_expr_undefined_err_c.vv:2:10: error: undefined varia 1 | fn main() { 2 | a, b := a + 1, b * 3 | ^ - 3 | println('$a, $b') + 3 | println('${a}, ${b}') 4 | } diff --git a/vlib/v/checker/tests/assign_expr_undefined_err_c.vv b/vlib/v/checker/tests/assign_expr_undefined_err_c.vv index b84589320..d91a59e2e 100644 --- a/vlib/v/checker/tests/assign_expr_undefined_err_c.vv +++ b/vlib/v/checker/tests/assign_expr_undefined_err_c.vv @@ -1,4 +1,4 @@ fn main() { a, b := a + 1, b * 3 - println('$a, $b') + println('${a}, ${b}') } diff --git a/vlib/v/checker/tests/assign_expr_undefined_err_d.out b/vlib/v/checker/tests/assign_expr_undefined_err_d.out index 4a8df8833..e76660d92 100644 --- a/vlib/v/checker/tests/assign_expr_undefined_err_d.out +++ b/vlib/v/checker/tests/assign_expr_undefined_err_d.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/assign_expr_undefined_err_d.vv:2:9: error: undefined variable: `s` +vlib/v/checker/tests/assign_expr_undefined_err_d.vv:2:10: error: undefined variable: `s` 1 | fn main() { - 2 | s := '$s' - | ^ + 2 | s := '${s}' + | ^ 3 | println(s) 4 | } diff --git a/vlib/v/checker/tests/assign_expr_undefined_err_d.vv b/vlib/v/checker/tests/assign_expr_undefined_err_d.vv index f9acc47b3..531dfcff3 100644 --- a/vlib/v/checker/tests/assign_expr_undefined_err_d.vv +++ b/vlib/v/checker/tests/assign_expr_undefined_err_d.vv @@ -1,4 +1,4 @@ fn main() { - s := '$s' + s := '${s}' println(s) } diff --git a/vlib/v/checker/tests/assign_expr_undefined_err_f.out b/vlib/v/checker/tests/assign_expr_undefined_err_f.out index 1b1f9268f..cab002da9 100644 --- a/vlib/v/checker/tests/assign_expr_undefined_err_f.out +++ b/vlib/v/checker/tests/assign_expr_undefined_err_f.out @@ -2,5 +2,5 @@ vlib/v/checker/tests/assign_expr_undefined_err_f.vv:2:12: error: undefined varia 1 | fn main() { 2 | a, b := (-a + 1), 1 | ^ - 3 | println('$a, $b') + 3 | println('${a}, ${b}') 4 | } diff --git a/vlib/v/checker/tests/assign_expr_undefined_err_f.vv b/vlib/v/checker/tests/assign_expr_undefined_err_f.vv index 79ec34862..9d1e87f22 100644 --- a/vlib/v/checker/tests/assign_expr_undefined_err_f.vv +++ b/vlib/v/checker/tests/assign_expr_undefined_err_f.vv @@ -1,4 +1,4 @@ fn main() { a, b := (-a + 1), 1 - println('$a, $b') + println('${a}, ${b}') } diff --git a/vlib/v/checker/tests/assign_expr_undefined_err_l.out b/vlib/v/checker/tests/assign_expr_undefined_err_l.out index cae5c2619..995427deb 100644 --- a/vlib/v/checker/tests/assign_expr_undefined_err_l.out +++ b/vlib/v/checker/tests/assign_expr_undefined_err_l.out @@ -4,4 +4,4 @@ vlib/v/checker/tests/assign_expr_undefined_err_l.vv:29:6: error: undefined varia 29 | i: poo.result() | ~~~ 30 | } - 31 | println('$poo') + 31 | println('${poo}') diff --git a/vlib/v/checker/tests/assign_expr_undefined_err_l.vv b/vlib/v/checker/tests/assign_expr_undefined_err_l.vv index 2b47bf788..bae8f71b3 100644 --- a/vlib/v/checker/tests/assign_expr_undefined_err_l.vv +++ b/vlib/v/checker/tests/assign_expr_undefined_err_l.vv @@ -28,5 +28,5 @@ fn main() { a: 123 i: poo.result() } - println('$poo') + println('${poo}') } diff --git a/vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.out b/vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.out index caab66c25..871b9c0e6 100644 --- a/vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.out +++ b/vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.out @@ -3,24 +3,24 @@ vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.vv:9:2: error: 8 | func1() 9 | a = 2 | ^ - 10 | println('a is $a') + 10 | println('a is ${a}') 11 | } vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.vv:9:6: error: cannot assign to `a`: expected `void`, not `int literal` 7 | fn main() { 8 | func1() 9 | a = 2 | ^ - 10 | println('a is $a') + 10 | println('a is ${a}') 11 | } -vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.vv:10:17: error: undefined ident: `a` +vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.vv:10:18: error: undefined ident: `a` 8 | func1() 9 | a = 2 - 10 | println('a is $a') - | ^ + 10 | println('a is ${a}') + | ^ 11 | } -vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.vv:10:17: error: expression does not return a value +vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.vv:10:18: error: expression does not return a value 8 | func1() 9 | a = 2 - 10 | println('a is $a') - | ^ + 10 | println('a is ${a}') + | ^ 11 | } diff --git a/vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.vv b/vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.vv index 09b22be32..f37b3c85f 100644 --- a/vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.vv +++ b/vlib/v/checker/tests/error_with_several_comments_with_crlf_ending.vv @@ -7,5 +7,5 @@ fn func1() { fn main() { func1() a = 2 - println('a is $a') + println('a is ${a}') } diff --git a/vlib/v/checker/tests/generics_struct_init_type_parameter_err.vv b/vlib/v/checker/tests/generics_struct_init_type_parameter_err.vv index 0ed4311ea..ff931f84d 100644 --- a/vlib/v/checker/tests/generics_struct_init_type_parameter_err.vv +++ b/vlib/v/checker/tests/generics_struct_init_type_parameter_err.vv @@ -7,7 +7,7 @@ fn send_1[A, B](res A, b B) string { result: res } println(b) - return '$msg' + return '${msg}' } fn send_2[A, B](res A, b B) string { @@ -15,7 +15,7 @@ fn send_2[A, B](res A, b B) string { result: res } println(b) - return '$msg' + return '${msg}' } fn main() { diff --git a/vlib/v/checker/tests/prefix_err.out b/vlib/v/checker/tests/prefix_err.out index 86246df73..decdd5b4c 100644 --- a/vlib/v/checker/tests/prefix_err.out +++ b/vlib/v/checker/tests/prefix_err.out @@ -40,7 +40,7 @@ vlib/v/checker/tests/prefix_err.vv:10:6: error: cannot take the address of 'Hi' | ^ 11 | _ := &'${b}' 12 | _ := &`c` -vlib/v/checker/tests/prefix_err.vv:11:6: error: cannot take the address of '$b' +vlib/v/checker/tests/prefix_err.vv:11:6: error: cannot take the address of '${b}' 9 | _ := &10 10 | _ := &'Hi' 11 | _ := &'${b}' diff --git a/vlib/v/checker/tests/void_option_err.vv b/vlib/v/checker/tests/void_option_err.vv index 136e6e5ad..5f824331f 100644 --- a/vlib/v/checker/tests/void_option_err.vv +++ b/vlib/v/checker/tests/void_option_err.vv @@ -3,5 +3,5 @@ fn ret_void() ?void { } fn main() { - _ = ret_void() or { panic('$err') } + _ = ret_void() or { panic('${err}') } } diff --git a/vlib/v/debug/interactive_test.v b/vlib/v/debug/interactive_test.v index 7a9b253a8..425df318e 100644 --- a/vlib/v/debug/interactive_test.v +++ b/vlib/v/debug/interactive_test.v @@ -34,7 +34,7 @@ fn test_debugger() { assert all_expect_files.len > 0, 'no .expect files found in ${expect_tests_path}' mut oks := 0 for eidx, efile in all_expect_files.sorted() { - // if !efile.contains('sumtype') { gprintln('skipping $efile') continue } + // if !efile.contains('sumtype') { gprintln('skipping ${efile}') continue } vfile := efile.replace('.expect', '.vv') output_file := os.join_path(test_module_path, os.file_name(efile).replace('.expect', '.exe')) diff --git a/vlib/v/debug/tracing_test.v b/vlib/v/debug/tracing_test.v index 96e574cdd..a8848d122 100644 --- a/vlib/v/debug/tracing_test.v +++ b/vlib/v/debug/tracing_test.v @@ -31,7 +31,7 @@ fn test_trace() { assert all_expect_files.len > 0, 'no .v files found in ${trace_tests_path}' mut oks := 0 for eidx, efile in all_expect_files.sorted() { - // if !efile.contains('sumtype') { gprintln('skipping $efile') continue } + // if !efile.contains('sumtype') { gprintln('skipping ${efile}') continue } vfile := efile if be_verbose { diff --git a/vlib/v/eval/expr.c.v b/vlib/v/eval/expr.c.v index 0d124b08e..c870d029f 100644 --- a/vlib/v/eval/expr.c.v +++ b/vlib/v/eval/expr.c.v @@ -87,7 +87,7 @@ pub fn (mut e Eval) expr(expr ast.Expr, expecting ast.Type) Object { // // } // } // // println((e.local_vars['s'].val as string).str == voidptr_args[1]) - // println('hello?$voidptr_args') + // println('hello?${voidptr_args}') // // println((byteptr(voidptr_args[1])[0])) // x := strconv.v_sprintf(args[0] as string, ...voidptr_args) // // println('hello!') @@ -488,7 +488,7 @@ pub fn (mut e Eval) expr(expr ast.Expr, expecting ast.Type) Object { } } ast.StructInit { - // eprintln('unhandled struct init at line $expr.pos.line_nr') + // eprintln('unhandled struct init at line ${expr.pos.line_nr}') return '' } ast.SizeOf { diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 4e208bc40..1638ce87d 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -3221,17 +3221,12 @@ pub fn (mut f Fmt) string_inter_literal(node ast.StringInterLiteral) { break } f.write('$') - fspec_str, needs_braces := node.get_fspec_braces(i) - if needs_braces { - f.write('{') - f.expr(node.exprs[i]) - f.write(fspec_str) - f.write('}') - } else { - f.write('{') - f.expr(node.exprs[i]) - f.write('}') - } + fspec_str := node.get_fspec(i) + + f.write('{') + f.expr(node.exprs[i]) + f.write(fspec_str) + f.write('}') } f.write(quote) } diff --git a/vlib/v/fmt/struct.v b/vlib/v/fmt/struct.v index 30b0b319d..90b53a9e5 100644 --- a/vlib/v/fmt/struct.v +++ b/vlib/v/fmt/struct.v @@ -200,7 +200,7 @@ pub fn (mut f Fmt) struct_init(node ast.StructInit) { f.is_struct_init = struct_init_save } sym_name := f.table.sym(node.typ).name - // f.write('') + // f.write('') mut name := if !sym_name.starts_with('C.') && !sym_name.starts_with('JS.') { f.no_cur_mod(f.short_module(sym_name)) // TODO: f.type_to_str? } else { diff --git a/vlib/v/fmt/tests/anon_fn_input.vv b/vlib/v/fmt/tests/anon_fn_input.vv index 8884991b5..f65119850 100644 --- a/vlib/v/fmt/tests/anon_fn_input.vv +++ b/vlib/v/fmt/tests/anon_fn_input.vv @@ -4,17 +4,17 @@ fn has_anon_fn() { } an_fn_w_param := fn ( s string ) { - println('I received $s') + println('I received ${s}') } an_fn_w_multi_params := fn (s1 string, s2 string, s3 string) { - println('I received $s1, $s2, $s3') + println('I received ${s1}, ${s2}, ${s3}') } an_fn_w_multi_params2 :=fn (s string, i int) { - println('I received $s, $i') + println('I received ${s}, ${i}') } fn_w_var_args := fn (ss ...string) { for s in ss { - println('yo $s') + println('yo ${s}') } } an_fn() an_fn_w_param('a gift') an_fn_w_multi_params('one', 'two', 'three') diff --git a/vlib/v/fmt/tests/expressions_input.vv b/vlib/v/fmt/tests/expressions_input.vv index 6f8ea6d9a..c62deb133 100644 --- a/vlib/v/fmt/tests/expressions_input.vv +++ b/vlib/v/fmt/tests/expressions_input.vv @@ -58,7 +58,7 @@ fn main() { } v_str := 'v' s := []string{} - s << ' `$v_str`' + s << ' `${v_str}`' println(s) println('this is quite a long string' + ' that is followed by an even longer part that should go to another line') if (a == b && b > r) || (d > r) || (a < b) || (b< d && a+b > r) || (a+b+d >= 0 && r < 0) || (a > b && d-r < b) { @@ -69,7 +69,7 @@ fn main() { fn gen_str_for_multi_return(mut g gen.Gen, info table.MultiReturn, styp, str_fn_name string) { for i, _ in info.types { - println('\tstrings__Builder_write(&sb, _STR("\'%.*s\\000\'", 2, a.arg$i));') + println('\tstrings__Builder_write(&sb, _STR("\'%.*s\\000\'", 2, a.arg${i}));') } } diff --git a/vlib/v/gen/c/array.v b/vlib/v/gen/c/array.v index 61290e1d5..e6aa4676e 100644 --- a/vlib/v/gen/c/array.v +++ b/vlib/v/gen/c/array.v @@ -776,7 +776,7 @@ fn (mut g Gen) gen_array_sorted(node ast.CallExpr) { // `users.sort(a.age < b.age)` fn (mut g Gen) gen_array_sort(node ast.CallExpr) { - // println('filter s="$s"') + // println('filter s="${s}"') rec_sym := g.table.final_sym(node.receiver_type) if rec_sym.kind !in [.array, .array_fixed] { // println(rec_sym.kind) @@ -900,7 +900,7 @@ fn (mut g Gen) gen_array_sort_call(node ast.CallExpr, compare_fn string, is_arra } else { g.dot_or_ptr(node.left_type) } - // eprintln('> qsort: pointer $node.left_type | deref_field: `$deref_field`') + // eprintln('> qsort: pointer ${node.left_type} | deref_field: `${deref_field}`') g.empty_line = true if is_array { g.write('if (') diff --git a/vlib/v/gen/c/assert.v b/vlib/v/gen/c/assert.v index bde8b9d2d..93f315ed2 100644 --- a/vlib/v/gen/c/assert.v +++ b/vlib/v/gen/c/assert.v @@ -203,7 +203,7 @@ fn (mut g Gen) gen_assert_metainfo_common(node ast.AssertStmt) string { } fn (mut g Gen) gen_assert_single_expr(expr ast.Expr, typ ast.Type) { - // eprintln('> gen_assert_single_expr typ: $typ | expr: $expr | typeof(expr): ${typeof(expr)}') + // eprintln('> gen_assert_single_expr typ: ${typ} | expr: ${expr} | typeof(expr): ${typeof(expr)}') expr_str := '${expr}' match expr { ast.CastExpr { diff --git a/vlib/v/gen/c/auto_str_methods.v b/vlib/v/gen/c/auto_str_methods.v index 166ed0008..0b9a4de68 100644 --- a/vlib/v/gen/c/auto_str_methods.v +++ b/vlib/v/gen/c/auto_str_methods.v @@ -1144,7 +1144,7 @@ fn (mut g Gen) gen_str_for_struct(info ast.Struct, lang ast.Language, styp strin if field.typ.is_ptr() && sym.kind in [.struct, .interface] { funcprefix += '(indent_count > 25)? _S("") : ' } - // eprintln('>>> caller_should_free: ${caller_should_free:6s} | funcprefix: $funcprefix | func: $func') + // eprintln('>>> caller_should_free: ${caller_should_free:6s} | funcprefix: ${funcprefix} | func: ${func}') if caller_should_free { tmpvar := g.new_tmp_var() fn_body_surrounder.add('\tstring ${tmpvar} = ${funcprefix}${func};', diff --git a/vlib/v/gen/c/autofree.v b/vlib/v/gen/c/autofree.v index a6fa7b936..d4e55189d 100644 --- a/vlib/v/gen/c/autofree.v +++ b/vlib/v/gen/c/autofree.v @@ -26,7 +26,7 @@ fn (mut g Gen) autofree_scope_vars_stop(pos int, line_nr int, free_parent_scopes // TODO: why can pos be -1? return } - // eprintln('> free_scope_vars($pos)') + // eprintln('> free_scope_vars(${pos})') scope := g.file.scope.innermost(pos) // g.writeln('// scope start pos=${scope.start_pos} ') if scope.start_pos == 0 { diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 96a1f7719..2aec70299 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -2332,7 +2332,7 @@ fn (mut g Gen) stmts_with_tmp_var(stmts []ast.Stmt, tmp_var string) bool { stmt := stmts[0] if stmt !is ast.FnDecl && g.inside_ternary == 0 { // g.trace_autofree('// autofree scope') - // g.trace_autofree('// autofree_scope_vars($stmt.pos.pos) | ${typeof(stmt)}') + // g.trace_autofree('// autofree_scope_vars(${stmt.pos.pos}) | ${typeof(stmt)}') // go back 1 position is important so we dont get the // internal scope of for loops and possibly other nodes // g.autofree_scope_vars(stmt.pos.pos - 1) @@ -2785,9 +2785,9 @@ fn (mut g Gen) stmt(node ast.Stmt) { // g.writeln('typedef struct {') // for field in it.fields { // field_type_sym := g.table.sym(field.typ) - // g.writeln('\t$field_type_sym.name $field.name;') + // g.writeln('\t${field_type_sym.name} ${field.name};') // } - // g.writeln('} $name;') + // g.writeln('} ${name};') if node.language == .c { return } @@ -3324,7 +3324,7 @@ fn cestring(s string) string { return s.replace('\\', '\\\\').replace('"', "'") } -// ctoslit returns a '_S("$s")' call, where s is properly escaped. +// ctoslit returns a '_S("${s}")' call, where s is properly escaped. fn ctoslit(s string) string { return '_S("' + cescape_nonascii(cestring(s)) + '")' } diff --git a/vlib/v/gen/c/comptime.v b/vlib/v/gen/c/comptime.v index 2fb157875..d2c93c820 100644 --- a/vlib/v/gen/c/comptime.v +++ b/vlib/v/gen/c/comptime.v @@ -275,7 +275,7 @@ fn (mut g Gen) comptime_call(mut node ast.ComptimeCall) { } // receiver := method.args[0] // if !p.expr_var.ptr { - // p.error('`$p.expr_var.name` needs to be a reference') + // p.error('`${p.expr_var.name}` needs to be a reference') // } amp := '' // if receiver.is_mut && !p.expr_var.ptr { '&' } else { '' } if node.is_vweb { diff --git a/vlib/v/gen/c/consts_and_globals.v b/vlib/v/gen/c/consts_and_globals.v index 55a8a2072..693efcf59 100644 --- a/vlib/v/gen/c/consts_and_globals.v +++ b/vlib/v/gen/c/consts_and_globals.v @@ -229,7 +229,7 @@ fn (mut g Gen) const_decl_precomputed(mod string, name string, cname string, fie } string { escaped_val := util.smart_quote(ct_value, false) - // g.const_decl_write_precomputed(line_nr, styp, cname, '_S("$escaped_val")') + // g.const_decl_write_precomputed(line_nr, styp, cname, '_S("${escaped_val}")') // TODO: ^ the above for strings, cause: // `error C2099: initializer is not a constant` errors in MSVC, // so fall back to the delayed initialisation scheme: diff --git a/vlib/v/gen/c/coutput_test.v b/vlib/v/gen/c/coutput_test.v index 40a67932a..f53c14791 100644 --- a/vlib/v/gen/c/coutput_test.v +++ b/vlib/v/gen/c/coutput_test.v @@ -143,7 +143,7 @@ fn test_c_must_have_files() { for idx_expected_line, eline in expected_lines { if does_line_match_one_of_generated_lines(eline, generated_c_lines) { nmatches++ - // eprintln('> testing: $must_have_path has line: $eline') + // eprintln('> testing: ${must_have_path} has line: ${eline}') } else { failed_patterns << eline description += '\n failed pattern: `${eline}`' diff --git a/vlib/v/gen/c/dumpexpr.v b/vlib/v/gen/c/dumpexpr.v index 9db51740c..fb7f8b3c5 100644 --- a/vlib/v/gen/c/dumpexpr.v +++ b/vlib/v/gen/c/dumpexpr.v @@ -135,7 +135,7 @@ fn (mut g Gen) dump_expr_definitions() { mut dump_fn_defs := strings.new_builder(100) for dump_type, cname in g.table.dumps { dump_sym := g.table.sym(ast.idx_to_type(dump_type)) - // eprintln('>>> dump_type: $dump_type | cname: $cname | dump_sym: $dump_sym.name') + // eprintln('>>> dump_type: ${dump_type} | cname: ${cname} | dump_sym: ${dump_sym.name}') mut name := cname if dump_sym.language == .c { name = name[3..] diff --git a/vlib/v/gen/c/fn.v b/vlib/v/gen/c/fn.v index 1199a1525..fb9e9cd15 100644 --- a/vlib/v/gen/c/fn.v +++ b/vlib/v/gen/c/fn.v @@ -118,7 +118,7 @@ fn (mut g Gen) fn_decl(node ast.FnDecl) { if ((mod != g.module_built && node.mod != g.module_built.after('/')) || should_bundle_module) && node.generic_names.len == 0 { // Skip functions that don't have to be generated for this module. - // println('skip bm $node.name mod=$node.mod module_built=$g.module_built') + // println('skip bm ${node.name} mod=${node.mod} module_built=${g.module_built}') skip = true } if g.is_builtin_mod && g.module_built == 'builtin' && node.mod == 'builtin' { @@ -981,7 +981,7 @@ fn (mut g Gen) call_expr(node ast.CallExpr) { } else { '' } - // g.write('/*EE line="$cur_line"*/') + // g.write('/*EE line="${cur_line}"*/') tmp_opt := if gen_or || gen_keep_alive { if g.inside_curry_call && g.last_tmp_call_var.len > 0 { g.last_tmp_call_var.pop() @@ -2586,7 +2586,7 @@ fn (mut g Gen) call_args(node ast.CallExpr) { } use_tmp_var_autofree := g.is_autofree && arg.typ == ast.string_type && arg.is_tmp_autofree && !g.inside_const && !g.is_builtin_mod - // g.write('/* af=$arg.is_tmp_autofree */') + // g.write('/* af=${arg.is_tmp_autofree} */') // some c fn definitions dont have args (cfns.v) or are not updated in checker // when these are fixed we wont need this check if i < expected_types.len { @@ -2594,10 +2594,10 @@ fn (mut g Gen) call_args(node ast.CallExpr) { if arg.is_tmp_autofree { // && !g.is_js_call { // We saved expressions in temp variables so that they can be freed later. // `foo(str + str2) => x := str + str2; foo(x); x.free()` - // g.write('_arg_expr_${g.called_fn_name}_$i') + // g.write('_arg_expr_${g.called_fn_name}_${i}') // Use these variables here. fn_name := node.name.replace('.', '_') - // name := '_tt${g.tmp_count_af}_arg_expr_${fn_name}_$i' + // name := '_tt${g.tmp_count_af}_arg_expr_${fn_name}_${i}' name := '_arg_expr_${fn_name}_${i + 1}_${node.pos.pos}' g.write('/*autofree arg*/' + name) } diff --git a/vlib/v/gen/c/for.v b/vlib/v/gen/c/for.v index e216527c3..8d4679bd0 100644 --- a/vlib/v/gen/c/for.v +++ b/vlib/v/gen/c/for.v @@ -599,10 +599,10 @@ fn (mut g Gen) for_in_stmt(node_ ast.ForInStmt) { if node.kind == .map { // diff := g.new_tmp_var() - // g.writeln('${ast.int_type_name} $diff = $cond_var${arw_or_pt}key_values.len - $map_len;') - // g.writeln('if ($diff < 0) {') - // g.writeln('\t$idx = -1;') - // g.writeln('\t$map_len = $cond_var${arw_or_pt}key_values.len;') + // g.writeln('${ast.int_type_name} ${diff} = ${cond_var}${arw_or_pt}key_values.len - ${map_len};') + // g.writeln('if (${diff} < 0) {') + // g.writeln('\t${idx} = -1;') + // g.writeln('\t${map_len} = ${cond_var}${arw_or_pt}key_values.len;') // g.writeln('}') } g.write_defer_stmts(node.scope, false, node.pos) diff --git a/vlib/v/gen/c/json.v b/vlib/v/gen/c/json.v index 6219655ef..f781a3d0f 100644 --- a/vlib/v/gen/c/json.v +++ b/vlib/v/gen/c/json.v @@ -1221,7 +1221,7 @@ fn (mut g Gen) encode_map(utyp ast.Type, key_type ast.Type, value_type ast.Type) if key_type.is_string() { key += '((${styp}*)${keys_tmp}.data)[i];' } else { - // key += '${styp}_str((($styp*)${keys_tmp}.data)[i]);' + // key += '${styp}_str(((${styp}*)${keys_tmp}.data)[i]);' verror('json: encode only maps with string keys') } if utyp.has_flag(.option) { diff --git a/vlib/v/gen/c/match.v b/vlib/v/gen/c/match.v index 82a75832f..af929857f 100644 --- a/vlib/v/gen/c/match.v +++ b/vlib/v/gen/c/match.v @@ -136,14 +136,14 @@ fn (mut g Gen) match_expr(node ast.MatchExpr) { } else { // ast.StringLiteral, ast.Ident, ast.RangeExpr can not used in switch cases in C - // eprintln('>>>> node.cond: $node.cond | branch expr: ${typeof(expr)} | expr: $expr') + // eprintln('>>>> node.cond: ${node.cond} | branch expr: ${typeof(expr)} | expr: ${expr}') can_be_a_switch = false break all_branches } } } } - // eprintln('> can_be_a_switch: $can_be_a_switch') + // eprintln('> can_be_a_switch: ${can_be_a_switch}') if can_be_a_switch && !is_expr && g.loop_depth == 0 && g.fn_decl != unsafe { nil } && cond_fsym.is_int() { g.match_expr_switch(node, is_expr, cond_var, tmp_var, cond_fsym) diff --git a/vlib/v/gen/c/str.v b/vlib/v/gen/c/str.v index c45444cdd..09b642819 100644 --- a/vlib/v/gen/c/str.v +++ b/vlib/v/gen/c/str.v @@ -17,7 +17,7 @@ fn (mut g Gen) string_literal(node ast.StringLiteral) { } // optimize string interpolation in string builders: -// `sb.writeln('a=$a')` => +// `sb.writeln('a=${a}')` => // `sb.writeln('a='); sb.writeln(a.str())` fn (mut g Gen) string_inter_literal_sb_optimized(call_expr ast.CallExpr) { node := call_expr.args[0].expr as ast.StringInterLiteral diff --git a/vlib/v/gen/c/text_manipulation.v b/vlib/v/gen/c/text_manipulation.v index ec8814fe7..a9e4803a9 100644 --- a/vlib/v/gen/c/text_manipulation.v +++ b/vlib/v/gen/c/text_manipulation.v @@ -82,7 +82,7 @@ fn (mut g Gen) writeln(s string) { g.out.write_string(util.tabs(g.indent)) // g.out_parallel[g.out_idx].write_string(util.tabs(g.indent)) } - // println('w len=$g.out_parallel.len') + // println('w len=${g.out_parallel.len}') g.out.writeln(s) // g.out_parallel[g.out_idx].writeln(s) g.empty_line = true diff --git a/vlib/v/gen/golang/golang.v b/vlib/v/gen/golang/golang.v index f92e29602..f94af27fa 100644 --- a/vlib/v/gen/golang/golang.v +++ b/vlib/v/gen/golang/golang.v @@ -502,7 +502,7 @@ fn stmt_is_single_line(stmt ast.Stmt) bool { pub fn (mut f Gen) expr(node_ ast.Expr) { mut node := unsafe { node_ } // if f.is_debug { - // eprintln('expr: ${node.pos():-42} | node: ${node.type_name():-20} | $node.str()') + // eprintln('expr: ${node.pos():-42} | node: ${node.type_name():-20} | ${node.str()}') //} match mut node { ast.NodeError {} @@ -2033,7 +2033,7 @@ pub fn (mut f Gen) or_expr(node ast.OrExpr) { // the control stmts (return/break/continue...) print a newline inside them, // so, since this'll all be on one line, trim any possible whitespace // str := f.node_str(node.stmts[0]).trim_space() - // single_line := ' or { $str }' + // single_line := ' or { ${str} }' } // Make it multiline if the blocks has at least two stmts // or a single line would be too long @@ -2251,15 +2251,12 @@ pub fn (mut f Gen) string_inter_literal(node ast.StringInterLiteral) { break } f.write('$') - fspec_str, needs_braces := node.get_fspec_braces(i) - if needs_braces { - f.write('{') - f.expr(node.exprs[i]) - f.write(fspec_str) - f.write('}') - } else { - f.expr(node.exprs[i]) - } + fspec_str := node.get_fspec(i) + + f.write('{') + f.expr(node.exprs[i]) + f.write(fspec_str) + f.write('}') } f.write(quote) } diff --git a/vlib/v/gen/golang/struct.v b/vlib/v/gen/golang/struct.v index 8f70882f2..5c080ecbb 100644 --- a/vlib/v/gen/golang/struct.v +++ b/vlib/v/gen/golang/struct.v @@ -107,7 +107,7 @@ pub fn (mut f Gen) struct_init(node ast.StructInit) { } type_sym := f.table.sym(node.typ) - // f.write('') + // f.write('') mut name := type_sym.name if !name.starts_with('C.') && !name.starts_with('JS.') { name = f.no_cur_mod(f.short_module(type_sym.name)) // TODO: f.type_to_str? diff --git a/vlib/v/gen/golang/tests/string.go.vv b/vlib/v/gen/golang/tests/string.go.vv index e46b85d8f..2c1ca2165 100644 --- a/vlib/v/gen/golang/tests/string.go.vv +++ b/vlib/v/gen/golang/tests/string.go.vv @@ -24,8 +24,8 @@ fn main() { // bananna := 'bananna' // number_one := 1 // number_two := 2 - // inter_a := 'I have $number_one ${apple}\'s and $number_two ${bananna}\'s' - // inter_b := "I have \"$number_one ${apple}'s\" and \"$number_two ${bananna}'s\"" + // inter_a := 'I have ${number_one} ${apple}\'s and ${number_two} ${bananna}\'s' + // inter_b := "I have \"${number_one} ${apple}'s\" and \"${number_two} ${bananna}'s\"" // println(inter_a) // println(inter_b) } \ No newline at end of file diff --git a/vlib/v/gen/js/auto_str_methods.v b/vlib/v/gen/js/auto_str_methods.v index 2e5ce345e..e5114e056 100644 --- a/vlib/v/gen/js/auto_str_methods.v +++ b/vlib/v/gen/js/auto_str_methods.v @@ -497,10 +497,10 @@ fn (mut g JsGen) gen_str_for_array(info ast.Array, styp string, str_fn_name stri } else if sym.kind == .rune { g.definitions.writeln('\t\tlet x = new string("\`" + String.fromCharCode(it.val) + "\`");') // Rune are managed at this level as strings - // g.definitions.writeln('\t\tstring x = builtin__str_intp(2, _MOV((StrIntpData[]){{new string("\`"), $c.si_s_code, {.d_s = ${elem_str_fn_name}(it) }}, {new string("\`"), 0, {.d_c = 0 }}}));\n') + // g.definitions.writeln('\t\tstring x = builtin__str_intp(2, _MOV((StrIntpData[]){{new string("\`"), ${c.si_s_code}, {.d_s = ${elem_str_fn_name}(it) }}, {new string("\`"), 0, {.d_c = 0 }}}));\n') } else if sym.kind == .string { g.definitions.writeln('\t\tlet x = new string(it);') - // g.definitions.writeln('\t\tstring x = builtin__str_intp(2, _MOV((StrIntpData[]){{new string("\'"), $c.si_s_code, {.d_s = it }}, {new string("\'"), 0, {.d_c = 0 }}}));\n') + // g.definitions.writeln('\t\tstring x = builtin__str_intp(2, _MOV((StrIntpData[]){{new string("\'"), ${c.si_s_code}, {.d_s = it }}, {new string("\'"), 0, {.d_c = 0 }}}));\n') } else { // There is a custom .str() method, so use it. // Note: we need to take account of whether the user has defined @@ -617,7 +617,7 @@ fn (mut g JsGen) gen_str_for_map(info ast.Map, styp string, str_fn_name string) } else if key_sym.kind == .rune { g.definitions.writeln('\t\tlet x = new string("\`" + String.fromCharCode(key.val) + "\`");') g.definitions.writeln('\t\tstrings__Builder_write_string(sb,x);') - // g.definitions.writeln('\t\tstrings__Builder_write_string(sb, $tmp_str);') + // g.definitions.writeln('\t\tstrings__Builder_write_string(sb, ${tmp_str});') } else { g.definitions.writeln('\t\tstrings__Builder_write_string(sb, ${key_str_fn_name}(key));') } @@ -625,7 +625,7 @@ fn (mut g JsGen) gen_str_for_map(info ast.Map, styp string, str_fn_name string) if val_sym.kind == .function { g.definitions.writeln('\t\tstrings__Builder_write_string(sb, ${elem_str_fn_name}());') } else if val_sym.kind == .string { - // tmp_str := str_intp_sq('*($val_styp*)DenseArray_value(&m.key_values, i)') + // tmp_str := str_intp_sq('*(${val_styp}*)DenseArray_value(&m.key_values, i)') g.definitions.writeln('\t\tstrings__Builder_write_string(sb,new string("\'" + value.str + "\'"));') } else if should_use_indent_func(val_sym.kind) && !val_sym.has_method('str') { g.definitions.writeln('\t\tstrings__Builder_write_string(sb, indent_${elem_str_fn_name}(value, indent_count));') @@ -784,7 +784,7 @@ fn (mut g JsGen) gen_str_for_struct(info ast.Struct, styp string, str_fn_name st fn_builder.writeln('') } fn_builder.writeln('res.str += "\\n}"') - // fn_builder.writeln('\t\t{new string("\\n"), $c.si_s_code, {.d_s=indents}}, {new string("}"), 0, {.d_c=0}},') + // fn_builder.writeln('\t\t{new string("\\n"), ${c.si_s_code}, {.d_s=indents}}, {new string("}"), 0, {.d_c=0}},') fn_builder.writeln('\treturn res;') fn_builder.writeln('}') } diff --git a/vlib/v/gen/js/builtin_types.v b/vlib/v/gen/js/builtin_types.v index b3236133f..4bf56930b 100644 --- a/vlib/v/gen/js/builtin_types.v +++ b/vlib/v/gen/js/builtin_types.v @@ -255,7 +255,7 @@ pub fn (mut g JsGen) doc_typ(t ast.Type) string { } /* else { - println('jsgen.typ: Unhandled type $t') + println('jsgen.typ: Unhandled type ${t}') styp = sym.name } */ @@ -325,7 +325,7 @@ fn (mut g JsGen) gen_builtin_prototype(c BuiltinPrototypeConfig) { if c.has_strfn { g.writeln('str: (function() { return new string(this.toString())).bind(this) }') } - // g.writeln('eq: (function(other) { return $c.eq }).bind(this),') + // g.writeln('eq: (function(other) { return ${c.eq} }).bind(this),') } else { g.writeln('valueOf() { return ${c.value_of} },') g.writeln('toString() { return ${c.to_string} },') @@ -333,7 +333,7 @@ fn (mut g JsGen) gen_builtin_prototype(c BuiltinPrototypeConfig) { if c.has_strfn { g.writeln('str() { return new string(this.toString()) }') } - // g.writeln('eq(other) { return $c.eq },') + // g.writeln('eq(other) { return ${c.eq} },') } g.dec_indent() g.writeln('};\n') diff --git a/vlib/v/gen/js/deep_copy.v b/vlib/v/gen/js/deep_copy.v index f407699c8..6f4fe8406 100644 --- a/vlib/v/gen/js/deep_copy.v +++ b/vlib/v/gen/js/deep_copy.v @@ -116,7 +116,7 @@ fn (mut g JsGen) gen_copy_for_interface(info ast.Interface, styp string, copy_fn fn_builder.write_string(' return new string(x.str + "");') } else { /* - mut val := '${func_name}(${deref}($subtype.cname*)x._$subtype.cname' + mut val := '${func_name}(${deref}(${subtype.cname}*)x._${subtype.cname}' if should_use_indent_func(subtype.kind) && !sym_has_str_method { val += ', indent_count' } @@ -159,7 +159,7 @@ fn (mut g JsGen) gen_copy_for_struct(info ast.Struct, styp string, copy_fn_name /* tmp := g.new_tmp_var() - fn_builder.writeln('\tlet $tmp = new ${styp}({});') + fn_builder.writeln('\tlet ${tmp} = new ${styp}({});') for field in info.fields { println(field) if field.name == '' { @@ -174,13 +174,13 @@ fn (mut g JsGen) gen_copy_for_struct(info ast.Struct, styp string, copy_fn_name } if shall_copy { func_name := g.get_copy_fn(field.typ) - fn_builder.writeln('\t${tmp}.$field.name = ${func_name}(it.$field.name);') + fn_builder.writeln('\t${tmp}.${field.name} = ${func_name}(it.${field.name});') } else { - fn_builder.writeln('\t${tmp}.$field.name = it.$field.name') + fn_builder.writeln('\t${tmp}.${field.name} = it.${field.name}') } } } - fn_builder.writeln('\treturn $tmp;\n}')*/ + fn_builder.writeln('\treturn ${tmp};\n}')*/ } fn (mut g JsGen) final_gen_copy(typ StrType) { diff --git a/vlib/v/gen/js/js.v b/vlib/v/gen/js/js.v index 7ed8dbb07..2b6e9e221 100644 --- a/vlib/v/gen/js/js.v +++ b/vlib/v/gen/js/js.v @@ -278,7 +278,7 @@ pub fn gen(files []&ast.File, mut table ast.Table, pref_ &pref.Preferences) stri if pref.is_shared { // Export, through CommonJS, the module of the entry file if `-shared` was passed export := nodes.last().name - out += 'if (typeof module === "object" && module.exports) module.exports = $export;\n' + out += 'if (typeof module === "object" && module.exports) module.exports = ${export};\n' }*/ out += '\n' @@ -288,9 +288,9 @@ pub fn gen(files []&ast.File, mut table ast.Table, pref_ &pref.Preferences) stri for node in nodes { name := g.js_name(node.name).replace('.', '_') if g.enable_doc { - out += '/** @namespace $name */\n' + out += '/** @namespace ${name} */\n' } - // out += 'const $name = (function (' + // out += 'const ${name} = (function (' mut namespace := g.namespaces[node.name] @@ -1161,7 +1161,7 @@ fn (mut g JsGen) gen_assert_metainfo(node ast.AssertStmt) string { } fn (mut g JsGen) gen_assert_single_expr(expr ast.Expr, typ ast.Type) { - // eprintln('> gen_assert_single_expr typ: $typ | expr: $expr | typeof(expr): ${typeof(expr)}') + // eprintln('> gen_assert_single_expr typ: ${typ} | expr: ${expr} | typeof(expr): ${typeof(expr)}') unknown_value := '*unknown value*' match expr { ast.CastExpr, ast.IfExpr, ast.IndexExpr, ast.MatchExpr { diff --git a/vlib/v/gen/js/tests/interp.v b/vlib/v/gen/js/tests/interp.v index e58ff3a59..cfcaf353d 100644 --- a/vlib/v/gen/js/tests/interp.v +++ b/vlib/v/gen/js/tests/interp.v @@ -41,11 +41,11 @@ fn formatted_string_interpolation() { escape_dollar_in_string() fn escape_dollar_in_string() { i := 42 - test_fn('($i)', '(42)') - println('(\$i)'.contains('i') && !'(\$i)'.contains('42')) - println(!'(\\$i)'.contains('i') && '(\\$i)'.contains('42') && '(\\$i)'.contains('\\')) - println('(\\\$i)'.contains('i') && !'(\\\$i)'.contains('42') && '(\\$i)'.contains('\\')) - println(!'(\\\\$i)'.contains('i') && '(\\\\$i)'.contains('42') && '(\\\\$i)'.contains('\\\\')) + test_fn('(${i})', '(42)') + println('(\${i})'.contains('i') && !'(\${i})'.contains('42')) + println(!'(\\${i})'.contains('i') && '(\\${i})'.contains('42') && '(\\${i})'.contains('\\')) + println('(\\\${i})'.contains('i') && !'(\\\${i})'.contains('42') && '(\\${i})'.contains('\\')) + println(!'(\\\\${i})'.contains('i') && '(\\\\${i})'.contains('42') && '(\\\\${i})'.contains('\\\\')) test_fn('(${i})', '(42)') println('(\${i})'.contains('i') && !'(\${i})'.contains('42')) println(!'(\\${i})'.contains('i') && '(\\${i})'.contains('42') && '(\\${i})'.contains('\\')) @@ -108,9 +108,9 @@ fn inttypes_string_interpolation() { bp := byteptr(15541149836) l := i64(-7694555558525237396) ul := u64(17234006112912956370) - test_fn('$s $us', '-23456 54321') - test_fn('$ui $i', '3421958087 -1622999040') - test_fn('$l $ul', '-7694555558525237396 17234006112912956370') + test_fn('${s} ${us}', '-23456 54321') + test_fn('${ui} ${i}', '3421958087 -1622999040') + test_fn('${l} ${ul}', '-7694555558525237396 17234006112912956370') test_fn('>${s:11}:${us:-13}<', '> -23456:54321 <') test_fn('0x${ul:-19x}:${l:22d}', '0xef2b7d4001165bd2 : -7694555558525237396') test_fn('${c:5}${uc:-7}x', ' -103217 x') @@ -119,11 +119,11 @@ fn inttypes_string_interpolation() { test_fn('${i:x}:${ui:X}:${int(s):x}', '9f430000:CBF6EFC7:ffffa460') test_fn('${l:x}:${ul:X}', '9537727cad98876c:EF2B7D4001165BD2') // default pointer format is platform dependent, so try a few - println("platform pointer format: '${vp:p}:$bp'") - test_fn('${vp:p}:$bp', '0xcbf6efc7:0x39e53208c' || - '${vp:p}:$bp' == 'CBF6EFC7:39E53208C' || - '${vp:p}:$bp' == 'cbf6efc7:39e53208c' || - '${vp:p}:$bp' == '00000000CBF6EFC7:000000039E53208C') + println("platform pointer format: '${vp:p}:${bp}'") + test_fn('${vp:p}:${bp}', '0xcbf6efc7:0x39e53208c' || + '${vp:p}:${bp}' == 'CBF6EFC7:39E53208C' || + '${vp:p}:${bp}' == 'cbf6efc7:39e53208c' || + '${vp:p}:${bp}' == '00000000CBF6EFC7:000000039E53208C') } */ @@ -134,8 +134,8 @@ fn utf8_string_interpolation() { test_fn('${a} ${st} ${m}', 'à-côté Sträßle 10€') zz := '>${a:10}< >${st:-8}< >${m:5}<-' zz_expected := '> à-côté< >Sträßle < > 10€<-' - // println(' zz: $zz') - // println('zz_expected: $zz_expected') + // println(' zz: ${zz}') + // println('zz_expected: ${zz_expected}') test_fn(zz, zz_expected) // e := '\u20AC' // Eurosign doesn' work with MSVC and tcc e := '€' @@ -168,8 +168,8 @@ fn string_interpolation_with_negative_format_width_should_compile_and_run_withou i := 3 input := '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' println('---------------------------------------------------------------------------------------------') - println('+60 ${i:10} | input.len: ${input.len:10} | ${input.hex():60} | $input') - println('-60 ${i:10} | input.len: ${input.len:10} | ${input.hex():-60} | $input') + println('+60 ${i:10} | input.len: ${input.len:10} | ${input.hex():60} | ${input}') + println('-60 ${i:10} | input.len: ${input.len:10} | ${input.hex():-60} | ${input}') println('---------------------------------------------------------------------------------------------') println(true) } diff --git a/vlib/v/gen/native/amd64.v b/vlib/v/gen/native/amd64.v index 6f564c17f..7cd763709 100644 --- a/vlib/v/gen/native/amd64.v +++ b/vlib/v/gen/native/amd64.v @@ -1231,7 +1231,7 @@ fn (mut c Amd64) cg_call(addr i32) i64 { fn (mut c Amd64) call(addr i32) i64 { rel := c.cg_call_addr_at(addr, c.g.pos()) c_addr := c.g.pos() - // println('call addr=$addr.hex2() rel_addr=$rel.hex2() pos=$g.buf.len') + // println('call addr=${addr.hex2()} rel_addr=${rel.hex2()} pos=${g.buf.len}') c.g.write8(0xe8) c.g.write32(i32(rel)) @@ -4165,7 +4165,7 @@ pub fn (mut c Amd64) cg_allocate_stack_var(name string, size i32, initial_val Nu } } - // println('allocate_var(size=$size, initial_val=$initial_val)') + // println('allocate_var(size=${size}, initial_val=${initial_val})') c.g.println('mov [rbp-${int(n).hex2()}], ${initial_val} ; Allocate var `${name}` size: ${size}') return c.g.stack_var_pos } diff --git a/vlib/v/gen/native/arm64.v b/vlib/v/gen/native/arm64.v index 1b7fe794b..a2d7ea494 100644 --- a/vlib/v/gen/native/arm64.v +++ b/vlib/v/gen/native/arm64.v @@ -161,7 +161,7 @@ pub fn (mut c Arm64) cg_fn_decl(node ast.FnDecl) { } // define defer vars for i in 0 .. node.defer_stmts.len { - name := '_defer$i' + name := '_defer${i}' g.allocate_var(name, 8, 0) } // @@ -182,7 +182,7 @@ pub fn (mut c Arm64) cg_fn_decl(node ast.FnDecl) { // save return value g.push(.rax) for defer_stmt in g.defer_stmts.reverse() { - defer_var := g.get_var_offset('_defer$defer_stmt.idx_in_fn') + defer_var := g.get_var_offset('_defer${defer_stmt.idx_in_fn}') g.code_gen.mov_var_to_reg(.rax, defer_var) g.cmp_zero(.rax) label := g.labels.new_label() @@ -204,7 +204,7 @@ pub fn (mut c Arm64) cg_fn_decl(node ast.FnDecl) { pub fn (mut c Arm64) cg_call_fn(node ast.CallExpr) { name := node.name - // println('call fn $name') + // println('call fn ${name}') addr := c.g.fn_addr[name] if addr == 0 { c.g.n_error('fn addr of `${name}` = 0') @@ -223,7 +223,7 @@ pub fn (mut c Arm64) cg_call_fn(node ast.CallExpr) { // `foo(x)` => `mov edi,DWORD PTR [rbp-0x8]` var_offset := c.g.get_var_offset(expr.name) if c.g.pref.is_verbose { - println('i=$i fn name= $name offset=$var_offset') + println('i=${i} fn name= ${name} offset=${var_offset}') println(i32(native.fn_arg_registers[i])) } c.g.code_gen.mov_var_to_reg(native.fn_arg_registers[i], var_offset) @@ -239,7 +239,7 @@ pub fn (mut c Arm64) cg_call_fn(node ast.CallExpr) { } c.cg_call(i32(addr)) c.g.println('fn call `${name}()`') - // println('call $name $addr') + // println('call ${name} ${addr}') } fn (mut g Gen) gen_arm64_helloworld() { diff --git a/vlib/v/gen/native/expr.v b/vlib/v/gen/native/expr.v index a9147f928..334f6781f 100644 --- a/vlib/v/gen/native/expr.v +++ b/vlib/v/gen/native/expr.v @@ -310,7 +310,7 @@ fn (mut g Gen) if_expr(node ast.IfExpr) { } g.println('; jump to label ${int(endif_label)}') } - // println('after if g.pos=$g.pos() jneaddr=$cjmp_addr') + // println('after if g.pos=${g.pos()} jneaddr=${cjmp_addr}') g.labels.addrs[label] = g.pos() g.println('; label ${label}') } diff --git a/vlib/v/gen/native/gen.v b/vlib/v/gen/native/gen.v index 5982c7d00..771ab14ec 100644 --- a/vlib/v/gen/native/gen.v +++ b/vlib/v/gen/native/gen.v @@ -1298,7 +1298,7 @@ fn (mut g Gen) println(comment string) { } addr := int(g.debug_pos).hex() mut sb := strings.new_builder(80) - // println('$g.debug_pos "$addr"') + // println('${g.debug_pos} "${addr}"') sb.write_string(term.red(strings.repeat(`0`, 6 - addr.len) + addr + ' ')) for i := g.debug_pos; i < g.pos(); i++ { s := g.buf[i].hex() diff --git a/vlib/v/gen/native/macho.v b/vlib/v/gen/native/macho.v index 7ee1b216b..48a1ff2af 100644 --- a/vlib/v/gen/native/macho.v +++ b/vlib/v/gen/native/macho.v @@ -360,7 +360,7 @@ pub fn (mut g Gen) generate_macho_footer() { g.write8(0) for o in g.size_pos { n := g.read32_at(o) - // eprintln('$n + $delta') + // eprintln('${n} + ${delta}') g.write32_at(i64(o), n + delta) } g.write64(i64(0)) diff --git a/vlib/v/gen/native/stmt.c.v b/vlib/v/gen/native/stmt.c.v index abeec9ccd..7dc5e7079 100644 --- a/vlib/v/gen/native/stmt.c.v +++ b/vlib/v/gen/native/stmt.c.v @@ -435,7 +435,7 @@ fn (mut g Gen) gen_native_hash_stmt(node ast.HashStmt) { } b := unsafe { C.strtol(&char(word.str), 0, 16) } // b := word.u8() - // println('"$word" $b') + // println('"${word}" ${b}') g.write8(b) } diff --git a/vlib/v/live/executable/reloader.c.v b/vlib/v/live/executable/reloader.c.v index 5fd03c732..2b652bed9 100644 --- a/vlib/v/live/executable/reloader.c.v +++ b/vlib/v/live/executable/reloader.c.v @@ -142,7 +142,7 @@ fn protected_load_lib(mut r live.LiveReloadInfo, new_lib_path string) { // Note: r.reloader() is executed in a new, independent thread fn reloader(mut r live.LiveReloadInfo) { - // elog(r,'reloader, r: $r') + // elog(r,'reloader, r: ${r}') mut last_ts := r.last_mod_ts mut monitored_file_paths := r.monitored_files.clone() // it is much more likely that the user will be changing *the latest* files diff --git a/vlib/v/live/live_test.v b/vlib/v/live/live_test.v index c9ef300aa..0d1afb499 100644 --- a/vlib/v/live/live_test.v +++ b/vlib/v/live/live_test.v @@ -72,7 +72,7 @@ fn testsuite_begin() { exit(0) } atomic_write_source(live_program_source) - // os.system('tree $vtmp_folder') exit(1) + // os.system('tree ${vtmp_folder}') exit(1) spawn watchdog() } @@ -107,7 +107,7 @@ fn vprintln(s string) { } fn testsuite_end() { - // os.system('tree $vtmp_folder') exit(1) + // os.system('tree ${vtmp_folder}') exit(1) vprintln('source: ${source_file}') vprintln('output: ${output_file}') vprintln('---------------------------------------------------------------------------') diff --git a/vlib/v/markused/markused.v b/vlib/v/markused/markused.v index 6a4205efa..963f686db 100644 --- a/vlib/v/markused/markused.v +++ b/vlib/v/markused/markused.v @@ -444,7 +444,7 @@ fn handle_vweb(mut table ast.Table, mut all_fn_root_names []string, result_name if skip { continue } - // eprintln('vgt: $vgt | pvgt: $pvgt | sym_app.name: $sym_app.name | m.name: $m.name') + // eprintln('vgt: ${vgt} | pvgt: ${pvgt} | sym_app.name: ${sym_app.name} | m.name: ${m.name}') all_fn_root_names << pvgt + '.' + m.name } } diff --git a/vlib/v/markused/walker.v b/vlib/v/markused/walker.v index 0c39a1bfe..8fe4d18ad 100644 --- a/vlib/v/markused/walker.v +++ b/vlib/v/markused/walker.v @@ -734,7 +734,7 @@ fn (mut w Walker) expr(node_ ast.Expr) { .blank_ident {} else { // `.unresolved`, `.variable` - // println('>>> else, ast.Ident ${node.name} kind: $node.kind ') + // println('>>> else, ast.Ident ${node.name} kind: ${node.kind} ') if node.name in w.all_consts { w.mark_const_as_used(node.name) } else if node.name in w.all_globals { diff --git a/vlib/v/parser/enum.v b/vlib/v/parser/enum.v index 89050930f..7e498615c 100644 --- a/vlib/v/parser/enum.v +++ b/vlib/v/parser/enum.v @@ -98,7 +98,7 @@ fn (mut p Parser) enum_decl() ast.EnumDecl { vals << val mut expr := ast.empty_expr mut has_expr := false - // p.warn('enum val $val') + // p.warn('enum val ${val}') if p.tok.kind == .assign { p.next() old_assign_rhs := p.inside_assign_rhs diff --git a/vlib/v/parser/fn.v b/vlib/v/parser/fn.v index 966f77329..93f0db399 100644 --- a/vlib/v/parser/fn.v +++ b/vlib/v/parser/fn.v @@ -977,7 +977,7 @@ run them via `v file.v` instead', } } // if no_body && !name.starts_with('C.') { - // p.error_with_pos('did you mean C.$name instead of $name', start_pos) + // p.error_with_pos('did you mean C.${name} instead of ${name}', start_pos) // } fn_decl := ast.FnDecl{ name: name diff --git a/vlib/v/parser/for.v b/vlib/v/parser/for.v index 9970721be..67620bafe 100644 --- a/vlib/v/parser/for.v +++ b/vlib/v/parser/for.v @@ -192,7 +192,7 @@ fn (mut p Parser) for_stmt() ast.Stmt { p.inside_for = false stmts := p.parse_block_no_scope(false) pos.update_last_line(p.prev_tok.line_nr) - // println('nr stmts=$stmts.len') + // println('nr stmts=${stmts.len}') for_in_stmt := ast.ForInStmt{ stmts: stmts cond: cond diff --git a/vlib/v/parser/module.v b/vlib/v/parser/module.v index 0d34ed006..8977b4757 100644 --- a/vlib/v/parser/module.v +++ b/vlib/v/parser/module.v @@ -13,7 +13,7 @@ fn (p &Parser) known_import(mod string) bool { } fn (p &Parser) prepend_mod(name string) string { - // println('prepend_mod() name=$name p.mod=$p.mod expr_mod=$p.expr_mod') + // println('prepend_mod() name=${name} p.mod=${p.mod} expr_mod=${p.expr_mod}') if p.expr_mod != '' { return p.expr_mod + '.' + name } diff --git a/vlib/v/parser/tests/const_decl_err.vv b/vlib/v/parser/tests/const_decl_err.vv index 324d61b5c..aff263ffd 100644 --- a/vlib/v/parser/tests/const_decl_err.vv +++ b/vlib/v/parser/tests/const_decl_err.vv @@ -8,5 +8,5 @@ const ( fn main() { - println("$a $b $c") + println("${a} ${b} ${c}") } diff --git a/vlib/v/parser/tests/defer_propagate2.vv b/vlib/v/parser/tests/defer_propagate2.vv index c46c96224..eeae28730 100644 --- a/vlib/v/parser/tests/defer_propagate2.vv +++ b/vlib/v/parser/tests/defer_propagate2.vv @@ -4,9 +4,9 @@ mut: } fn (mut s Abc) close() ? { - println('> CLOSE 1 s.x: $s.x') + println('> CLOSE 1 s.x: ${s.x}') s.x = -1 - println('> CLOSE 2 s.x: $s.x') + println('> CLOSE 2 s.x: ${s.x}') } fn opt2() ?int { diff --git a/vlib/v/parser/tests/multi_argumented_assign_err.out b/vlib/v/parser/tests/multi_argumented_assign_err.out index 4e1a64ce1..8b229ce4a 100644 --- a/vlib/v/parser/tests/multi_argumented_assign_err.out +++ b/vlib/v/parser/tests/multi_argumented_assign_err.out @@ -3,5 +3,5 @@ vlib/v/parser/tests/multi_argumented_assign_err.vv:3:10: error: unexpected +=, e 2 | mut a, mut b, mut c := 0,1, 2 3 | a, b, c += 1, 2, 4 | ~~ - 4 | println('$a $b $c') + 4 | println('${a} ${b} ${c}') 5 | } diff --git a/vlib/v/parser/tests/multi_argumented_assign_err.vv b/vlib/v/parser/tests/multi_argumented_assign_err.vv index 26257b883..9a939889f 100644 --- a/vlib/v/parser/tests/multi_argumented_assign_err.vv +++ b/vlib/v/parser/tests/multi_argumented_assign_err.vv @@ -1,5 +1,5 @@ fn main() { mut a, mut b, mut c := 0,1, 2 a, b, c += 1, 2, 4 - println('$a $b $c') + println('${a} ${b} ${c}') } diff --git a/vlib/v/parser/v_parser_test.v b/vlib/v/parser/v_parser_test.v index d42ab76a0..7d20d947a 100644 --- a/vlib/v/parser/v_parser_test.v +++ b/vlib/v/parser/v_parser_test.v @@ -216,8 +216,8 @@ table := &ast.Table{} for s in text_expr { // print using str method x := parse_expr(s, table) - println('source: $s') - println('parsed: $x') + println('source: ${s}') + println('parsed: ${x}') println('===================') } */ @@ -297,7 +297,7 @@ fn parse(output_mode pref.OutputMode) ! { mut pref_ := pref.new_preferences() pref_.output_mode = output_mode for idx, f in files { - // eprintln('> parsing in mode: ${output_mode}, ${idx+1:5}/${files.len} $f ...') + // eprintln('> parsing in mode: ${output_mode}, ${idx+1:5}/${files.len} ${f} ...') mut table := ast.new_table() p := parse_file(f, mut table, .parse_comments, pref_) assert !isnil(p), 'failed to parse `${f}` in mode: ${output_mode}' diff --git a/vlib/v/pref/default.v b/vlib/v/pref/default.v index 4c0aedcac..306fa1453 100644 --- a/vlib/v/pref/default.v +++ b/vlib/v/pref/default.v @@ -210,7 +210,7 @@ pub fn (mut p Preferences) fill_with_defaults() { p.third_party_option.trim_space(), p.lookup_path.str(), ]) - // eprintln('prefs.cache_manager: $p') + // eprintln('prefs.cache_manager: ${p}') // disable use_cache for specific cases: if os.user_os() == 'windows' { p.use_cache = false diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index 12870e8d1..4a59313e1 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -252,7 +252,7 @@ pub mut: // wasm settings: wasm_stack_top int = 1024 + (16 * 1024) // stack size for webassembly backend wasm_validate bool // validate webassembly code, by calling `wasm-validate` - warn_about_allocs bool // -warn-about-allocs warngs about every single allocation, e.g. 'hi $name'. Mostly for low level development where manual memory management is used. + warn_about_allocs bool // -warn-about-allocs warngs about every single allocation, e.g. 'hi ${name}'. Mostly for low level development where manual memory management is used. // game prototyping flags: div_by_zero_is_zero bool // -div-by-zero-is-zero makes so `x / 0 == 0`, i.e. eliminates the division by zero panics/segfaults // forwards compatibility settings: @@ -1195,7 +1195,7 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin m[x] = '' } res.build_options = m.keys() - // eprintln('>> res.build_options: $res.build_options') + // eprintln('>> res.build_options: ${res.build_options}') res.fill_with_defaults() if res.backend == .c { res.skip_unused = res.build_mode != .build_module diff --git a/vlib/v/pref/should_compile.v b/vlib/v/pref/should_compile.v index abf7ce7bf..82949dacf 100644 --- a/vlib/v/pref/should_compile.v +++ b/vlib/v/pref/should_compile.v @@ -116,7 +116,7 @@ pub fn (prefs &Preferences) should_compile_filtered_files(dir string, files_ []s res << file } if prefs.is_verbose { - // println('>>> prefs: $prefs') + // println('>>> prefs: ${prefs}') println('>>> should_compile_filtered_files: res: ${res}') } return res @@ -240,17 +240,17 @@ pub fn (prefs &Preferences) should_compile_c(file string) bool { // where the Android SDK is not used. if file.ends_with('_android.c.v') { // common case, should compile for both cross android and termux - // eprintln('prefs.os: $prefs.os | file: $file | common') + // eprintln('prefs.os: ${prefs.os} | file: ${file} | common') return true } if file.ends_with('_android_outside_termux.c.v') { // compile code that targets Android, but NOT Termux (i.e. the SDK is available) - // eprintln('prefs.os: $prefs.os | file: $file | android_outside_termux') + // eprintln('prefs.os: ${prefs.os} | file: ${file} | android_outside_termux') return prefs.os == .android } if file.ends_with('_termux.c.v') { // compile Termux specific code - // eprintln('prefs.os: $prefs.os | file: $file | termux specific') + // eprintln('prefs.os: ${prefs.os} | file: ${file} | termux specific') return prefs.os == .termux } } else if file.ends_with('_android.c.v') || file.ends_with('_termux.c.v') diff --git a/vlib/v/scanner/scanner.v b/vlib/v/scanner/scanner.v index 83e8c1658..b81a18fd4 100644 --- a/vlib/v/scanner/scanner.v +++ b/vlib/v/scanner/scanner.v @@ -655,7 +655,7 @@ pub fn (mut s Scanner) text_scan() token.Token { if s.pos >= s.text.len || s.should_abort { return s.end_of_file() } - // End of $var, start next string + // End of ${var}, start next string if s.is_inter_end { if s.text[s.pos] == s.quote { s.is_inter_end = false diff --git a/vlib/v/scanner/tests/undefined_ident_in_string_literal_err.out b/vlib/v/scanner/tests/undefined_ident_in_string_literal_err.out index 7d8c72cf6..7ee890b41 100644 --- a/vlib/v/scanner/tests/undefined_ident_in_string_literal_err.out +++ b/vlib/v/scanner/tests/undefined_ident_in_string_literal_err.out @@ -1,12 +1,12 @@ -vlib/v/scanner/tests/undefined_ident_in_string_literal_err.vv:2:15: error: undefined ident: `type` +vlib/v/scanner/tests/undefined_ident_in_string_literal_err.vv:2:16: error: undefined ident: `type` 1 | fn abc() string { - 2 | return 'abc $type' - | ~~~~ + 2 | return 'abc ${type}' + | ~~~~ 3 | } 4 | -vlib/v/scanner/tests/undefined_ident_in_string_literal_err.vv:2:15: error: expression does not return a value +vlib/v/scanner/tests/undefined_ident_in_string_literal_err.vv:2:16: error: expression does not return a value 1 | fn abc() string { - 2 | return 'abc $type' - | ~~~~ + 2 | return 'abc ${type}' + | ~~~~ 3 | } 4 | diff --git a/vlib/v/scanner/tests/undefined_ident_in_string_literal_err.vv b/vlib/v/scanner/tests/undefined_ident_in_string_literal_err.vv index 7dce13f95..9dd790be2 100644 --- a/vlib/v/scanner/tests/undefined_ident_in_string_literal_err.vv +++ b/vlib/v/scanner/tests/undefined_ident_in_string_literal_err.vv @@ -1,5 +1,5 @@ fn abc() string { - return 'abc $type' + return 'abc ${type}' } fn xyz() string { diff --git a/vlib/v/slow_tests/assembly/asm_test.amd64.v b/vlib/v/slow_tests/assembly/asm_test.amd64.v index a8e297b71..2cb84f964 100644 --- a/vlib/v/slow_tests/assembly/asm_test.amd64.v +++ b/vlib/v/slow_tests/assembly/asm_test.amd64.v @@ -35,7 +35,7 @@ fn test_inline_asm() { // g, h, i := 2.3, 4.8, -3.5 // asm rv64 { - // fadd.s $i, $g, $h // test `.` in instruction name + // fadd.s ${i}, ${g}, ${h} // test `.` in instruction name // : =r (i) as i // : r (g) as g // r (g) as h diff --git a/vlib/v/slow_tests/inout/comptime_smartcast_variant.out b/vlib/v/slow_tests/inout/comptime_smartcast_variant.out index 81d296481..5be640eba 100644 --- a/vlib/v/slow_tests/inout/comptime_smartcast_variant.out +++ b/vlib/v/slow_tests/inout/comptime_smartcast_variant.out @@ -1,5 +1,5 @@ [vlib/v/slow_tests/inout/comptime_smartcast_variant.vv:14] field_value: foo -[vlib/v/slow_tests/inout/comptime_smartcast_variant.vv:18] '$field_value is a string': foo is a string +[vlib/v/slow_tests/inout/comptime_smartcast_variant.vv:18] '${field_value} is a string': foo is a string [vlib/v/slow_tests/inout/comptime_smartcast_variant.vv:14] field_value: 1 -[vlib/v/slow_tests/inout/comptime_smartcast_variant.vv:16] '$field_value is an int': 1 is an int +[vlib/v/slow_tests/inout/comptime_smartcast_variant.vv:16] '${field_value} is an int': 1 is an int [vlib/v/slow_tests/inout/comptime_smartcast_variant.vv:33] v: done diff --git a/vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.out b/vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.out index 1dcb5ddca..14b5d9f54 100644 --- a/vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.out +++ b/vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.out @@ -1,23 +1,23 @@ -[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:19] '${T.name} $input': int 1 -[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} $input': int 1 +[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:19] '${T.name} ${input}': int 1 +[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} ${input}': int 1 [vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:36] next(1): 0.0 -[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:19] '${T.name} $input': f64 1.0 -[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} $input': f64 1.0 +[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:19] '${T.name} ${input}': f64 1.0 +[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} ${input}': f64 1.0 [vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:37] next(1.0): 64.0 -[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:19] '${T.name} $input': f64 11.1 -[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} $input': f64 11.1 +[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:19] '${T.name} ${input}': f64 11.1 +[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} ${input}': f64 11.1 [vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:38] next(11.1): 64.0 -[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:15] '${T.name} $input': Score Score{ +[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:15] '${T.name} ${input}': Score Score{ ave: 23.4 } -[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} $input': Score Score{ +[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} ${input}': Score Score{ ave: 23.4 } [vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:42] next(ave): 23.4 -[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:15] '${T.name} $input': &Score &Score{ +[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:15] '${T.name} ${input}': &Score &Score{ ave: 23.4 } -[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} $input': &Score &Score{ +[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} ${input}': &Score &Score{ ave: 23.4 } [vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:43] next(&ave): 23.4 diff --git a/vlib/v/slow_tests/inout/panic_array_decompose_extra_args.out b/vlib/v/slow_tests/inout/panic_array_decompose_extra_args.out index 2ad4e4925..83dc62d65 100644 --- a/vlib/v/slow_tests/inout/panic_array_decompose_extra_args.out +++ b/vlib/v/slow_tests/inout/panic_array_decompose_extra_args.out @@ -1,8 +1,8 @@ [vlib/v/slow_tests/inout/panic_array_decompose_extra_args.vv:2] s: a [vlib/v/slow_tests/inout/panic_array_decompose_extra_args.vv:2] s: a -[vlib/v/slow_tests/inout/panic_array_decompose_extra_args.vv:6] '$s $t': a b -[vlib/v/slow_tests/inout/panic_array_decompose_extra_args.vv:10] '$s $t $u': a b c +[vlib/v/slow_tests/inout/panic_array_decompose_extra_args.vv:6] '${s} ${t}': a b +[vlib/v/slow_tests/inout/panic_array_decompose_extra_args.vv:10] '${s} ${t} ${u}': a b c [vlib/v/slow_tests/inout/panic_array_decompose_extra_args.vv:2] s: b -[vlib/v/slow_tests/inout/panic_array_decompose_extra_args.vv:6] '$s $t': b c +[vlib/v/slow_tests/inout/panic_array_decompose_extra_args.vv:6] '${s} ${t}': b c ================ V panic ================ V panic: array decompose: array has 3 elements but 4 elements are needed diff --git a/vlib/v/slow_tests/map_issue_22145_clear_test.v b/vlib/v/slow_tests/map_issue_22145_clear_test.v index 75de8ac52..67730c7bf 100644 --- a/vlib/v/slow_tests/map_issue_22145_clear_test.v +++ b/vlib/v/slow_tests/map_issue_22145_clear_test.v @@ -10,7 +10,7 @@ fn test_multiple_iterations_of_calling_clear_should_be_always_equivalent_to_assi for e in t { new[e] = e clr[e] = e - assert new.len == clr.len // , 'mismatch found after setting element: $e, on iteration ${i}' + assert new.len == clr.len // , 'mismatch found after setting element: ${e}, on iteration ${i}' } if i & 0x3FFF == 0 { println('index ${i}') diff --git a/vlib/v/slow_tests/prod_test.v b/vlib/v/slow_tests/prod_test.v index ef81ffa03..114310f20 100644 --- a/vlib/v/slow_tests/prod_test.v +++ b/vlib/v/slow_tests/prod_test.v @@ -13,7 +13,7 @@ fn test_all_v_prod_files() { options := runner.new_prod_options() mut bmark := benchmark.new_benchmark() for file in options.files { - // println('file:$file') + // println('file:${file}') bmark.step() fres := runner.run_prod_file(options.wd, options.vexec, file) or { bmark.fail() diff --git a/vlib/v/slow_tests/repl/repl_test.v b/vlib/v/slow_tests/repl/repl_test.v index 853a6f76c..2fc6f932c 100644 --- a/vlib/v/slow_tests/repl/repl_test.v +++ b/vlib/v/slow_tests/repl/repl_test.v @@ -16,13 +16,13 @@ fn test_the_v_compiler_can_be_invoked() { vcmd := '${os.quoted_path(vexec)} -version' r := os.execute_or_exit(vcmd) assert r.exit_code == 0 - // println('"$vcmd" exit_code: $r.exit_code | output: $r.output') + // println('"${vcmd}" exit_code: ${r.exit_code} | output: ${r.output}') vcmd_error := '${os.quoted_path(vexec)} nonexisting.v' r_error := os.execute(vcmd_error) if r_error.exit_code < 0 { panic(r_error.output) } - // println('"$vcmd_error" exit_code: $r_error.exit_code | output: $r_error.output') + // println('"${vcmd_error}" exit_code: ${r_error.exit_code} | output: ${r_error.output}') assert r_error.exit_code == 1 actual_error := r_error.output.trim_space() assert actual_error == "builder error: nonexisting.v doesn't exist" diff --git a/vlib/v/slow_tests/repl/runner/runner.v b/vlib/v/slow_tests/repl/runner/runner.v index 962afd6be..42dfe1ca9 100644 --- a/vlib/v/slow_tests/repl/runner/runner.v +++ b/vlib/v/slow_tests/repl/runner/runner.v @@ -28,10 +28,10 @@ pub fn full_path_to_v(dirs_in int) string { vreal := os.real_path('v') myself := os.real_path( os.executable() ) wd := os.getwd() - println('args are: $args') - println('vreal : $vreal') - println('myself : $myself') - println('wd : $wd') + println('args are: ${args}') + println('vreal : ${vreal}') + println('myself : ${myself}') + println('wd : ${wd}') */ return vexec } diff --git a/vlib/v/slow_tests/run_project_folders_test.v b/vlib/v/slow_tests/run_project_folders_test.v index f13fea2a3..9f1158a3c 100644 --- a/vlib/v/slow_tests/run_project_folders_test.v +++ b/vlib/v/slow_tests/run_project_folders_test.v @@ -30,7 +30,7 @@ fn test_v_profile_works() { t := time.ticks() res := os.execute('${os.quoted_path(vexe)} run ${os.quoted_path(folder_path)}') delta := time.ticks() - t - // eprintln('res: $res') + // eprintln('res: ${res}') assert res.exit_code == 0, 'failing res: ${res}' assert res.output.len > 0 assert res.output.contains('OK') diff --git a/vlib/v/slow_tests/valgrind/1.strings_and_arrays.v b/vlib/v/slow_tests/valgrind/1.strings_and_arrays.v index 7b4804960..9164ed83a 100644 --- a/vlib/v/slow_tests/valgrind/1.strings_and_arrays.v +++ b/vlib/v/slow_tests/valgrind/1.strings_and_arrays.v @@ -79,7 +79,7 @@ fn str_inter() { a := 10 println('a = ${a}') // foo := Foo{10, 'x' + 'x'} - // println('foo = $foo') // TODO + // println('foo = ${foo}') // TODO } fn str_replace() { @@ -163,7 +163,7 @@ fn option_str() { s := 'query: select' // option fn args must be freed pos2 := opt('query:${q}') or { - // pos := s.index('query: $q') or { + // pos := s.index('query: ${q}') or { println('exiting') return } diff --git a/vlib/v/tests/builtin_strings_and_interpolation/str_gen_test.v b/vlib/v/tests/builtin_strings_and_interpolation/str_gen_test.v index dc4a7e56f..c0b333103 100644 --- a/vlib/v/tests/builtin_strings_and_interpolation/str_gen_test.v +++ b/vlib/v/tests/builtin_strings_and_interpolation/str_gen_test.v @@ -382,7 +382,7 @@ fn test_option_struct() { // fn test_struct_with_option() { // w := OptionWrapper{} -// assert '$w' == 'OptionWrapper{\n x: Option(error: \'\')\n}' +// assert '${w}' == 'OptionWrapper{\n x: Option(error: \'\')\n}' // } /* @@ -393,7 +393,7 @@ struct OptionWrapperInt { fn test_struct_with_option() { w := OptionWrapperInt{} - assert '$w' == 'OptionWrapperInt{\n x: Option(error: \'\')\n}' + assert '${w}' == 'OptionWrapperInt{\n x: Option(error: \'\')\n}' } */ diff --git a/vlib/v/tests/builtin_strings_and_interpolation/string_interpolation_with_inner_quotes_test.v b/vlib/v/tests/builtin_strings_and_interpolation/string_interpolation_with_inner_quotes_test.v index c706576eb..343909e94 100644 --- a/vlib/v/tests/builtin_strings_and_interpolation/string_interpolation_with_inner_quotes_test.v +++ b/vlib/v/tests/builtin_strings_and_interpolation/string_interpolation_with_inner_quotes_test.v @@ -17,17 +17,17 @@ fn test_string_interp_with_inner_quotes() { println("abc ${f(123, "def")} xyz") assert "abc ${f(123, "def")} xyz" == 'abc label def: 123 xyz' - println("abc ${f(123, "$x $x")} xyz") - assert "abc ${f(123, "$x $x")} xyz" == 'abc label hi hi: 123 xyz' + println("abc ${f(123, "${x} ${x}")} xyz") + assert "abc ${f(123, "${x} ${x}")} xyz" == 'abc label hi hi: 123 xyz' - println('abc ${f(123, '$x $x')} xyz') - assert 'abc ${f(123, '$x $x')} xyz' == 'abc label hi hi: 123 xyz' + println('abc ${f(123, '${x} ${x}')} xyz') + assert 'abc ${f(123, '${x} ${x}')} xyz' == 'abc label hi hi: 123 xyz' - println('abc ${f(123, "$x $x")} xyz') - assert 'abc ${f(123, "$x $x")} xyz' == 'abc label hi hi: 123 xyz' + println('abc ${f(123, "${x} ${x}")} xyz') + assert 'abc ${f(123, "${x} ${x}")} xyz' == 'abc label hi hi: 123 xyz' - println("abc ${f(123, '$x $x')} xyz") - assert "abc ${f(123, '$x $x')} xyz" == 'abc label hi hi: 123 xyz' + println("abc ${f(123, '${x} ${x}')} xyz") + assert "abc ${f(123, '${x} ${x}')} xyz" == 'abc label hi hi: 123 xyz' println("abc ${f(123, "${x} ${x}")} xyz") assert "abc ${f(123, "${x} ${x}")} xyz" == 'abc label hi hi: 123 xyz' diff --git a/vlib/v/tests/enums/enum_test.v b/vlib/v/tests/enums/enum_test.v index 88c9306e3..bb3f97d41 100644 --- a/vlib/v/tests/enums/enum_test.v +++ b/vlib/v/tests/enums/enum_test.v @@ -125,8 +125,8 @@ fn test_typed_enum() { // expr = i /* match expr { - IntExpr(n) { println('INT $n') } - BoolExpr(b) { println('BOOL $b') } + IntExpr(n) { println('INT ${n}') } + BoolExpr(b) { println('BOOL ${b}') } } */ } @@ -138,11 +138,11 @@ fn test_typed_enum() { // val = expr; if (expr.typ == IntExpr_type) { int n = (int)expr.obj; - println('INT $n'); + println('INT ${n}'); } else if (expr.typ == BoolExpr_type) { int b = (bool)expr.obj; - println('BOOL $b'); + println('BOOL ${b}'); } } */ diff --git a/vlib/v/tests/fns/fn_expecting_ref_but_returning_struct_time_module_test.v b/vlib/v/tests/fns/fn_expecting_ref_but_returning_struct_time_module_test.v index 38abcca9b..47083b251 100644 --- a/vlib/v/tests/fns/fn_expecting_ref_but_returning_struct_time_module_test.v +++ b/vlib/v/tests/fns/fn_expecting_ref_but_returning_struct_time_module_test.v @@ -13,7 +13,7 @@ fn test_call_fn_that_requires_reference_with_function_that_returns_a_struct_manu // v should produce temporary intermediate variables in chained calls: fn test_call_fn_that_requires_reference_with_function_that_returns_a_struct_chained() { res := (tmisc.random().unix()) - println('res: $res') + println('res: ${res}') assert true } */ diff --git a/vlib/v/tests/fns/fn_variadic_test.v b/vlib/v/tests/fns/fn_variadic_test.v index 38b003066..06a1b41f8 100644 --- a/vlib/v/tests/fns/fn_variadic_test.v +++ b/vlib/v/tests/fns/fn_variadic_test.v @@ -25,7 +25,7 @@ fn test_fn_variadic() { fn variadic_test_generic[T](a int, b ...T) T { b1 := b[0] b2 := b[1] - return '$a $b1 $b2' + return '${a} ${b1} ${b2}' } fn test_fn_variadic_generic() { diff --git a/vlib/v/tests/run_v_code_from_stdin_test.v b/vlib/v/tests/run_v_code_from_stdin_test.v index 81d34ddfb..2f187d33e 100644 --- a/vlib/v/tests/run_v_code_from_stdin_test.v +++ b/vlib/v/tests/run_v_code_from_stdin_test.v @@ -17,12 +17,12 @@ fn pipe_to_v_run() ! { } cat_cmd := if os.user_os() == 'windows' { 'cmd /c type' } else { 'cat' } tmp_v_file := os.join_path(os.real_path(vtmp_folder), 'generated_piped_program.v') - // eprintln('>>> tmp_v_file: $tmp_v_file') + // eprintln('>>> tmp_v_file: ${tmp_v_file}') os.write_file(tmp_v_file, 'println(1 + 3)\nprintln("hello")\n')! assert os.is_file(tmp_v_file) cmd := '${cat_cmd} ${os.quoted_path(tmp_v_file)} | ${os.quoted_path(vexe)} run -' res := os.execute(cmd) - // eprintln('>> cmd: $cmd | res: $res') + // eprintln('>> cmd: ${cmd} | res: ${res}') assert res.exit_code == 0 assert res.output.replace('\r', '').trim_space().split('\n') == ['4', 'hello'] os.rm(tmp_v_file) or { panic(err) } diff --git a/vlib/v/tests/skip_unused/assert_with_extra_message_works_test.run.out b/vlib/v/tests/skip_unused/assert_with_extra_message_works_test.run.out index 4b4d1f7e1..6c49f0f5f 100644 --- a/vlib/v/tests/skip_unused/assert_with_extra_message_works_test.run.out +++ b/vlib/v/tests/skip_unused/assert_with_extra_message_works_test.run.out @@ -1,5 +1,5 @@ vlib/v/tests/skip_unused/assert_with_extra_message_works_test.vv:7: fn test_interpolation_with_assert_that_has_extra_message - > assert 'abc$i' != 'abc77', my_failure_message(i) + > assert 'abc${i}' != 'abc77', my_failure_message(i) Left value (len: 5): `abc77` Right value (len: 5): `abc77` Message: the assert failed :-|, i: 77 diff --git a/vlib/v/tests/structs/struct_allow_both_field_defaults_and_skip_flag_test.v b/vlib/v/tests/structs/struct_allow_both_field_defaults_and_skip_flag_test.v index 7c99bed26..ffcb6ae69 100644 --- a/vlib/v/tests/structs/struct_allow_both_field_defaults_and_skip_flag_test.v +++ b/vlib/v/tests/structs/struct_allow_both_field_defaults_and_skip_flag_test.v @@ -8,7 +8,7 @@ struct Foo { fn test_check_field_default_expr() { f := Foo{} - // eprintln('f: $f') + // eprintln('f: ${f}') assert f.bar == -112233 assert f.x == 123 assert f.y == 456 @@ -17,7 +17,7 @@ fn test_check_field_default_expr() { fn test_check_field_skip_attribute() { f := Foo{} s := json.encode(f) - // eprintln('f: $f') - // eprintln('s: $s') + // eprintln('f: ${f}') + // eprintln('s: ${s}') assert s == '{"x":123,"y":456}' } diff --git a/vlib/v/tests/sumtypes/sumtype_str_for_subtypes_with_str_test.v b/vlib/v/tests/sumtypes/sumtype_str_for_subtypes_with_str_test.v index 5402c2c38..465e5b661 100644 --- a/vlib/v/tests/sumtypes/sumtype_str_for_subtypes_with_str_test.v +++ b/vlib/v/tests/sumtypes/sumtype_str_for_subtypes_with_str_test.v @@ -1,7 +1,7 @@ // Test whether a sumtype that has multiple subtypes, // some with custom .str() methods, can be converted to a string, // i.e. whether its own autogenerated .str() method will work. -// Note: Dictionary.str() calls $v.str() in the string interpolation, +// Note: Dictionary.str() calls ${v.str()} in the string interpolation, // which in turn can call Dictionary.str(), i.e. they are mutually // recursive. type Object = Dictionary | Stream | bool | f32 | int | string diff --git a/vlib/v/token/keywords_matcher_trie.v b/vlib/v/token/keywords_matcher_trie.v index 1a02084ff..01013b4a4 100644 --- a/vlib/v/token/keywords_matcher_trie.v +++ b/vlib/v/token/keywords_matcher_trie.v @@ -67,7 +67,7 @@ pub fn (mut km KeywordsMatcherTrie) add_word(word string, value int) { } // add more top level slots, if needed: for km.nodes.len < wlen + 1 { - // eprintln('>>>>>>>>>>>>>> appending more nodes for word: $word | value: $value | km.nodes.len: $km.nodes.len | wlen: $wlen') + // eprintln('>>>>>>>>>>>>>> appending more nodes for word: ${word} | value: ${value} | km.nodes.len: ${km.nodes.len} | wlen: ${wlen}') km.nodes << unsafe { &TrieNode(nil) } } if km.nodes[wlen] == unsafe { nil } { @@ -95,7 +95,7 @@ pub fn new_keywords_matcher_trie[T](kw_map map[string]T) KeywordsMatcherTrie { } // dump(km.min_len) // dump(km.max_len) - // for idx,x in km.nodes { if x != unsafe { nil } { eprintln('>> idx: $idx | ${ptr_str(x)}') } } + // for idx,x in km.nodes { if x != unsafe { nil } { eprintln('>> idx: ${idx} | ${ptr_str(x)}') } } return km } @@ -142,7 +142,7 @@ pub fn (mut node TrieNode) add_word(word string, value int, word_idx int) { return } first := u8(word[word_idx]) - // eprintln('>> node: ${ptr_str(node)} | first: $first | word_idx: $word_idx') + // eprintln('>> node: ${ptr_str(node)} | first: ${first} | word_idx: ${word_idx}') mut child_node := node.children[first] if child_node == unsafe { nil } { child_node = new_trie_node() diff --git a/vlib/v/token/token.v b/vlib/v/token/token.v index 1e3b08a77..a7ae53c8b 100644 --- a/vlib/v/token/token.v +++ b/vlib/v/token/token.v @@ -24,7 +24,7 @@ pub enum Kind { name // user number // 123 string // 'foo' - str_inter // 'name=$user.name' + str_inter // 'name=${user.name}' chartoken // `A` - rune plus // + minus // - diff --git a/vlib/v/util/util.v b/vlib/v/util/util.v index 0d1d8e96d..4a3f4d390 100644 --- a/vlib/v/util/util.v +++ b/vlib/v/util/util.v @@ -262,7 +262,7 @@ pub fn should_recompile_tool(vexe string, tool_source string, tool_name string, } single_file_recompile := should_recompile_tool(vexe, newest_sfile, tool_name, tool_exe) - // eprintln('>>> should_recompile_tool: tool_source: $tool_source | $single_file_recompile | $newest_sfile') + // eprintln('>>> should_recompile_tool: tool_source: ${tool_source} | ${single_file_recompile} | ${newest_sfile}') return single_file_recompile } // TODO: Caching should be done on the `vlib/v` level. @@ -348,7 +348,7 @@ pub fn cached_read_source_file(path string) !string { return error('memory source file cache cleared') } - // eprintln('>> cached_read_source_file path: $path') + // eprintln('>> cached_read_source_file path: ${path}') if res := cache.sources[path] { // eprintln('>> cached') $if trace_cached_read_source_file_cached ? { @@ -356,7 +356,7 @@ pub fn cached_read_source_file(path string) !string { } return res } - // eprintln('>> not cached | cache.sources.len: $cache.sources.len') + // eprintln('>> not cached | cache.sources.len: ${cache.sources.len}') $if trace_cached_read_source_file_not_cached ? { println('cached_read_source_file not cached ${path}') } diff --git a/vlib/v/vcache/vcache_test.v b/vlib/v/vcache/vcache_test.v index 6ac4d82ed..2b8657cde 100644 --- a/vlib/v/vcache/vcache_test.v +++ b/vlib/v/vcache/vcache_test.v @@ -14,7 +14,7 @@ fn check_cache_entry_fpath_invariants(x string, extension string) { fn testsuite_begin() { os.setenv('VCACHE', vcache_folder, true) - // eprintln('testsuite_begin, vcache_folder = $vcache_folder') + // eprintln('testsuite_begin, vcache_folder = ${vcache_folder}') os.rmdir_all(vcache_folder) or {} vcache.new_cache_manager([]) assert os.is_dir(vcache_folder) diff --git a/vlib/v2/ast/ast.v b/vlib/v2/ast/ast.v index 4d19123b8..6aa99a937 100644 --- a/vlib/v2/ast/ast.v +++ b/vlib/v2/ast/ast.v @@ -537,7 +537,7 @@ pub fn (se SelectorExpr) leftmost() Expr { } // pub fn (expr Expr) str() string { -// return 'Expr.str() - $expr.type_name()' +// return 'Expr.str() - ${expr.type_name()}' // } pub fn (se SelectorExpr) name() string { diff --git a/vlib/v2/parser/parser.v b/vlib/v2/parser/parser.v index bf4b1d990..2f4beaeda 100644 --- a/vlib/v2/parser/parser.v +++ b/vlib/v2/parser/parser.v @@ -204,7 +204,7 @@ fn (mut p Parser) top_stmt() ast.Stmt { } fn (mut p Parser) stmt() ast.Stmt { - // p.log('STMT: $p.tok - $p.file.name:$p.line') + // p.log('STMT: ${p.tok} - ${p.file.name}:${p.line}') match p.tok { .dollar { return p.comptime_stmt() @@ -414,7 +414,7 @@ fn (mut p Parser) complete_simple_stmt(expr ast.Expr, expecting_semi bool) ast.S } fn (mut p Parser) expr(min_bp token.BindingPower) ast.Expr { - // p.log('EXPR: $p.tok - $p.line') + // p.log('EXPR: ${p.tok} - ${p.line}') mut lhs := ast.empty_expr match p.tok { .char, .key_false, .key_true, .number { @@ -1242,7 +1242,7 @@ fn (mut p Parser) expr(min_bp token.BindingPower) ast.Expr { break } } - // p.log('returning: $p.tok') + // p.log('returning: ${p.tok}') return lhs } @@ -1388,7 +1388,7 @@ fn (mut p Parser) expr_list() []ast.Expr { // expr := p.expr(.lowest) // // TODO: is this the best place/way to handle this? // if expr is ast.EmptyExpr { - // p.error('expecting expr, got `$p.tok`') + // p.error('expecting expr, got `${p.tok}`') // } // exprs << expr if p.tok != .comma { @@ -1470,7 +1470,7 @@ fn (mut p Parser) attributes() []ast.Attribute { } break } - // p.log('ast.Attribute: $name') + // p.log('ast.Attribute: ${name}') return attributes } @@ -1736,7 +1736,7 @@ fn (mut p Parser) import_stmt() ast.ImportStmt { } p.expect(.rcbr) } - // p.log('ast.ImportStmt: $name as $alias') + // p.log('ast.ImportStmt: ${name} as ${alias}') return ast.ImportStmt{ name: name alias: alias @@ -1901,7 +1901,7 @@ fn (mut p Parser) fn_decl(is_public bool, attributes []ast.Attribute) ast.FnDecl } } typ := p.fn_type() - // p.log('ast.FnDecl: $name $p.lit - $p.tok ($p.lit) - $p.tok_next_') + // p.log('ast.FnDecl: ${name} ${p.lit} - ${p.tok} (${p.lit}) - ${p.tok_next_}') // also check line for better error detection stmts := if p.tok == .lcbr { p.block() @@ -2034,7 +2034,7 @@ fn (mut p Parser) enum_decl(is_public bool, attributes []ast.Attribute) ast.Enum } else { ast.empty_expr } - // p.log('ast.EnumDecl: $name') + // p.log('ast.EnumDecl: ${name}') p.expect(.lcbr) mut fields := []ast.FieldDecl{} for p.tok != .rcbr { @@ -2171,7 +2171,7 @@ fn (mut p Parser) struct_decl(is_public bool, attributes []ast.Attribute) ast.St p.next() language := p.decl_language() name := p.expect_name() - // p.log('ast.StructDecl: $name') + // p.log('ast.StructDecl: ${name}') generic_params := if p.tok == .lsbr { p.generic_list() } else { []ast.Expr{} } // probably C struct decl with no body or {} if p.tok != .lcbr { @@ -2450,7 +2450,7 @@ fn (mut p Parser) type_decl(is_public bool) ast.TypeDecl { name := p.expect_name() generic_params := if p.tok == .lsbr { p.generic_list() } else { []ast.Expr{} } - // p.log('ast.TypeDecl: $name') + // p.log('ast.TypeDecl: ${name}') p.expect(.assign) typ := p.expect_type() diff --git a/vlib/v2/parser/type.v b/vlib/v2/parser/type.v index 499cb9349..aa8e6ae11 100644 --- a/vlib/v2/parser/type.v +++ b/vlib/v2/parser/type.v @@ -169,7 +169,7 @@ fn (mut p Parser) try_type() ast.Expr { }) } else { - // return error('expecting type, got `$p.tok`') + // return error('expecting type, got `${p.tok}`') return ast.empty_expr } } diff --git a/vlib/v2/tests/syntax.v_ b/vlib/v2/tests/syntax.v_ index 16a41d600..1b0813542 100644 --- a/vlib/v2/tests/syntax.v_ +++ b/vlib/v2/tests/syntax.v_ @@ -144,24 +144,24 @@ fn fn_with_comment_and_attribute_a() {} [attribute_c: 'attribute_c_val'] [attribute_d] fn fn_a(arg_a string, arg_b int) int { - println('fn_a($arg_a, $arg_b)') + println('fn_a(${arg_a}, ${arg_b})') return 1 } // TODO: error on missing name/type // fn fn_b(arg_a string, arg_b, arg_c, arg_d int) int { fn fn_b(arg_a string, arg_b int, arg_c int, arg_d int) int { - println('fn_b($arg_a, $arg_b, $arg_c, $arg_d)') + println('fn_b(${arg_a}, ${arg_b}, ${arg_c}, ${arg_d})') return 1 } fn fn_c(arg_a [][]StructA, arg_b [4]StructA) [][]StructA { - println('fn_b($arg_a, $arg_b)') + println('fn_b(${arg_a}, ${arg_b})') return arg_a } fn fn_d(arg_a GenericStructA[int], arg_b moda.GenericStructA[int]) { - println('fn_d($arg_a, $arg_b)') + println('fn_d(${arg_a}, ${arg_b})') } fn C.fn_d(GenericStructA[int], moda.GenericStructA[int]) @@ -219,7 +219,7 @@ fn fn_arg_struct_int_a(arg_a StructA, arg_b int) { } fn (rec &StructA) method_a(arg_a string, arg_b int) int { - println('StructA.method_a($arg_a, $arg_b)') + println('StructA.method_a(${arg_a}, ${arg_b})') return 1 } @@ -237,7 +237,7 @@ fn channel_test(arg_a chan string) { fn spawn_test() { t := spawn fn() { for i in 0..100 { - println('$i...') + println('${i}...') } }() t.wait() @@ -389,10 +389,10 @@ fn main_a() { println(val) } if res_a := fn_optional_a() { - println('if guard: $res_a') + println('if guard: ${res_a}') } if res_a, res_b := fn_multi_return_optional_a() { - println('if guard: $res_a, $res_b') + println('if guard: ${res_a}, ${res_b}') } if res_a, res_b := fn_optional_a(), fn_optional_b() { println('if guard: ${res_a}, ${res_b}') @@ -417,13 +417,13 @@ fn main_a() { println(1) } if a == 1 { - println('1 a == $s') + println('1 a == ${s}') } else if a == 2 { - println('2 a == $s') + println('2 a == ${s}') } else { - println('a == $s') + println('a == ${s}') } if (if a > 0 { 1 @@ -497,10 +497,10 @@ fn main_a() { println(a) } for a, b := 0, 1; a < 4; a++ { - println('$a - $b') + println('${a} - ${b}') } for a, b, c, d := 0, 1, 2, 3; a < 4; a++ { - println('$a - $b') + println('${a} - ${b}') } // currently erroring in this case // for a := 1 {} diff --git a/vlib/v2/tests/syntax_generics.v_ b/vlib/v2/tests/syntax_generics.v_ index a2effd281..3bafcfacb 100644 --- a/vlib/v2/tests/syntax_generics.v_ +++ b/vlib/v2/tests/syntax_generics.v_ @@ -12,12 +12,12 @@ struct GenericStructB[T,U] { } fn fn_generic_a[T](param_a T, param_b string, param_c int) int { - println('fn_generic_a: $param_a.type, $param_b.type, $param_c.type') + println('fn_generic_a: ${param_a.type}, ${param_b.type}, ${param_c.type}') return 1 } fn fn_generic_b[T,Y](param_a T, param_b Y) int { - println('fn_generic_a: $param_a.type, $param_b.type') + println('fn_generic_a: ${param_a.type}, ${param_b.type}') } fn fn_generic_c[fn[U,I](U, I) U, Y](param_a T, param_b Y) int { diff --git a/vlib/v2/token/position.v b/vlib/v2/token/position.v index 45a304a29..37372d705 100644 --- a/vlib/v2/token/position.v +++ b/vlib/v2/token/position.v @@ -42,10 +42,10 @@ pub fn FileSet.new() &FileSet { // TODO: pub fn (mut fs FileSet) add_file(filename string, base_ int, size int) &File { - // eprintln('>>> add_file fs: ${voidptr(fs)} | filename: $filename | base_: $base_ | size: $size') + // eprintln('>>> add_file fs: ${voidptr(fs)} | filename: ${filename} | base_: ${base_} | size: ${size}') mut base := if base_ < 0 { fs.base } else { base_ } - // eprintln('>>> add_file fs: ${voidptr(fs)} | base: ${base:10} | fs.base: $fs.base | base_: ${base_:10} | size: ${size:10} | filename: $filename') + // eprintln('>>> add_file fs: ${voidptr(fs)} | base: ${base:10} | fs.base: ${fs.base} | base_: ${base_:10} | size: ${size:10} | filename: ${filename}') if base < fs.base { panic('invalid base ${base} (should be >= ${fs.base}') @@ -79,7 +79,7 @@ fn search_files(files []&File, x int) int { mut min, mut max := 0, files.len for min < max { mid := (min + max) / 2 - // println('# min: $min, mid: $mid, max: $max') + // println('# min: ${min}, mid: ${mid}, max: ${max}') if files[mid].base <= x { min = mid + 1 } else { @@ -92,7 +92,7 @@ fn search_files(files []&File, x int) int { // for i := files.len-1; i>=0; i-- { // file := files[i] // if file.base < x && x <= file.base + file.size { - // // println('found file for pos `$x` i = $i:') + // // println('found file for pos `${x}` i = ${i}:') // // dump(file) // return i // } @@ -101,7 +101,7 @@ fn search_files(files []&File, x int) int { } pub fn (mut fs FileSet) file(pos Pos) &File { - // eprintln('>>>>>>>>> file fs: ${voidptr(fs)} | pos: $pos') + // eprintln('>>>>>>>>> file fs: ${voidptr(fs)} | pos: ${pos}') // lock fs.files // last file @@ -182,7 +182,7 @@ pub fn (f &File) find_line(pos int) int { mut min, mut max := 0, f.line_offsets.len for min < max { mid := (min + max) / 2 - // println('# min: $min, mid: $mid, max: $max') + // println('# min: ${min}, mid: ${mid}, max: ${max}') if f.line_offsets[mid] <= pos { min = mid + 1 } else { diff --git a/vlib/v2/types/checker.v b/vlib/v2/types/checker.v index d282ad6de..557c161a6 100644 --- a/vlib/v2/types/checker.v +++ b/vlib/v2/types/checker.v @@ -293,7 +293,7 @@ fn (mut c Checker) decl(decl ast.Stmt) { match decl { ast.ConstDecl { for field in decl.fields { - // c.log('const decl: $field.name') + // c.log('const decl: ${field.name}') obj := Const{ mod: c.mod name: field.name @@ -304,7 +304,7 @@ fn (mut c Checker) decl(decl ast.Stmt) { // delay those. or keep deferring until type is known otherwise error // work out best way to do this, and use same approach for everything c.later(fn [mut c, field] () { - // c.log('updating const $field.name type') + // c.log('updating const ${field.name} type') const_type := c.expr(field.value) if mut cd := c.scope.lookup(field.name) { if mut cd is Const { @@ -347,14 +347,14 @@ fn (mut c Checker) decl(decl ast.Stmt) { // // field_type := c.expr(field.typ) // // if field.name == 'g_timers' { // // // dump(field.typ) - // // panic('# g_timers: $field_type.name()') + // // panic('# g_timers: ${field_type.name()}') // // } // obj := Global{ // name: field.name // // typ: c.expr(field.typ) // typ: c.expr(field.value) // } - // // c.log('GlobalDecl: $field.name - $obj.typ.type_name()') + // // c.log('GlobalDecl: ${field.name} - ${obj.typ.type_name()}') // c.scope.insert(field.name, obj) // } } @@ -384,11 +384,11 @@ fn (mut c Checker) decl(decl ast.Stmt) { }, .struct_decl) } ast.StructDecl { - // c.log(' # StructDecl: $decl.name') + // c.log(' # StructDecl: ${decl.name}') // TODO: clean this up struct_decl := decl c.later(fn [mut c, struct_decl] () { - // c.log('add fields: $struct_decl.name') + // c.log('add fields: ${struct_decl.name}') mut fields := []Field{} for field in struct_decl.fields { fields << Field{ @@ -425,7 +425,7 @@ fn (mut c Checker) decl(decl ast.Stmt) { // typ := Type(obj) // c.scope.insert(struct_decl.name, typ) }, .struct_decl) - // c.log('struct decl: $decl.name') + // c.log('struct decl: ${decl.name}') obj := Struct{ name: decl.name // fields: [Field{name: 'len', typ: ast.Ident{name: 'int'}}] @@ -579,7 +579,7 @@ fn (mut c Checker) expr(expr ast.Expr) Type { return c.expr(expr.typ) } ast.BasicLiteral { - // c.log('ast.BasicLiteral: $expr.kind.str(): $expr.value') + // c.log('ast.BasicLiteral: ${expr.kind.str()}: ${expr.value}') match expr.kind { .char { return char_ @@ -602,7 +602,7 @@ fn (mut c Checker) expr(expr ast.Expr) Type { } } ast.CallOrCastExpr { - // c.log('CallOrCastExpr: $lhs_type.name()') + // c.log('CallOrCastExpr: ${lhs_type.name()}') // lhs_type := c.expr(expr.lhs) // // call // if lhs_type is FnType { @@ -684,7 +684,7 @@ fn (mut c Checker) expr(expr ast.Expr) Type { return c.expr(c.resolve_generic_arg_or_index_expr(expr)) } ast.Ident { - // c.log('ident: $expr.name') + // c.log('ident: ${expr.name}') obj := c.ident(expr) typ := obj.typ() // TODO: @@ -811,7 +811,7 @@ fn (mut c Checker) expr(expr ast.Expr) Type { } ast.ModifierExpr { // if expr.expr !is ast.Ident && expr.expr !is ast.Type { - // panic('not ident: $expr.expr.type_name()') + // panic('not ident: ${expr.expr.type_name()}') // } return c.expr(expr.expr) } @@ -1060,7 +1060,7 @@ fn (mut c Checker) stmt(stmt ast.Stmt) { // } ast.GlobalDecl { for field in stmt.fields { - // c.log('GlobalDecl: $field.name - $obj.typ.type_name()') + // c.log('GlobalDecl: ${field.name} - ${obj.typ.type_name()}') field_type := if field.typ !is ast.EmptyExpr { c.expr(field.typ) } else { @@ -1125,7 +1125,7 @@ fn (mut c Checker) stmt(stmt ast.Stmt) { c.close_scope() } ast.ImportStmt { - // c.log('import: $stmt.name as $stmt.alias') + // c.log('import: ${stmt.name} as ${stmt.alias}') } ast.ReturnStmt { c.log('ReturnStmt:') @@ -1223,7 +1223,7 @@ fn (mut c Checker) assign_stmt(stmt ast.AssignStmt, unwrap_optional bool) { } rhs_type := c.expr(rx) // if t := expected_type { - // c.log('AssignStmt: setting expected_type to: $t.name()') + // c.log('AssignStmt: setting expected_type to: ${t.name()}') // } else { // c.log('AssignStmt: setting expected_type to: none') // } @@ -1382,14 +1382,14 @@ fn (mut c Checker) extract_smartcasts(expr ast.Expr) ([]ast.Expr, []Type) { } fn (mut c Checker) fn_decl(decl ast.FnDecl) { - // c.log('ast.FnDecl: $decl.name: $c.file.name') + // c.log('ast.FnDecl: ${decl.name}: ${c.file.name}') // c.log('return type:') // c.expr(decl.typ.return_type) mut prev_scope := c.scope c.open_scope() // mut fn_scope := c.scope // if decl.typ.generic_params.len > 0 { - // eprintln('## GENERIC FN DECL: $decl.name') + // eprintln('## GENERIC FN DECL: ${decl.name}') // } mut typ := Type(c.fn_type(decl.typ, FnTypeAttribute.from_ast_attributes(decl.attributes))) // Heap-allocate Fn so pointer stored in env.methods remains valid @@ -1455,10 +1455,10 @@ fn (mut c Checker) fn_decl(decl ast.FnDecl) { // if fn_decl.typ.generic_params.len > 0 { // panic('GENERIC FN') // } - // eprintln('@@ FnDecl: $fn_decl.name - $fn_decl.typ.generic_params.len') + // eprintln('@@ FnDecl: ${fn_decl.name} - ${fn_decl.typ.generic_params.len}') if typ is FnType { if fn_decl.typ.generic_params.len > 0 { - // eprintln('## DEFERRED GENERIC FN: $fn_decl.name - $typ.generic_params.len') + // eprintln('## DEFERRED GENERIC FN: ${fn_decl.name} - ${typ.generic_params.len}') // eprintln('FnType:') // eprintln(typ) generic_types := c.env.generic_types[fn_decl.name] or { @@ -1811,7 +1811,7 @@ fn (mut c Checker) call_expr(expr ast.CallExpr) Type { mut fn_ := c.expr(lhs_expr) // fn_ := c.expr(expr.lhs) c.expecting_method = expecting_method - // c.log('call expr: $fn_.type_name() - $fn_.name() - ${lhs_expr.type_name()}') + // c.log('call expr: ${fn_.type_name()} - ${fn_.name()} - ${lhs_expr.type_name()}') // if expr.lhs is PrefixExpr { // xpr.op @@ -1865,7 +1865,7 @@ fn (mut c Checker) call_expr(expr ast.CallExpr) Type { if fn_.generic_params.len > 0 { // file := c.file_set.file(expr.pos) // pos := file.position(expr.pos) - // eprintln('GENERIC CALL: $expr.lhs.name() - $expr.pos - $file.name:$pos.line') + // eprintln('GENERIC CALL: ${expr.lhs.name()} - ${expr.pos} - ${file.name}:${pos.line}') mut generic_type_map := map[string]Type{} // generic types provided `[int, string]` if lhs_expr is ast.GenericArgs { @@ -1877,7 +1877,7 @@ fn (mut c Checker) call_expr(expr ast.CallExpr) Type { generic_types << generic_type generic_type_map[generic_param] = generic_type } - // eprintln('GENERIC TYPES: $expr.lhs.name()') + // eprintln('GENERIC TYPES: ${expr.lhs.name()}') // dump(generic_types) } // infer generic types from args @@ -1885,7 +1885,7 @@ fn (mut c Checker) call_expr(expr ast.CallExpr) Type { // TODO: move above (to be done globally) // once error is fixed mut arg_types := []Type{} - // eprintln('INFERRED GENERIC TYPES: $expr.lhs.name()') + // eprintln('INFERRED GENERIC TYPES: ${expr.lhs.name()}') for i, arg in expr.args { param := fn_.params[i] arg_type := c.expr(arg).typed_default() @@ -1897,15 +1897,15 @@ fn (mut c Checker) call_expr(expr ast.CallExpr) Type { c.error_with_pos(err.msg(), expr.pos) } // if param.typ !is NamedType { - // eprintln('Generic argument: $param.typ.name() - $arg_type.name()') - // eprintln('should be NamedType but got $param.typ.name()') + // eprintln('Generic argument: ${param.typ.name()} - ${arg_type.name()}') + // eprintln('should be NamedType but got ${param.typ.name()}') // } } } - // eprintln('## GENERIC TYPE MAP: $expr.lhs.name()') + // eprintln('## GENERIC TYPE MAP: ${expr.lhs.name()}') // eprintln('========================') // for k,v in generic_type_map { - // eprintln(' * $k -> $v') + // eprintln(' * ${k} -> ${v}') // } // eprintln('========================') // if expr.lhs is ast.Ident { @@ -2120,12 +2120,12 @@ fn (mut c Checker) selector_expr(expr ast.SelectorExpr) Type { c.log('## selector_expr') // file := c.file_set.file(expr.pos) // pos := file.position(expr.pos) - // c.log('${expr.name()} - $expr.rhs.name') + // c.log('${expr.name()} - ${expr.rhs.name}') // println('selector_expr: ${expr.rhs.name} - ${file.name}:${pos.line} - ${pos.column}') // TODO: check todo in scope.v if expr.lhs is ast.Ident || expr.lhs is ast.SelectorExpr { - // println('looking for smartcast $expr.name()') + // println('looking for smartcast ${expr.name()}') if cast_type := c.scope.lookup_field_smartcast(expr.name()) { // println('## 1 found smartcast for ${expr.name()} - ${cast_type.type_name()} - ${cast_type.name()} - ${expr.rhs.name}') return cast_type @@ -2140,7 +2140,7 @@ fn (mut c Checker) selector_expr(expr ast.SelectorExpr) Type { if expr.lhs is ast.Ident { lhs_obj := c.ident(expr.lhs) - // c.log('LHS.RHS: $expr.lhs.name . $expr.rhs.name - $lhs_obj.typ().name()') + // c.log('LHS.RHS: ${expr.lhs.name} . ${expr.rhs.name} - ${lhs_obj.typ().name()}') match lhs_obj { Const { return c.find_field_or_method(lhs_obj.typ, expr.rhs.name) or { @@ -2158,7 +2158,7 @@ fn (mut c Checker) selector_expr(expr ast.SelectorExpr) Type { rhs_obj := mod_scope.lookup_parent(expr.rhs.name, expr.rhs.pos) or { // TODO: proper if expr.lhs.name == 'C' { - // c.log('assuming C constant: $expr.lhs.name . $expr.rhs.name') + // c.log('assuming C constant: ${expr.lhs.name} . ${expr.rhs.name}') return int_ } mod_scope.print(true) @@ -2172,7 +2172,7 @@ fn (mut c Checker) selector_expr(expr ast.SelectorExpr) Type { } } // SmartCastSelector { - // c.log('@@ found smart cast selector: $expr.rhs.name') + // c.log('@@ found smart cast selector: ${expr.rhs.name}') // if expr.rhs.name == lhs_obj.field { // return lhs_obj.cast_type // // return c.find_field_or_method(lhs_obj.cast_type, expr.rhs.name) or { c.error_with_pos(err.msg(), expr.pos) } @@ -2186,7 +2186,7 @@ fn (mut c Checker) selector_expr(expr ast.SelectorExpr) Type { } } // else { - // panic('unexpected expr.lhs: $expr.lhs.type_name()') + // panic('unexpected expr.lhs: ${expr.lhs.type_name()}') // } // TODO: this will be removed // unset when checking lhs, only needed for rightmost selector @@ -2223,13 +2223,13 @@ fn (mut c Checker) find_field_or_method(t Type, name string) !Type { mut builtin_scope := c.get_module_scope('builtin', universe) at := builtin_scope.lookup_parent('array', 0) or { panic('missing builtin array type') } at_type := at.typ() - // c.log('ARRAY: looking for field or method $name on $t.name()') + // c.log('ARRAY: looking for field or method ${name} on ${t.name()}') // // dump(t) if field_or_method_type := c.find_field_or_method(at_type, name) { c.log('found ${name}') if field_or_method_type is FnType { if name in ['clone', 'map', 'filter'] { - // c.log('SNEAKY: $t.name()') + // c.log('SNEAKY: ${t.name()}') // return t return FnType{ ...field_or_method_type @@ -2302,7 +2302,7 @@ fn (mut c Checker) find_field_or_method(t Type, name string) !Type { mut builtin_scope := c.get_module_scope('builtin', universe) at := builtin_scope.lookup_parent('map', 0) or { panic('missing builtin map type') } at_type := at.typ() - // c.log('MAP: looking for field or method $name on $t.name()') + // c.log('MAP: looking for field or method ${name} on ${t.name()}') if field_or_method_type := c.find_field_or_method(at_type, name) { if name == 'keys' { if field_or_method_type is FnType { @@ -2340,7 +2340,7 @@ fn (mut c Checker) find_field_or_method(t Type, name string) !Type { } Struct { for field in t.fields { - // c.log('comparing field $field.name with $name for $t.name') + // c.log('comparing field ${field.name} with ${name} for ${t.name}') if field.name == name { c.log('found field ${name} for ${t.name}: ${field.typ.name()} (${field.typ.type_name()})') return field.typ @@ -2394,11 +2394,11 @@ fn (mut c Checker) find_field_or_method(t Type, name string) !Type { } } // else if t is FnType { - // c.log('FnType: $t.name') + // c.log('FnType: ${t.name}') // } // // dump(t) - // c.log('returning none for $t.type_name() - $name') + // c.log('returning none for ${t.type_name()} - ${name}') if method := c.find_method(t, name) { return method } @@ -2418,13 +2418,13 @@ fn (mut c Checker) find_method(t Type, name string) !Type { // TODO: interface methods // if base_type is Interface { base_type = t } base_type_name := if t is Pointer { base_type.name() } else { t.name() } - // c.log('base_type_name: $base_type_name - $t.type_name() - $base_type.type_name()') + // c.log('base_type_name: ${base_type_name} - ${t.type_name()} - ${base_type.type_name()}') // Lookup method in shared methods map methods := rlock c.env.methods { c.env.methods[base_type_name] or { []&Fn{} } } for method in methods { - // c.log('# $method.name - $name') + // c.log('# ${method.name} - ${name}') if method.name == name { c.log('found method ${name} for ${t.name()}') return method.typ diff --git a/vlib/v2/types/scope.v b/vlib/v2/types/scope.v index 5ebfac464..462dce223 100644 --- a/vlib/v2/types/scope.v +++ b/vlib/v2/types/scope.v @@ -67,7 +67,7 @@ pub fn (mut s Scope) lookup_parent(name string, pos token.Pos) ?Object { // } } } - // println('lookup_parent: NOT FOUND: $name') + // println('lookup_parent: NOT FOUND: ${name}') return none } @@ -81,15 +81,15 @@ pub fn (mut s Scope) lookup_parent_with_scope(name string, pos token.Pos) ?(&Sco // } } } - // println('lookup_parent: NOT FOUND: $name') + // println('lookup_parent: NOT FOUND: ${name}') return none } pub fn (mut s Scope) insert(name string, obj Object) { - // println(' - register: $name: ${obj.type_name()}') + // println(' - register: ${name}: ${obj.type_name()}') // TODO/FIXME: // if name in s.objects { - // println(' #### EXISTS: $name') + // println(' #### EXISTS: ${name}') // mut existing := s.objects[name] or { panic('should exist') } // if mut existing is Type { // if mut existing is Struct { diff --git a/vlib/v2/types/types.v b/vlib/v2/types/types.v index 67dcd145c..0c5b19036 100644 --- a/vlib/v2/types/types.v +++ b/vlib/v2/types/types.v @@ -468,16 +468,16 @@ fn (t Primitive) name() string { // } // .integer { // if t.props.has(.unsigned) { - // return 'u$t.size' + // return 'u${t.size}' // } else { // if t.size == 32 { // return 'int' // } - // return 'i$t.size' + // return 'i${t.size}' // } // } // .float { - // return 'f$t.size' + // return 'f${t.size}' // } // else { // println(t) diff --git a/vlib/vweb/README.md b/vlib/vweb/README.md index e8838300b..82deef99f 100644 --- a/vlib/vweb/README.md +++ b/vlib/vweb/README.md @@ -224,7 +224,7 @@ After it is defined in the attribute, you have to add it as a function parameter vvvv @['/hello/:user'] vvvv fn (mut app App) hello_user(user string) vweb.Result { - return app.text('Hello $user') + return app.text('Hello ${user}') } ``` @@ -929,7 +929,7 @@ pub fn (mut app App) controller_get_all_user() vweb.Result { response := app.service_get_all_user() or { app.set_status(400, '') - return app.text('$err') + return app.text('${err}') } return app.json(response) } @@ -976,12 +976,12 @@ pub fn (mut app App) articles() vweb.Result { pub fn (mut app App) controller_create_user() vweb.Result { body := json.decode(User, app.req.data) or { app.set_status(400, '') - return app.text('Failed to decode json, error: $err') + return app.text('Failed to decode json, error: ${err}') } response := app.service_add_user(body.username, body.password) or { app.set_status(400, '') - return app.text('error: $err') + return app.text('error: ${err}') } return app.json(response) @@ -1040,7 +1040,7 @@ pub fn (mut app App) user_repo_settings(username string, repository string) vweb if username !in known_users { return app.not_found() } - return app.html('username: $username | repository: $repository') + return app.html('username: ${username} | repository: ${repository}') } ``` @@ -1107,7 +1107,7 @@ Sets a cookie ```v ignore pub fn (mut app App) cookie() vweb.Result { app.set_cookie(name: 'cookie', value: 'test') - return app.text('Response Headers\n$app.header') + return app.text('Response Headers\n${app.header}') } ``` @@ -1124,7 +1124,7 @@ pub fn (mut app App) cookie() vweb.Result { expire_date := time.now().add(duration) app.set_cookie_with_expire_date(key, value, expire_date) - return app.text('Response Headers\n$app.header') + return app.text('Response Headers\n${app.header}') } ``` @@ -1206,7 +1206,7 @@ Returns the user-agent from the current user ```v ignore pub fn (mut app App) user_agent() vweb.Result { ua := app.user_agent() - return app.text('User-Agent: $ua') + return app.text('User-Agent: ${ua}') } ``` @@ -1219,7 +1219,7 @@ Returns the ip address from the current user ```v ignore pub fn (mut app App) ip() vweb.Result { ip := app.ip() - return app.text('ip: $ip') + return app.text('ip: ${ip}') } ``` diff --git a/vlib/vweb/assets/assets.v b/vlib/vweb/assets/assets.v index 72ad9be0c..846b07af1 100644 --- a/vlib/vweb/assets/assets.v +++ b/vlib/vweb/assets/assets.v @@ -176,7 +176,7 @@ fn (am AssetManager) include(asset_type string, combine bool) string { // fn (mut am AssetManager) add(asset_type, file string) ?bool { pub fn (mut am AssetManager) add(asset_type string, file string) bool { if !os.exists(file) { - // return error('vweb.assets: cannot add asset $file, it does not exist') + // return error('vweb.assets: cannot add asset ${file}, it does not exist') return false } asset := Asset{ diff --git a/vlib/x/ttf/render_bmp.v b/vlib/x/ttf/render_bmp.v index df43128d3..008078f0d 100644 --- a/vlib/x/ttf/render_bmp.v +++ b/vlib/x/ttf/render_bmp.v @@ -115,7 +115,7 @@ pub fn (mut bmp BitMap) exec_filler() { if bmp.filler[y].len > 0 { bmp.filler[y].sort() if bmp.filler[y].len & 1 != 0 { - // dprintln("even line!! $y => ${bmp.filler[y]}") + // dprintln("even line!! ${y} => ${bmp.filler[y]}") continue } mut index := 0 @@ -340,7 +340,7 @@ pub fn (mut bmp BitMap) line(in_x0 int, in_y0 int, in_x1 int, in_y1 int, c u32) x1 := int(in_x1) y0 := int(in_y0) y1 := int(in_y1) - // dprintln("line[$x0,$y0,$x1,$y1]") + // dprintln("line[${x0},${y0},${x1},${y1}]") mut x := x0 mut y := y0 @@ -381,7 +381,7 @@ pub fn (mut bmp BitMap) line(in_x0 int, in_y0 int, in_x1 int, in_y1 int, c u32) // bmp.plot(x, y, u32(0xFF00)) bmp.plot(x, y, c) - // dprintln("$x $y [$x0,$y0,$x1,$y1]") + // dprintln("${x} ${y} [${x0},${y0},${x1},${y1}]") if x == x1 && y == y1 { break } @@ -439,7 +439,7 @@ pub fn (mut bmp BitMap) quadratic(in_x0 int, in_y0 int, in_x1 int, in_y1 int, in // division = 0.1 // 10 division // division = 0.25 // 4 division - // dprintln("div: $division") + // dprintln("div: ${division}") /* ----- Bezier quadratic form ----- @@ -510,10 +510,10 @@ pub fn (mut bmp BitMap) get_chars_bbox(in_string string) []int { } ax, ay := bmp.tf.next_kern(c_index) - // dprintln("char_index: $c_index ax: $ax ay: $ay") + // dprintln("char_index: ${c_index} ax: ${ax} ay: ${ay}") // cw, lsb := bmp.tf.get_horizontal_metrics(u16(chr)) - // dprintln("metrics: [${u16(chr):c}] cw:$cw lsb:$lsb") + // dprintln("metrics: [${u16(chr):c}] cw:${cw} lsb:${lsb}") //----- Calc Glyph transformations ----- mut x0 := w + int(ax * bmp.scale) @@ -581,10 +581,10 @@ pub fn (mut bmp BitMap) get_bbox(in_string string) (int, int) { continue } ax, ay := bmp.tf.next_kern(c_index) - // dprintln("char_index: $c_index ax: $ax ay: $ay") + // dprintln("char_index: ${c_index} ax: ${ax} ay: ${ay}") // cw, lsb := bmp.tf.get_horizontal_metrics(u16(chr)) - // dprintln("metrics: [${u16(chr):c}] cw:$cw lsb:$lsb") + // dprintln("metrics: [${u16(chr):c}] cw:${cw} lsb:${lsb}") //----- Calc Glyph transformations ----- mut x0 := w + int(ax * bmp.scale) @@ -612,7 +612,7 @@ pub fn (mut bmp BitMap) get_bbox(in_string string) (int, int) { i += c_len } - // dprintln("y_min: $bmp.tf.y_min y_max: $bmp.tf.y_max res: ${int((bmp.tf.y_max - bmp.tf.y_min)*buf.scale)} width: ${int( (cw) * buf.scale)}") + // dprintln("y_min: ${bmp.tf.y_min} y_max: ${bmp.tf.y_max} res: ${int((bmp.tf.y_max - bmp.tf.y_min)*buf.scale)} width: ${int( (cw) * buf.scale)}") // buf.box(0,y_base - int((bmp.tf.y_min)*buf.scale), int( (x_max) * buf.scale), y_base-int((bmp.tf.y_max)*buf.scale), u32(0xFF00_0000) ) return w, int(math.abs(int(bmp.tf.y_max - bmp.tf.y_min)) * bmp.scale) } @@ -680,11 +680,11 @@ pub fn (mut bmp BitMap) draw_text(in_string string) (int, int) { } ax, ay := bmp.tf.next_kern(c_index) - // dprintln("char_index: $c_index ax: $ax ay: $ay") + // dprintln("char_index: ${c_index} ax: ${ax} ay: ${ay}") cw, _ := bmp.tf.get_horizontal_metrics(u16(chr)) // cw, lsb := bmp.tf.get_horizontal_metrics(u16(chr)) - // dprintln("metrics: [${u16(chr):c}] cw:$cw lsb:$lsb") + // dprintln("metrics: [${u16(chr):c}] cw:${cw} lsb:${lsb}") //----- Draw_Glyph transformations ----- mut x0 := w + int(ax * bmp.scale) @@ -713,7 +713,7 @@ pub fn (mut bmp BitMap) draw_text(in_string string) (int, int) { i += c_len } - // dprintln("y_min: $bmp.tf.y_min y_max: $bmp.tf.y_max res: ${int((bmp.tf.y_max - bmp.tf.y_min)*buf.scale)} width: ${int( (cw) * buf.scale)}") + // dprintln("y_min: ${bmp.tf.y_min} y_max: ${bmp.tf.y_max} res: ${int((bmp.tf.y_max - bmp.tf.y_min)*buf.scale)} width: ${int( (cw) * buf.scale)}") // buf.box(0,y_base - int((bmp.tf.y_min)*buf.scale), int( (x_max) * buf.scale), y_base-int((bmp.tf.y_max)*buf.scale), u32(0xFF00_0000) ) return w, int(math.abs(int(bmp.tf.y_max - bmp.tf.y_min)) * bmp.scale) } @@ -745,7 +745,7 @@ pub fn (mut bmp BitMap) draw_glyph(index u16) (int, int) { mut point := Point{} for count, point_raw in glyph.points { - // dprintln("count: $count, state: $s pl:$glyph.points.len") + // dprintln("count: ${count}, state: ${s} pl:${glyph.points.len}") point.x = point_raw.x point.y = point_raw.y diff --git a/vlib/x/ttf/render_sokol/cpu.v b/vlib/x/ttf/render_sokol/cpu.v index 66e591fb2..a85ad64f2 100644 --- a/vlib/x/ttf/render_sokol/cpu.v +++ b/vlib/x/ttf/render_sokol/cpu.v @@ -48,7 +48,7 @@ pub fn (mut tf_skl TTF_render_Sokol) create_text(in_txt string, in_font_size f32 // Formula: (font_size * device dpi) / (72dpi * em_unit) // scale := ((1.0 * device_dpi )/ f32(72 * tf_skl.bmp.tf.units_per_em))* font_size scale := f32(font_size * device_dpi) / f32(72 * int(tf_skl.bmp.tf.units_per_em)) - // ttf.dprintln("Scale: $scale") + // ttf.dprintln("Scale: ${scale}") tf_skl.bmp.scale = scale * scale_reduct w, h := tf_skl.bmp.get_bbox(in_txt) @@ -84,7 +84,7 @@ pub fn (mut tf_skl TTF_render_Sokol) create_text_block(in_txt string, in_w int, // Formula: (font_size * device dpi) / (72dpi * em_unit) // scale := ((1.0 * device_dpi )/ f32(72 * tf_skl.bmp.tf.units_per_em))* font_size scale := f32(font_size * device_dpi) / f32(72 * int(tf_skl.bmp.tf.units_per_em)) - // ttf.dprintln("Scale: $scale") + // ttf.dprintln("Scale: ${scale}") tf_skl.bmp.scale = scale * scale_reduct w := in_w diff --git a/vlib/x/ttf/text_block.v b/vlib/x/ttf/text_block.v index b8543d8e9..0a6b0bb2f 100644 --- a/vlib/x/ttf/text_block.v +++ b/vlib/x/ttf/text_block.v @@ -29,10 +29,10 @@ pub fn (mut dev BitMap) get_justify_space_cw(txt string, w int, block_w int, spa return 0 } delta := block_w - w - // println("num spc: $num_spaces") - // println("delta: ${txt} w:$w bw:$block_w space_cw:$space_cw") + // println("num spc: ${num_spaces}") + // println("delta: ${txt} w:${w} bw:${block_w} space_cw:${space_cw}") res := f32(delta) / f32(num_spaces) / f32(space_cw) - // println("res: $res") + // println("res: ${res}") return res } @@ -102,7 +102,7 @@ pub fn (mut bmp BitMap) draw_text_block(text string, block Text_block) { bmp.draw_text(tmp_str) //---- DEBUG ---- // txt_w , txt_h := bmp.draw_text(tmp_str) - // println("printing [${x},${y}] => '${tmp_str}' space_cw: $bmp.space_cw") + // println("printing [${x},${y}] => '${tmp_str}' space_cw: ${bmp.space_cw}") // bmp.box(x + left_offset,y + y_base - int((bmp.tf.y_min)*bmp.scale), x + txt_w + left_offset, y + y_base - int((bmp.tf.y_max) * bmp.scale), u32(0x00ff_0000) ) //--------------- y += y_base diff --git a/vlib/x/ttf/ttf.v b/vlib/x/ttf/ttf.v index 0fa66a93d..a6ebf8a9f 100644 --- a/vlib/x/ttf/ttf.v +++ b/vlib/x/ttf/ttf.v @@ -196,7 +196,7 @@ fn (mut tf TTF_File) get_glyph_offset(index u32) u32 { // indicates glyph has no outline( eg space) return 0 } - // dprintln("Offset for glyph index $index is $offset") + // dprintln("Offset for glyph index ${index} is ${offset}") tf.pos = old_pos return offset + tf.tables['glyf'].offset } @@ -214,7 +214,7 @@ pub fn (mut tf TTF_File) glyph_count() u16 { // read_glyph_dim returns glyph dimension data in the form `x_min`, `x_max`, `y_min` and `y_max`. pub fn (mut tf TTF_File) read_glyph_dim(index u16) (int, int, int, int) { offset := tf.get_glyph_offset(index) - // dprintln("offset: $offset") + // dprintln("offset: ${offset}") if offset == 0 || offset >= tf.tables['glyf'].offset + tf.tables['glyf'].length { dprintln('No glyph found!') return 0, 0, 0, 0 @@ -224,7 +224,7 @@ pub fn (mut tf TTF_File) read_glyph_dim(index u16) (int, int, int, int) { assert offset < tf.tables['glyf'].offset + tf.tables['glyf'].length tf.pos = offset - // dprintln("file seek read_glyph: $tf.pos") + // dprintln("file seek read_glyph: ${tf.pos}") // number_of_contours _ := tf.get_i16() @@ -249,7 +249,7 @@ pub fn (mut tf TTF_File) get_ttf_widths() ([]int, int, int) { if glyph_index == 0 { continue } - // dprintln("$i = glyph_index: $glyph_index ${i:c}") + // dprintln("${i} = glyph_index: ${glyph_index} ${i:c}") if i > max_code { max_code = i } @@ -257,7 +257,7 @@ pub fn (mut tf TTF_File) get_ttf_widths() ([]int, int, int) { min_code = i } } - // dprintln("min_code: $min_code max_code: $max_code") + // dprintln("min_code: ${min_code} max_code: ${max_code}") mut widths := []int{len: max_code - min_code + 1, init: 0} for i in min_code .. max_code { @@ -281,7 +281,7 @@ pub fn (mut tf TTF_File) get_ttf_widths() ([]int, int, int) { widths[pos] = int(w1 / tf.width_scale) // if i >= int(`A`) && i <= int(`Z`) { - // dprintln("${i:c}|$glyph_index [$pos] => width:${x_max-x_min} aw:${aw}|w1:${w1} lsb:${lsb} rsb:${rsb} pp1:${pp1} pp2:${pp2}") + // dprintln("${i:c}|${glyph_index} [${pos}] => width:${x_max-x_min} aw:${aw}|w1:${w1} lsb:${lsb} rsb:${rsb} pp1:${pp1} pp2:${pp2}") //} } @@ -299,7 +299,7 @@ pub fn (mut tf TTF_File) read_glyph(index u16) Glyph { // dprintln("Create glyp: ${index}") offset := tf.get_glyph_offset(index) - // dprintln("offset: $offset") + // dprintln("offset: ${offset}") if offset == 0 || offset >= tf.tables['glyf'].offset + tf.tables['glyf'].length { dprintln('No glyph found!') return Glyph{} @@ -309,7 +309,7 @@ pub fn (mut tf TTF_File) read_glyph(index u16) Glyph { assert offset < tf.tables['glyf'].offset + tf.tables['glyf'].length tf.pos = offset - // dprintln("file seek read_glyph: $tf.pos") + // dprintln("file seek read_glyph: ${tf.pos}") /* ---- BUG TO SOLVE ----- @@ -330,7 +330,7 @@ pub fn (mut tf TTF_File) read_glyph(index u16) Glyph { tmp_glyph.x_max = tf.get_fword() tmp_glyph.y_max = tf.get_fword() - // dprintln("file seek after read_glyph: $tf.pos") + // dprintln("file seek after read_glyph: ${tf.pos}") assert tmp_glyph.number_of_contours >= -1 @@ -415,7 +415,7 @@ fn (mut tf TTF_File) read_simple_glyph(mut in_glyph Glyph) { } else { // value is unchanged } - // dprintln("$i_x x: $value") + // dprintln("${i_x} x: ${value}") in_glyph.points[i_x].x = value } @@ -434,7 +434,7 @@ fn (mut tf TTF_File) read_simple_glyph(mut in_glyph Glyph) { } else { // value is unchanged } - // dprintln("$i_y y: $value") + // dprintln("${i_y} y: ${value}") in_glyph.points[i_y].y = value } @@ -639,7 +639,7 @@ fn (mut tf TTF_File) calc_checksum(offset u32, length u32) u32 { mut sum := u64(0) mut nlongs := int((length + 3) >> 2) tf.pos = offset - // dprintln("offs: $offset nlongs: $nlongs") + // dprintln("offs: ${offset} nlongs: ${nlongs}") for nlongs > 0 { sum = sum + u64(tf.get_u32()) nlongs-- @@ -759,7 +759,7 @@ fn (mut tf TTF_File) read_name_table() { } else { name = tf.get_string(length) } - // dprintln("Name [${platform_id} / ${platform_specific_id}] id:[$name_id] language:[$language_id] [$name]") + // dprintln("Name [${platform_id} / ${platform_specific_id}] id:[${name_id}] language:[${language_id}] [${name}]") tf.pos = old_pos match name_id { @@ -861,7 +861,7 @@ fn (mut tm TrueTypeCmap) init_0(mut tf TTF_File) { fn (mut tm TrueTypeCmap) map_0(char_code int) int { if char_code >= 0 && char_code <= 255 { - // dprintln("charCode $char_code maps to ${tm.arr[char_code]}") + // dprintln("charCode ${char_code} maps to ${tm.arr[char_code]}") return tm.arr[char_code] } return 0 @@ -910,13 +910,13 @@ fn (mut tm TrueTypeCmap) init_4(mut tf TTF_File) { // DEBUG LOG for i in 0..seg_count { seg := tm.segments[i] - dprintln(" segments[$i] = $seg.start_code $seg.end_code $seg.id_delta $seg.id_range_offset") + dprintln(" segments[${i}] = ${seg.start_code} ${seg.end_code} ${seg.id_delta} ${seg.id_range_offset}") } */ } fn (mut tm TrueTypeCmap) map_4(char_code int, mut tf TTF_File) int { - // dprintln("HERE map_4 for char [$char_code]") + // dprintln("HERE map_4 for char [${char_code}]") old_pos := tf.pos if tm.cache[char_code] == -1 { // dprintln("Not found, search for it!") @@ -999,7 +999,7 @@ fn (mut kt Kern0Table) get(glyph_index int) (int, int) { if kt.old_index >= 0 { ch := ((u32(kt.old_index & 0xFFFF) << 16) | u32(glyph_index & 0xFFFF)) - // dprintln("kern_get: $ch") + // dprintln("kern_get: ${ch}") if ch in kt.kmap { x = int(kt.kmap[ch]) } diff --git a/vlib/x/ttf/ttf_test.v b/vlib/x/ttf/ttf_test.v index bc330f4d7..8121a2689 100644 --- a/vlib/x/ttf/ttf_test.v +++ b/vlib/x/ttf/ttf_test.v @@ -171,7 +171,7 @@ fn test_main() { tf.buf = unsafe { mut_font_bytes.data().vbytes(font_bytes.len) } } tf.init() - // println("Unit per EM: $tf.units_per_em") + // println("Unit per EM: ${tf.units_per_em}") w := 64 h := 32 -- 2.39.5