aboutsummaryrefslogtreecommitdiff
path: root/examples/parser_tests.nom
diff options
context:
space:
mode:
Diffstat (limited to 'examples/parser_tests.nom')
-rw-r--r--examples/parser_tests.nom183
1 files changed, 0 insertions, 183 deletions
diff --git a/examples/parser_tests.nom b/examples/parser_tests.nom
deleted file mode 100644
index 25d7e99..0000000
--- a/examples/parser_tests.nom
+++ /dev/null
@@ -1,183 +0,0 @@
-require "lib/core.nom"
-require "lib/testing.nom"
-
-test: say "foo"
-..yields ".."
- |FunctionCall:
- | Word:
- | "say"
- | String:
- | "foo"
-
-test: say (foo)
-..yields ".."
- |FunctionCall:
- | Word:
- | "say"
- | FunctionCall:
- | Word:
- | "foo"
-
-test:
- rule (fart) =: say "poot"
-..yields ".."
- |Call [rule % = %]:
- | List:
- | Call [fart]:
- | Block:
- | Call [say %]:
- | "poot"
-
-test: say (subexpressions work)
-..yields ".."
- |Call [say %]:
- | Call [subexpressions work]:
-
-test: say ["lists", "work"]
-..yields ".."
- |Call [say %]:
- | List:
- | "lists"
- | "work"
-
-test (say []) yields ".."
- |Call [say %]:
- | List:
-
-test:
- say [..]
- 1, 2
- 3
-..yields ".."
- |Call [say %]:
- | List:
- | 1
- | 2
- | 3
-
-test:
- say both [..]
- 1,2
- ..and [..]
- 3,4
-..yields ".."
- |Call [say both % and %]:
- | List:
- | 1
- | 2
- | List:
- | 3
- | 4
-
-
-test:
- if 1: yes
- ..else: no
-..yields ".."
- |Call [if % % else %]:
- | 1
- | Block:
- | Call [yes]:
- | Block:
- | Call [no]:
-
-test:
- if 1 (yes) else: no
-..yields ".."
- |Call [if % % else %]:
- | 1
- | Block:
- | Call [yes]:
- | Block:
- | Call [no]:
-
-test: say (do (return 5))
-..yields ".."
- |Call [say %]:
- | Call [do %]:
- | Block:
- | Call [return %]:
- | 5
-
-test:
- say:
- fn call
-..yields ".."
- |Call [say %]:
- | Call [fn call]:
-
-test:
- do: say "one liner"
- ..also: say "another one liner"
-..yields ".."
- |Call [do % also %]:
- | Block:
- | Call [say %]:
- | "one liner"
- | Block:
- | Call [say %]:
- | "another one liner"
-
-test:
- say:
- do:
- say "hi"
- return 5
- say "bye"
-..yields ".."
- |Call [say %]:
- | Call [do %]:
- | Block:
- | Call [say %]:
- | "hi"
- | Call [return %]:
- | 5
- | Call [say %]:
- | "bye"
-
-
-test: say (1 + (-(2 * 3)))
-..yields ".."
- |Call [say %]:
- | Call [% + %]:
- | 1
- | Call [- %]:
- | Call [% * %]:
- | 2
- | 3
-
-test:
- if %x:
- x
- ..else:
- if %y:
- y
- ..else:
- z
-..yields ".."
- |Call [if % % else %]:
- | Var["x"]
- | Block:
- | Call [x]:
- | Block:
- | Call [if % % else %]:
- | Var["y"]
- | Block:
- | Call [y]:
- | Block:
- | Call [z]:
-
-
-test:
- don't fuck this up
-..yields ".."
- |Call [don 't fuck this up]:
-
-test:
- %Brian's hat
-..yields ".."
- |Call [% 's hat]:
- | Var["Brian"]
-
-say "All tests passed!"
-