1 | -- To test how all ASDL construct generate typed code.
|
2 |
|
3 | module shared_variant {
|
4 |
|
5 | prod = (string a, string b)
|
6 |
|
7 | DoubleQuoted = (int left, string* tokens)
|
8 |
|
9 | expr =
|
10 | Binary(expr left, expr right)
|
11 | -- Use the existing TYPE DoubleQuoted, but create a new TAG
|
12 | -- expr_e.DoubleQuoted.
|
13 | | DoubleQuoted %DoubleQuoted
|
14 |
|
15 | Token = (int id, string val)
|
16 |
|
17 | tok =
|
18 | Eof
|
19 | | Token %Token
|
20 |
|
21 | tok_struct = (tok token, int x)
|
22 | tok_array = (tok* tokens)
|
23 |
|
24 | word_part =
|
25 | Literal(string s)
|
26 | | DoubleQuoted %DoubleQuoted
|
27 | -- Comment out to test build-time error
|
28 | -- | ErrorIsDuplicate %DoubleQuoted
|
29 |
|
30 | -- Make sure we didn't break these variants
|
31 | cflow = Break | Continue | Return(int val)
|
32 | }
|