diff options
Diffstat (limited to 'examples/typedlua/tlparser.lua')
-rw-r--r-- | examples/typedlua/tlparser.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/typedlua/tlparser.lua b/examples/typedlua/tlparser.lua index c8d03ea..2180812 100644 --- a/examples/typedlua/tlparser.lua +++ b/examples/typedlua/tlparser.lua | |||
@@ -161,7 +161,7 @@ local G = lpeg.P { "TypedLua"; | |||
161 | ForNum = lpeg.V("Id") * tllexer.symb("=") * lpeg.V("Expr") * tllexer.symb(",") * | 161 | ForNum = lpeg.V("Id") * tllexer.symb("=") * lpeg.V("Expr") * tllexer.symb(",") * |
162 | lpeg.V("Expr") * (tllexer.symb(",") * lpeg.V("Expr"))^-1 * | 162 | lpeg.V("Expr") * (tllexer.symb(",") * lpeg.V("Expr"))^-1 * |
163 | lpeg.V("ForBody"); | 163 | lpeg.V("ForBody"); |
164 | ForGen = lpeg.V("NameList") * tllexer.kw("in") * | 164 | ForGen = lpeg.V("NameList") * tllexer.try(tllexer.kw("in"), "ForGen") * |
165 | lpeg.V("ExpList") * lpeg.V("ForBody"); | 165 | lpeg.V("ExpList") * lpeg.V("ForBody"); |
166 | ForStat = tllexer.kw("for") * (lpeg.V("ForNum") + lpeg.V("ForGen")) * tllexer.try(tllexer.kw("end"), "ForEnd"); | 166 | ForStat = tllexer.kw("for") * (lpeg.V("ForNum") + lpeg.V("ForGen")) * tllexer.try(tllexer.kw("end"), "ForEnd"); |
167 | RepeatStat = tllexer.kw("repeat") * lpeg.V("Block") * | 167 | RepeatStat = tllexer.kw("repeat") * lpeg.V("Block") * |
@@ -172,13 +172,13 @@ local G = lpeg.P { "TypedLua"; | |||
172 | ParList = lpeg.V("NameList") * (tllexer.symb(",") * tllexer.try(lpeg.V("TypedVarArg"), "ParList"))^-1 + | 172 | ParList = lpeg.V("NameList") * (tllexer.symb(",") * tllexer.try(lpeg.V("TypedVarArg"), "ParList"))^-1 + |
173 | lpeg.V("TypedVarArg"); | 173 | lpeg.V("TypedVarArg"); |
174 | TypedVarArg = tllexer.symb("...") * (tllexer.symb(":") * tllexer.try(lpeg.V("Type"), "Type"))^-1; | 174 | TypedVarArg = tllexer.symb("...") * (tllexer.symb(":") * tllexer.try(lpeg.V("Type"), "Type"))^-1; |
175 | FuncBody = tllexer.symb("(") * lpeg.V("ParList")^-1 * tllexer.try(tllexer.symb(")"), "MissingCP") * | 175 | FuncBody = tllexer.try(tllexer.symb("("), "MissingOP") * lpeg.V("ParList")^-1 * tllexer.try(tllexer.symb(")"), "MissingCP") * |
176 | (tllexer.symb(":") * tllexer.try(lpeg.V("RetType"), "Type"))^-1 * | 176 | (tllexer.symb(":") * tllexer.try(lpeg.V("RetType"), "Type"))^-1 * |
177 | lpeg.V("Block") * tllexer.try(tllexer.kw("end"), "FuncEnd"); | 177 | lpeg.V("Block") * tllexer.try(tllexer.kw("end"), "FuncEnd"); |
178 | FuncStat = tllexer.kw("const")^-1 * | 178 | FuncStat = tllexer.kw("const")^-1 * |
179 | tllexer.kw("function") * lpeg.V("FuncName") * lpeg.V("FuncBody"); | 179 | tllexer.kw("function") * lpeg.V("FuncName") * lpeg.V("FuncBody"); |
180 | LocalFunc = tllexer.kw("function") * | 180 | LocalFunc = tllexer.kw("function") * |
181 | lpeg.V("Id") * lpeg.V("FuncBody"); | 181 | tllexer.try(lpeg.V("Id"), "LocalFunc") * lpeg.V("FuncBody"); |
182 | LocalAssign = lpeg.V("NameList") * | 182 | LocalAssign = lpeg.V("NameList") * |
183 | ((tllexer.symb("=") * tllexer.try(lpeg.V("ExpList"), "LocalAssign")))^-1; | 183 | ((tllexer.symb("=") * tllexer.try(lpeg.V("ExpList"), "LocalAssign")))^-1; |
184 | LocalStat = tllexer.kw("local") * | 184 | LocalStat = tllexer.kw("local") * |