ref: 6538ea2c5b4daf1fc325144fbb0c9bc779ba3130
parent: d04a5e5a459e5fd8dde5f3b0e6629124c03a6432
parent: 9021cc39e9db0ef9c433dda8b1513050d359a8eb
author: Ori Bernstein <[email protected]>
date: Mon Dec 14 05:34:18 EST 2015
Merge pull request #9 from andrewchambers/docs update lang.txt entry for match statements
--- a/doc/lang.txt
+++ b/doc/lang.txt
@@ -323,8 +323,8 @@
Match statements consist of the keyord 'match', followed by
the expression to match against the patterns, followed by a
newline. The body of the match statement consists of a list
- of pattern clauses. A patterned clause is a pattern, followed
- by a ':', followed by a block body.
+ of pattern clauses. A patterned clause is a '|', followed by
+ a pattern, followed by a ':', followed by a block body.
An example of the syntax follows:
@@ -332,20 +332,17 @@
var v = `Val 123 /* set up variable to match */
match v
/* pattern clauses */
- `Val 123:
- std.put("Matched literal union pat\n");;
- Val234:
+ | `Val 123:
+ std.put("Matched literal union pat\n")
+ | Val234:
std.put("Matched const value pat\n")
- ;;
- `Val a:
+ | `Val a:
std.put("Matched pattern with capture\n")
std.put("Captured value: a = %i\n", a)
- ;;
- a
- std.put("A top level bind matches anything.");;
- `Val 111
+ | a
+ std.put("A top level bind matches anything.")
+ | `Val 111
std.put("Unreachable block.")
- ;;
;;