fix(parser): fold a signed parenthesised displacement expression
Test / test (push) Failing after 2m21s
Test / test (push) Failing after 2m21s
Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -552,6 +552,20 @@ func parseAddress(g []token.Token) ast.Address {
|
||||
i = len(g) - len(rest)
|
||||
}
|
||||
}
|
||||
// The same expression under a leading sign: -(24+8)(X6) puts the sign
|
||||
// outside the fold. The base group must follow for the value to
|
||||
// commit, exactly as in the unsigned branch above.
|
||||
if i < len(g) && (g[i].Kind == token.Minus || g[i].Kind == token.Plus) &&
|
||||
i+1 < len(g) && g[i+1].Kind == token.LParen {
|
||||
if v, rest, ok := foldExpr(g[i+1:]); ok && len(rest) > 0 && rest[0].Kind == token.LParen {
|
||||
if g[i].Kind == token.Minus {
|
||||
v = -v
|
||||
}
|
||||
addr.Offset = v
|
||||
addr.HasOff = true
|
||||
i = len(g) - len(rest)
|
||||
}
|
||||
}
|
||||
// Optional leading displacement before a '(' base group. A sign pushes
|
||||
// the parenthesis one token further out: -4(DX) has it at i+2.
|
||||
if isSignedNumber(g, i) {
|
||||
|
||||
Reference in New Issue
Block a user