0 issues 1 contributor 4 branches 0 releases
Additions: 14 Deletions: 2 View patch
1 - `@METHOD` => replaced with ReceiverType.MethodName
2 - `@MOD` => replaced with the name of the current V module
3 - `@STRUCT` => replaced with the name of the current V struct
4-- `@FILE` => replaced with the path of the V source file
5+- `@FILE` => replaced with the absolute path of the V source file
6 - `@LINE` => replaced with the V line number where it appears (as a string).
7+- `@FILE_LINE` => like `@FILE:@LINE`, but the file part is a relative path
8 - `@COLUMN` => replaced with the column where it appears (as a string).
9 - `@VEXE` => replaced with the path to the V compiler
10 - `@VEXEROOT` => will be substituted with the *folder*,
11
1 .line_nr {
2 node.val = (node.pos.line_nr + 1).str()
3 }
4+ .file_path_line_nr {
5+ node.val = os.file_name(c.file.path) + ':' + (node.pos.line_nr + 1).str()
6+ }
7 .column_nr {
8 node.val = (node.pos.col + 1).str()
9 }
10
1 '@STRUCT' { token.AtKind.struct_name }
2 '@FILE' { token.AtKind.file_path }
3 '@LINE' { token.AtKind.line_nr }
4+ '@FILE_LINE' { token.AtKind.file_path_line_nr }
5 '@COLUMN' { token.AtKind.column_nr }
6 '@VHASH' { token.AtKind.vhash }
7 '@VMOD_FILE' { token.AtKind.vmod_file }
8
1 assert f == 'comptime_at_test.v'
2 }
3
4+fn test_at_file_len() {
5+ // Test @FILE_LINE
6+ line1, line2 := '${@LINE}', '${@FILE_LINE}'
7+ assert os.file_name(@FILE) + ':' + line1.str() == line2
8+}
9+
10 fn test_at_fn() {
11 // Test @FN
12 assert @FN == 'test_at_fn'
13
1 vmodroot_path
2 vroot_path // obsolete
3 vexeroot_path
4+ file_path_line_nr
5 }
6
7 pub const (
8 .unsigned_right_shift_assign]
9
10 valid_at_tokens = ['@VROOT', '@VMODROOT', '@VEXEROOT', '@FN', '@METHOD', '@MOD', '@STRUCT',
11- '@VEXE', '@FILE', '@LINE', '@COLUMN', '@VHASH', '@VMOD_FILE']
12+ '@VEXE', '@FILE', '@LINE', '@COLUMN', '@VHASH', '@VMOD_FILE', '@FILE_LINE']
13
14 token_str = build_token_str()
15