diff options
Diffstat (limited to 'examples/listId1.lua')
-rw-r--r-- | examples/listId1.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/listId1.lua b/examples/listId1.lua index 9bba783..e045ac1 100644 --- a/examples/listId1.lua +++ b/examples/listId1.lua | |||
@@ -7,8 +7,8 @@ local g = m.P{ | |||
7 | "S", | 7 | "S", |
8 | S = m.V"Id" * m.V"List", | 8 | S = m.V"Id" * m.V"List", |
9 | List = -m.P(1) + m.V"Comma" * m.V"Id" * m.V"List", | 9 | List = -m.P(1) + m.V"Comma" * m.V"Id" * m.V"List", |
10 | Id = m.V"Sp" * id + m.T(1), | 10 | Id = m.V"Sp" * id + m.T'ErrId', |
11 | Comma = m.V"Sp" * "," + m.T(2), | 11 | Comma = m.V"Sp" * "," + m.T'ErrComma', |
12 | Sp = m.S" \n\t"^0, | 12 | Sp = m.S" \n\t"^0, |
13 | } | 13 | } |
14 | 14 | ||
@@ -17,9 +17,9 @@ function mymatch (g, s) | |||
17 | if not r then | 17 | if not r then |
18 | local line, col = re.calcline(s, pos) | 18 | local line, col = re.calcline(s, pos) |
19 | local msg = "Error at line " .. line .. " (col " .. col .. ")" | 19 | local msg = "Error at line " .. line .. " (col " .. col .. ")" |
20 | if e == 1 then | 20 | if e == 'ErrId' then |
21 | return r, msg .. ": expecting an identifier before '" .. s:sub(pos) .. "'" | 21 | return r, msg .. ": expecting an identifier before '" .. s:sub(pos) .. "'" |
22 | elseif e == 2 then | 22 | elseif e == 'ErrComma' then |
23 | return r, msg .. ": expecting ',' before '" .. s:sub(pos) .. "'" | 23 | return r, msg .. ": expecting ',' before '" .. s:sub(pos) .. "'" |
24 | else | 24 | else |
25 | return r, msg | 25 | return r, msg |