feat(parser): read the TEXT and GLOBL operands the toolchain counts them
Assisted-by: GLM 5.3 Flash
This commit is contained in:
1 parent
cea5db6964
commit
431d0d9b0b
3 files changed
+262
-31
No files matched your search
+6
-15
@@ -62,23 +62,14 @@ var flagOrder = []struct {
|
||||
{"ABIWRAPPER", 4096},
|
||||
}
|
||||
|
||||
// flagsRun returns the flags operand of a TEXT or GLOBL directive: the
|
||||
// tokens after the symbol up to the frame operand's '$', with comments and
|
||||
// the one trailing comma that separated the operand from the '$' removed.
|
||||
// flagsRun prepares one flags operand for evaluation: the comments are
|
||||
// dropped, they are layout the expression never sees.
|
||||
func flagsRun(g []token.Token) []token.Token {
|
||||
n := 0
|
||||
for n < len(g) && g[n].Kind != token.Dollar {
|
||||
n++
|
||||
}
|
||||
out := make([]token.Token, 0, n)
|
||||
for _, t := range g[:n] {
|
||||
if t.Kind == token.Comment {
|
||||
continue
|
||||
out := make([]token.Token, 0, len(g))
|
||||
for _, t := range g {
|
||||
if t.Kind != token.Comment {
|
||||
out = append(out, t)
|
||||
}
|
||||
out = append(out, t)
|
||||
}
|
||||
if len(out) > 0 && out[len(out)-1].Kind == token.Comma {
|
||||
out = out[:len(out)-1]
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user