Skip to content

Commit

Permalink
tools: support setting another SCANNER_MODE=parse_comments in parser_…
Browse files Browse the repository at this point in the history
…speed.v and scanner_speed.v
  • Loading branch information
spytheman committed Jan 21, 2024
1 parent 135e2f1 commit 3e8c535
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmd/tools/measure/parser_speed.v
Expand Up @@ -8,8 +8,12 @@ import v.scanner
import term

const skip_tests = os.getenv_opt('SKIP_TESTS') or { '' }.bool()
const comments_mode = scanner.CommentsMode.from(os.getenv('SCANNER_MODE')) or {
scanner.CommentsMode.skip_comments
}

fn main() {
dump(comments_mode)
files := os.args#[1..]
if files.len > 0 && files[0].starts_with('@') {
lst_path := files[0].all_after('@')
Expand Down
6 changes: 5 additions & 1 deletion cmd/tools/measure/scanner_speed.v
Expand Up @@ -5,8 +5,12 @@ import v.scanner
import v.pref

const skip_tests = os.getenv_opt('SKIP_TESTS') or { '' }.bool()
const comments_mode = scanner.CommentsMode.from(os.getenv('SCANNER_MODE')) or {
scanner.CommentsMode.skip_comments
}

fn main() {
dump(comments_mode)
files := os.args#[1..]
if files.len > 0 && files[0].starts_with('@') {
lst_path := files[0].all_after('@')
Expand Down Expand Up @@ -47,7 +51,7 @@ fn process_files(files []string) ! {
}
total_files++
sw.restart()
s := scanner.new_scanner_file(f, .skip_comments, pref_)!
s := scanner.new_scanner_file(f, comments_mode, pref_)!
f_us := sw.elapsed().microseconds()
total_us += f_us
total_bytes += s.text.len
Expand Down

0 comments on commit 3e8c535

Please sign in to comment.