Getty Ritter 3 лет назад
Родитель
Сommit
5eb3dda73c
2 измененных файлов с 255 добавлено и 0 удалено
  1. 14 0
      tests/exprs.matzo
  2. 241 0
      tests/exprs.parsed

+ 14 - 0
tests/exprs.matzo

@@ -7,3 +7,17 @@ puts 5: This | That;
 
 (* application *)
 puts foo.bar.baz;
+
+
+(* tuples *)
+puts <>;
+puts <1>;
+puts <1,2>;
+puts <1,2,3>;
+
+(* ranges *)
+puts 0..20;
+puts x..y;
+
+(* application *)
+puts f.x;

+ 241 - 0
tests/exprs.parsed

@@ -127,4 +127,245 @@
             ],
         ),
     ),
+    Puts(
+        Chc(
+            [
+                Choice {
+                    weight: None,
+                    value: Cat(
+                        [
+                            Tup(
+                                [
+                                    Chc(
+                                        [
+                                            Choice {
+                                                weight: None,
+                                                value: Cat(
+                                                    [],
+                                                ),
+                                            },
+                                        ],
+                                    ),
+                                ],
+                            ),
+                        ],
+                    ),
+                },
+            ],
+        ),
+    ),
+    Puts(
+        Chc(
+            [
+                Choice {
+                    weight: None,
+                    value: Cat(
+                        [
+                            Tup(
+                                [
+                                    Chc(
+                                        [
+                                            Choice {
+                                                weight: None,
+                                                value: Cat(
+                                                    [
+                                                        Lit(
+                                                            Num(
+                                                                1,
+                                                            ),
+                                                        ),
+                                                    ],
+                                                ),
+                                            },
+                                        ],
+                                    ),
+                                ],
+                            ),
+                        ],
+                    ),
+                },
+            ],
+        ),
+    ),
+    Puts(
+        Chc(
+            [
+                Choice {
+                    weight: None,
+                    value: Cat(
+                        [
+                            Tup(
+                                [
+                                    Chc(
+                                        [
+                                            Choice {
+                                                weight: None,
+                                                value: Cat(
+                                                    [
+                                                        Lit(
+                                                            Num(
+                                                                1,
+                                                            ),
+                                                        ),
+                                                    ],
+                                                ),
+                                            },
+                                        ],
+                                    ),
+                                    Chc(
+                                        [
+                                            Choice {
+                                                weight: None,
+                                                value: Cat(
+                                                    [
+                                                        Lit(
+                                                            Num(
+                                                                2,
+                                                            ),
+                                                        ),
+                                                    ],
+                                                ),
+                                            },
+                                        ],
+                                    ),
+                                ],
+                            ),
+                        ],
+                    ),
+                },
+            ],
+        ),
+    ),
+    Puts(
+        Chc(
+            [
+                Choice {
+                    weight: None,
+                    value: Cat(
+                        [
+                            Tup(
+                                [
+                                    Chc(
+                                        [
+                                            Choice {
+                                                weight: None,
+                                                value: Cat(
+                                                    [
+                                                        Lit(
+                                                            Num(
+                                                                1,
+                                                            ),
+                                                        ),
+                                                    ],
+                                                ),
+                                            },
+                                        ],
+                                    ),
+                                    Chc(
+                                        [
+                                            Choice {
+                                                weight: None,
+                                                value: Cat(
+                                                    [
+                                                        Lit(
+                                                            Num(
+                                                                2,
+                                                            ),
+                                                        ),
+                                                    ],
+                                                ),
+                                            },
+                                        ],
+                                    ),
+                                    Chc(
+                                        [
+                                            Choice {
+                                                weight: None,
+                                                value: Cat(
+                                                    [
+                                                        Lit(
+                                                            Num(
+                                                                3,
+                                                            ),
+                                                        ),
+                                                    ],
+                                                ),
+                                            },
+                                        ],
+                                    ),
+                                ],
+                            ),
+                        ],
+                    ),
+                },
+            ],
+        ),
+    ),
+    Puts(
+        Chc(
+            [
+                Choice {
+                    weight: None,
+                    value: Cat(
+                        [
+                            Range(
+                                Lit(
+                                    Num(
+                                        0,
+                                    ),
+                                ),
+                                Lit(
+                                    Num(
+                                        20,
+                                    ),
+                                ),
+                            ),
+                        ],
+                    ),
+                },
+            ],
+        ),
+    ),
+    Puts(
+        Chc(
+            [
+                Choice {
+                    weight: None,
+                    value: Cat(
+                        [
+                            Range(
+                                Var(
+                                    "x",
+                                ),
+                                Var(
+                                    "y",
+                                ),
+                            ),
+                        ],
+                    ),
+                },
+            ],
+        ),
+    ),
+    Puts(
+        Chc(
+            [
+                Choice {
+                    weight: None,
+                    value: Cat(
+                        [
+                            Ap(
+                                Var(
+                                    "f",
+                                ),
+                                Var(
+                                    "x",
+                                ),
+                            ),
+                        ],
+                    ),
+                },
+            ],
+        ),
+    ),
 ]