Skip to content

Commit 4ad5660

Browse files
committed
fixes #15
1 parent 882c5ee commit 4ad5660

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

lua-parser/parser.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,8 @@ function parser.parse (subject, filename)
463463
lpeg.setmaxstack(1000)
464464
local ast, label, sfail = lpeg.match(G, subject, nil, errorinfo)
465465
if not ast then
466-
local errpos = #subject-#sfail+1
467466
local errmsg = labels[label][2]
468-
return ast, syntaxerror(errorinfo, errpos, errmsg)
467+
return ast, syntaxerror(errorinfo, sfail, errmsg)
469468
end
470469
return validate(ast, errorinfo)
471470
end
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--*-lua-*--
2+
package = "lua-parser"
3+
version = "1.0.1-1"
4+
source = {
5+
url = "git://github.com/andremm/lua-parser",
6+
tag = "v1.0.0",
7+
}
8+
description = {
9+
summary = "A Lua 5.3 parser written with LPegLabel",
10+
detailed = [[
11+
This is a Lua 5.3 parser written with LPegLabel that generates an AST in
12+
the format specified by Metalua.
13+
The parser uses LPegLabel to provide more specific error messages.
14+
]],
15+
homepage = "https://github.com/andremm/lua-parser",
16+
license = "MIT"
17+
}
18+
dependencies = {
19+
"lua >= 5.1",
20+
"lpeglabel >= 1.6.0",
21+
}
22+
build = {
23+
type="builtin",
24+
modules={
25+
["lua-parser.parser"] = "lua-parser/parser.lua",
26+
["lua-parser.pp"] = "lua-parser/pp.lua",
27+
["lua-parser.scope"] = "lua-parser/scope.lua",
28+
["lua-parser.validator"] = "lua-parser/validator.lua",
29+
}
30+
}
31+

0 commit comments

Comments
 (0)