Skip to content

Commit db3d400

Browse files
committed
re-organize PASM internals to hold everything in a top level list; should make changing PASM (e.g. for ditto) easier in the future
1 parent bd74f37 commit db3d400

File tree

18 files changed

+151
-68
lines changed

18 files changed

+151
-68
lines changed

Test/stest071.spin

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ pub blink(pin, n)
44
return entry
55

66
dat
7-
entry
8-
long $11223344
7+
entry long $11223344
98
foo
109
long @@@foo
1110

Test/stest124.spin

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
dat
2+
long
23
bas_tx_handles
34
long 0[8]
45

Test/stest196.spin

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ CON
33
__ = 2
44

55
DAT
6-
myarray
7-
byte 1
6+
myarray byte 1
87
byte long 2, 3
98
dummy1
109
byte 4

Test/test064.spin

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ PUB getit
66
return @entry
77

88
DAT
9-
10-
entry
11-
long float(y)
9+
entry long float(y)
1210
long trunc(pi)
1311
long round(3.6)

Test/test077.spin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PUB dummy
88
return @arr[0]
99

1010
DAT
11-
11+
long
1212
arr
1313
long onef
1414
long twof

Test/test104.spin

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ PUB get
55
return @stuff
66

77
DAT
8-
stuff
9-
long foo
8+
stuff long foo
109
long bar
1110
long baz

Test/test155.spin

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ entry
44
cmp par, #"ß" wz
55
cmp par, #$df wz
66
nop
7-
sval
8-
byte "ß", 0
7+
sval byte "ß", 0
98

109
pub get
1110
return sval[0]

ast.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,14 @@ static void doASTDump(AST *ast, int indent)
10871087
case AST_THROW:
10881088
sprintf(buf, "<throw %" PRId64 ">", ast->d.ival);
10891089
break;
1090+
case AST_LINEBREAK:
1091+
if (ast->left) {
1092+
sprintf(buf, "<linebreak>");
1093+
} else {
1094+
sprintf(buf, "<linebreak/>");
1095+
leaf = 1;
1096+
}
1097+
break;
10901098
default:
10911099
idx = (unsigned int)ast->kind;
10921100
if (idx < sizeof(astnames) / sizeof(astnames[0])) {

backends/asm/inlineasm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ CompileTraditionalInlineAsm(IRList *irl, AST *origtop, unsigned asmFlags)
571571
asmNest = 0;
572572
state[asmNest].is_active = true;
573573
while (top) {
574-
ast = top;
574+
ast = top->left;
575575
top = top->right;
576576
while (ast && ast->kind == AST_COMMENTEDNODE) {
577577
ast = ast->left;
@@ -638,9 +638,9 @@ CompileTraditionalInlineAsm(IRList *irl, AST *origtop, unsigned asmFlags)
638638
}
639639
firstir = NULL;
640640
while(top) {
641-
ast = top;
641+
ast = top->left;
642642
top = top->right;
643-
if (ast->kind == AST_LINEBREAK) {
643+
if (ast && ast->kind == AST_LINEBREAK) {
644644
continue;
645645
}
646646
while (ast && ast->kind == AST_COMMENTEDNODE) {

backends/dat/outdat.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// binary data output for spin2cpp
33
//
4-
// Copyright 2012-2024 Total Spectrum Software Inc.
4+
// Copyright 2012-2025 Total Spectrum Software Inc.
55
// see the file COPYING for conditions of redistribution
66
//
77
#include <stdio.h>
@@ -2068,11 +2068,10 @@ PrintDataBlock(Flexbuf *f, AST *list, DataBlockOutFuncs *funcs, Flexbuf *relocs)
20682068
return;
20692069
top = list;
20702070
while (top) {
2071-
ast = top;
2072-
if (top->kind == AST_COMMENTEDNODE) {
2073-
top = SendComments(f, top->right, relocs);
2074-
} else {
2075-
top = top->right;
2071+
ast = top->left;
2072+
top = top->right;
2073+
if (ast && ast->kind == AST_COMMENTEDNODE) {
2074+
SendComments(f, ast, relocs);
20762075
}
20772076
while (ast && ast->kind == AST_COMMENTEDNODE) {
20782077
if (startAst) {

0 commit comments

Comments
 (0)