mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Fix parsing, so it accurately captures command args
This commit is contained in:
parent
e2bff06aeb
commit
c2fcbbeb72
1 changed files with 5 additions and 3 deletions
|
@ -40,15 +40,17 @@ define [], () ->
|
||||||
|
|
||||||
# Ignore single letter commands since auto complete is moot then.
|
# Ignore single letter commands since auto complete is moot then.
|
||||||
# Ignore commands which occur after a comment character '%'
|
# Ignore commands which occur after a comment character '%'
|
||||||
commandRegex: /^[^%]*?\\([a-zA-Z][a-zA-Z]+).*$/m
|
commandRegex: /^([^%]*?)\\([a-zA-Z][a-zA-Z]+)/m
|
||||||
|
|
||||||
nextCommand: () ->
|
nextCommand: () ->
|
||||||
i = @doc.search(@commandRegex)
|
i = @doc.search(@commandRegex)
|
||||||
if i == -1
|
if i == -1
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
match = @doc.match(@commandRegex)[1]
|
matchObject = @doc.match(@commandRegex)
|
||||||
@doc = @doc.substr(i + match.length + 1)
|
preMatch = matchObject[1]
|
||||||
|
match = matchObject[2]
|
||||||
|
@doc = @doc.substr(i + preMatch.length + match.length + 1)
|
||||||
return match
|
return match
|
||||||
|
|
||||||
consumeWhitespace: () ->
|
consumeWhitespace: () ->
|
||||||
|
|
Loading…
Reference in a new issue