mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 08:39:30 +00:00
[internal] fix incorrect source tracking when reaching end of multiline expresssion
This commit is contained in:
parent
13ce7a2efa
commit
d04344e9ff
3 changed files with 9 additions and 3 deletions
|
|
@ -12,10 +12,10 @@ Source = class {
|
|||
self.line = line
|
||||
self.position = position
|
||||
end,
|
||||
increment = function(self, n, ...)
|
||||
increment = function(self, n)
|
||||
self.position = self.position + n
|
||||
end,
|
||||
increment_line = function(self, n, ...)
|
||||
increment_line = function(self, n)
|
||||
self.line = self.line + n
|
||||
end,
|
||||
count = function(self, capture, ...)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ return {
|
|||
-- returns exp, rem if expression found
|
||||
-- returns nil if no expression found
|
||||
search = function(self, source, options, str)
|
||||
local start_source = source:clone()
|
||||
str = source:consume_leading_whitespace(options, str)
|
||||
-- if there is a comment, restart the parsing after the comment ends
|
||||
local c, c_rem = comment:search(source, options, str)
|
||||
|
|
@ -45,5 +46,7 @@ return {
|
|||
local exp, rem = primary:search(source, options, str)
|
||||
if exp then return exp, rem end
|
||||
end
|
||||
-- nothing found, revert state change
|
||||
source:set(start_source)
|
||||
end
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ return {
|
|||
-- returns exp, rem if expression found
|
||||
-- returns nil if no expression found
|
||||
search = function(self, source, options, str, current_priority, primary)
|
||||
local start_source = source:clone()
|
||||
str = source:consume_leading_whitespace(options, str)
|
||||
-- if there is a comment, restart the parsing after the comment ends
|
||||
local c, c_rem = comment:search(source, options, str)
|
||||
|
|
@ -64,5 +65,7 @@ return {
|
|||
local exp, rem = secondary:search(source, options, str, current_priority, primary)
|
||||
if exp then return exp, rem end
|
||||
end
|
||||
-- nothing found, revert state change
|
||||
source:set(start_source)
|
||||
end
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue