-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
51 lines (41 loc) · 906 Bytes
/
Copy pathmain.go
File metadata and controls
51 lines (41 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"fmt"
"log"
"github.com/chazu/go-vfl/internal/parser"
"github.com/davecgh/go-spew/spew"
)
func main() {
// cases := []string{
// "[Test1][Test2]",
// "[Test1 >=40]",
// "[Test1 >=40@10]",
// "[Test1 >=40][Test2 >=Foo]",
// "[Test1 >=40][Test2 >=Foo@10]",
// "[Test1(>=40,<=80)]",
// "[Test1 (>=40)]",
// "V:[TestView]-[TestTwo]",
// "V:[TestView]-50-[TestTwo]",
// "V:|[TestView]-50-[TestTwo]|",
// "|[Test]|",
// "|[Test][TestTwo]|",
// "|[Test]-[TestTwo]|",
// "|[Test]-(50)-[TestTwo]|",
// "|-[Test]-|",
// "|-50-[Test]-|",
// "|-50-[Test]-50-|",
// "|-(>=50@10)-[Test]-(<=50@10)-|",
// }
prg := "[Test][Test2]"
p := parser.New(parser.WithLookahead(250))
res, err := p.ParseProgram(prg)
if err != nil {
log.Fatal(err)
}
f, err := res.Reify()
if err != nil {
log.Fatal(err)
}
fmt.Printf("OK\n")
spew.Dump(f.Views)
}