Skip to content

Commit ef43710

Browse files
edammasatake
authored andcommitted
V: added new parser
1 parent dc1f0ab commit ef43710

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+4333
-0
lines changed

Tmain/list-roles.d/stdout-expected.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ Tex i/xinput bibliography on bibliography (.bib)
117117
Tex i/xinput included on external input file specified with \include
118118
Tex i/xinput input on external input file specified with \input
119119
Thrift T/thriftFile included on included file
120+
V Y/unknown imported on imported symbol
121+
V p/module foreignlang on representing a foreign language (i.e., C, JS...)
122+
V p/module imported on imported module
120123
VHDL e/entity desigend on designed by an architecture
121124
Vera d/macro condition off used in part of #if/#ifdef/#elif conditions
122125
Vera d/macro undef on undefined
@@ -246,6 +249,9 @@ Tex i/xinput bibliography on bibliography (.bib)
246249
Tex i/xinput included on external input file specified with \include
247250
Tex i/xinput input on external input file specified with \input
248251
Thrift T/thriftFile included on included file
252+
V Y/unknown imported on imported symbol
253+
V p/module foreignlang on representing a foreign language (i.e., C, JS...)
254+
V p/module imported on imported module
249255
VHDL e/entity desigend on designed by an architecture
250256
Vera d/macro condition off used in part of #if/#ifdef/#elif conditions
251257
Vera d/macro undef on undefined
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--fields=+ERSaenr
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
main input.v /^fn main() {$/;" f line:1 typeref:typename: signature:() roles:def end:3
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println("hello world")
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--fields=+ERSaenrl
2+
--sort=no
3+
--extras=+r
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
main input.v /^fn main() {$/;" f line:1 language:V typeref:typename: signature:() roles:def end:17
2+
a input.v /^ a := 1$/;" v line:3 language:V fn:main roles:def
3+
thismodule input-1.v /^module thismodule$/;" p line:1 language:V roles:def
4+
that input-1.v /^import that.aaa$/;" p line:3 language:V roles:imported extras:reference
5+
aaa input-1.v /^import that.aaa$/;" p line:3 language:V module:that roles:imported extras:reference
6+
that input-1.v /^import that.bbb { Bbb }$/;" p line:4 language:V roles:imported extras:reference
7+
bbb input-1.v /^import that.bbb { Bbb }$/;" p line:4 language:V module:that roles:imported extras:reference
8+
Bbb input-1.v /^import that.bbb { Bbb }$/;" Y line:4 language:V module:that.bbb roles:imported extras:reference
9+
Foo input-1.v /^struct Foo {$/;" s line:6 language:V module:thismodule roles:def end:9
10+
a input-1.v /^ a aaa.Aaa$/;" m line:7 language:V struct:thismodule.Foo roles:def
11+
b input-1.v /^ b Bbb$/;" m line:8 language:V struct:thismodule.Foo roles:def
12+
main input-1.v /^fn main() {$/;" f line:11 language:V module:thismodule typeref:typename: signature:() roles:def end:15
13+
foo input-1.v /^ foo := Foo{}$/;" v line:12 language:V fn:thismodule.main roles:def
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module thismodule
2+
3+
import that.aaa
4+
import that.bbb { Bbb }
5+
6+
struct Foo {
7+
a aaa.Aaa
8+
b Bbb
9+
}
10+
11+
fn main() {
12+
foo := Foo{}
13+
foo.a
14+
foo.b
15+
}

Units/parser-v.r/torture.d/input.v

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
fn main() {
2+
assert sample_data['int'] or { 0 }.as_map()['0'] or { 0 }.int() == 1
3+
a := 1
4+
assert json.encode(StructType[string]{ val: '' }) == '{"val":""}'
5+
assert json.map_from(StructType[StructType[string]]{StructType[string]{'3'}}).str() == '{"val":{"val":"3"}}'
6+
if include_newlines && s.text[s.pos] in json2.newlines {
7+
}
8+
if (s.pos - 1 >= 0 && s.text[s.pos - 1] != `\\`) && ch == `"` {
9+
}
10+
if g.cur_fn != unsafe { nil } && g.cur_fn.generic_names.len > 0 {
11+
}
12+
for (flags & ttf.tfkc_more_components) > 0 {
13+
res << 'foo' + foo.bar.map(it.str()).join('|')
14+
res << 'foo' + foo.bar.chan(it.str()).join('|')
15+
}
16+
e.run_func(e.mods['main']['main'] or { ast.FnDecl{} } as ast.FnDecl, ...args)
17+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--fields=+ERSaenr
2+
--sort=no
3+
--extras=+r
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
a input.v /^ a = 20$/;" c line:3 roles:def
2+
b input.v /^ b = 999999999$/;" c line:4 roles:def
3+
c input.v /^ c = 45.6$/;" c line:5 roles:def
4+
d input.v /^ d = 3.14$/;" c line:6 roles:def
5+
e input.v /^ e = 1_000_000$/;" c line:7 roles:def
6+
f input.v /^ f = 3_122.55$/;" c line:8 roles:def
7+
g input.v /^ g = "hi"$/;" c line:10 roles:def
8+
h input.v /^ h = "hi \\"tim\\""$/;" c line:11 roles:def
9+
i input.v /^ i = '\\u2605'$/;" c line:12 roles:def
10+
j input.v /^ j = '\\xe2\\x98\\x85'$/;" c line:13 roles:def
11+
k input.v /^ k = `x`$/;" c line:14 roles:def
12+
l input.v /^ l = 0b1111_0000_1010$/;" c line:16 roles:def
13+
m input.v /^ m = -0b1111_0000_1010$/;" c line:17 roles:def
14+
n input.v /^ n = 0x00$/;" c line:18 roles:def
15+
o input.v /^ o = 0xabcdef$/;" c line:19 roles:def
16+
p input.v /^ p = 0xF_F$/;" c line:20 roles:def
17+
q input.v /^ q = 0o173$/;" c line:21 roles:def
18+
r input.v /^ r = 0o17_3$/;" c line:22 roles:def
19+
s input.v /^ s = 'Hello World 👋'$/;" c line:24 roles:def
20+
t input.v /^ t = 42e1$/;" c line:26 roles:def
21+
u input.v /^ u = 123e-2$/;" c line:27 roles:def
22+
v input.v /^ v = 456E+2$/;" c line:28 roles:def
23+
x input.v /^const x = 99$/;" c line:31 roles:def
24+
pi input.v /^pub const pi = 3.14$/;" c line:32 access:pub roles:def
25+
numbers input.v /^ numbers = [1, 2, 3]$/;" c line:35 roles:def
26+
red input.v /^ red = Color{$/;" c line:36 roles:def
27+
green input.v /^ green = &Colour{0, 255, 0}$/;" c line:41 roles:def
28+
blue input.v /^ blue = rgb(0, 0, 255)$/;" c line:42 roles:def
29+
test1 input.v /^ test1 = [$/;" c line:43 roles:def
30+
test2 input.v /^ test2 = test1 + 3$/;" c line:47 roles:def
31+
test3 input.v /^ test3 = 0$/;" c line:48 roles:def
32+
a input.v /^ a = 9 + 3$/;" c line:52 access:pub roles:def
33+
b input.v /^ b = a[3]$/;" c line:53 access:pub roles:def
34+
c input.v /^ c = 0$/;" c line:54 access:pub roles:def
35+
d input.v /^ d = r'hi'$/;" c line:55 access:pub roles:def
36+
e input.v /^ e = r"there"$/;" c line:56 access:pub roles:def
37+
f input.v /^ f = '"'$/;" c line:57 access:pub roles:def
38+
g input.v /^ g = "'"$/;" c line:58 access:pub roles:def
39+
h input.v /^ h = '${"'"}'$/;" c line:59 access:pub roles:def
40+
i input.v /^ i = '\\${'$/;" c line:60 access:pub roles:def
41+
j input.v /^ j = '$'$/;" c line:61 access:pub roles:def
42+
z input.v /^ z = 'done'$/;" c line:62 access:pub roles:def
43+
a input-1.v /^ a = x + -8$/;" c line:2 roles:def
44+
b input-1.v /^ b = x \/ x$/;" c line:3 roles:def
45+
c input-1.v /^ c = x * x$/;" c line:4 roles:def
46+
d input-1.v /^ d = x - +8$/;" c line:5 roles:def
47+
e input-1.v /^ e = x | x & x && x || x$/;" c line:6 roles:def
48+
f input-1.v /^ f = !x | !!x$/;" c line:7 roles:def
49+
g input-1.v /^ g = ~x == ~~~~~~~~~~~~x != !!!!!!!x$/;" c line:8 roles:def
50+
h input-1.v /^ h = x ^ x ^ x$/;" c line:9 roles:def
51+
i input-1.v /^ i = x$/;" c line:10 roles:def

0 commit comments

Comments
 (0)