Skip to content

Commit

Permalink
Include registers with operators in checks
Browse files Browse the repository at this point in the history
  • Loading branch information
DerelictDrone committed Nov 19, 2023
1 parent 9e2846f commit b2dff2c
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions lua/wire/client/hlzasm/hc_syntax.lua
Original file line number Diff line number Diff line change
Expand Up @@ -826,15 +826,15 @@ function HCOMP:Statement() local TOKEN,TOKENSET = self.TOKEN,self.TOKENSET
local tokenType = self.TokenType
if self.BlockDepth > 0 then
while self:MatchToken(TOKEN.REGISTER) or self:MatchToken(TOKEN.IDENT) do
-- Don't error on catching a variable being used near a zap/preserve
if self:MatchToken(TOKENSET.OPERATORS) then
-- move back 2 tokens and then re-parse this
self:PreviousToken()
self:PreviousToken()
return self:Statement()
end
if self.TokenType == TOKEN.IDENT then
if self.RegisterIdentities[self.TokenData] then
-- Don't error on catching a variable being used near a zap/preserve
if self:MatchToken(TOKENSET.OPERATORS) then
-- move back 2 tokens and then re-parse this
self:PreviousToken()
self:PreviousToken()
return self:Statement()
end
if tokenType == TOKEN.PRESERVE then
self:Error("Trying to preserve a register variable")
end
Expand All @@ -847,18 +847,10 @@ function HCOMP:Statement() local TOKEN,TOKENSET = self.TOKEN,self.TOKENSET
self:Error("Cannot zap ranges using register variables")
end
else
-- Don't error on catching a variable being used near a zap/preserve
if self:MatchToken(TOKEN.DCOLON) or self:MatchToken(TOKENSET.OPERATORS) then
-- move back 2 tokens and then re-parse this
self:PreviousToken()
self:PreviousToken()
return self:Statement()
else
if tokenType == TOKEN.PRESERVE then
self:Error("Trying to preserve a variable")
end
self:Error("Trying to zap a non register variable")
if tokenType == TOKEN.PRESERVE then
self:Error("Trying to preserve a variable")
end
self:Error("Trying to zap a non register variable")
end
end
if self.TokenType == TOKEN.REGISTER then
Expand Down

0 comments on commit b2dff2c

Please sign in to comment.