File tree Expand file tree Collapse file tree 5 files changed +19
-5
lines changed
Expand file tree Collapse file tree 5 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -229,7 +229,7 @@ mod tests {
229229
230230 // create fileid and read file
231231 let input =
232- std:: fs:: read_to_string ( "tests/calyx_go_doneStruct .prot" ) . expect ( "failed to load" ) ;
232+ std:: fs:: read_to_string ( "tests/calyx_go_done_struct .prot" ) . expect ( "failed to load" ) ;
233233 let calyx_fileid = handler. add_file ( "calyx_go_done.prot" . to_string ( ) , input) ;
234234
235235 // 2) create transaction
Original file line number Diff line number Diff line change @@ -72,8 +72,18 @@ mod tests {
7272 parse_file ( "tests/mul.prot" ) ;
7373 }
7474
75+ #[ test]
76+ fn test_easycond_prot ( ) {
77+ parse_file ( "tests/cond.prot" ) ;
78+ }
79+
7580 #[ test]
7681 fn test_cond_prot ( ) {
7782 parse_file ( "tests/cond.prot" ) ;
7883 }
84+
85+ #[ test]
86+ fn test_calyx_go_done_struct_prot ( ) {
87+ parse_file ( "tests/calyx_go_done_struct.prot" ) ;
88+ }
7989}
Original file line number Diff line number Diff line change @@ -44,7 +44,8 @@ cmd = { path_id ~ "(" ~ ")" ~ ";"}
4444stmt = _{ (assign | cmd | while | cond) }
4545dir = _{"in" | "out" }
4646arg = { dir ~ id ~ ":" ~ tpe }
47- arglist = { (arg ~ "," ~ arglist) | arg }
47+ arglist = { (arg ~ "," ~ arglist) | arg ~ ","? }
48+ type_param = { "<" ~ id ~ ":" ~ id ~ ">" }
4849
4950// Loops
5051while = { "while" ~ expr ~ "{" ~ stmt* ~ "}" }
@@ -55,5 +56,8 @@ else_if = { "else" ~ "if" ~ expr ~ "{" ~ stmt* ~ "}"}
5556else = { "else" ~ "{" ~ stmt* ~ "}" }
5657cond = { if ~ else_if* ~ else? }
5758
58- fun = { "fn" ~ id ~ "(" ~ arglist ~ ")" ~ "{" ~ stmt* ~ "}" }
59- file = { SOI ~ fun* ~ EOI }
59+ // Structs
60+ struct = { "struct" ~ id ~ "{" ~ arglist? ~ "}" }
61+
62+ fun = { "fn" ~ id ~ type_param? ~ "(" ~ arglist ~ ")" ~ "{" ~ stmt* ~ "}" }
63+ file = { SOI ~ (fun | struct)* ~ EOI }
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ mod tests {
171171
172172 // create fileid and read file
173173 let input =
174- std:: fs:: read_to_string ( "tests/calyx_go_doneStruct .prot" ) . expect ( "failed to load" ) ;
174+ std:: fs:: read_to_string ( "tests/calyx_go_done_struct .prot" ) . expect ( "failed to load" ) ;
175175 let calyx_fileid = handler. add_file ( "calyx_go_done.prot" . to_string ( ) , input) ;
176176
177177 // 2) create transaction
File renamed without changes.
You can’t perform that action at this time.
0 commit comments