mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Report errors at EOL as errors at next line.
This commit is contained in:
parent
8d1e819771
commit
0a7d409a4e
1 changed files with 5 additions and 2 deletions
|
@ -38,8 +38,11 @@ def fieldpos(inp, sep, n):
|
|||
class EParse(Exception):
|
||||
|
||||
def __init__(self, parser, msg):
|
||||
lno = parser.script.count('\n', 0, parser.errorpos)
|
||||
cno = parser.errorpos - fieldpos(parser.script, '\n', lno)
|
||||
errorpos = parser.errorpos
|
||||
if parser.script[errorpos:errorpos+1] == '\n':
|
||||
errorpos += 1
|
||||
lno = parser.script.count('\n', 0, errorpos)
|
||||
cno = errorpos - fieldpos(parser.script, '\n', lno)
|
||||
# Note the column number reported is in bytes.
|
||||
|
||||
msg = u"(Line %d char %d): ERROR: %s" % (lno + 1, cno + 1, msg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue