summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Chambers <andrewchamberss@gmail.com>2015-12-14 23:09:12 +1300
committerAndrew Chambers <andrewchamberss@gmail.com>2015-12-14 23:09:12 +1300
commit9021cc39e9db0ef9c433dda8b1513050d359a8eb (patch)
treef0910394e57ef1b35d68d59214ad68ab7ff49266
parentd04a5e5a459e5fd8dde5f3b0e6629124c03a6432 (diff)
downloadmc-9021cc39e9db0ef9c433dda8b1513050d359a8eb.tar.gz
update lang.txt entry for match statements
-rw-r--r--doc/lang.txt21
1 files changed, 9 insertions, 12 deletions
diff --git a/doc/lang.txt b/doc/lang.txt
index 18543ce..1aee9a9 100644
--- a/doc/lang.txt
+++ b/doc/lang.txt
@@ -323,8 +323,8 @@ TABLE OF CONTENTS:
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 @@ TABLE OF CONTENTS:
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.")
- ;;
;;