Skip to content

Commit a4f160a

Browse files
committed
Don't match a variable name if it is followed by a dot.
This fixes conflicts between variable names and abbreviated function names.
1 parent 2d47fe5 commit a4f160a

4 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/compiler/parser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ class parse {
238238
ret += c;
239239
pos ++;
240240
}
241+
else if( c == '.' )
242+
return false;
241243
else
242244
break;
243245
}

src/vars.asm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ next:
183183
jsr check_char
184184
bcc next
185185

186+
; Check if there is a dot after the name, and reject
187+
cmp #'.'
188+
beq exit_2
189+
186190
.byte $2C ; Skips two PLA
187191
exit_2:
188192
pla

testsuite/tests/abbrev.bas

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ DPOKE 1536, 1234
55
? SGN ABS DPEEK 1536
66
? D.(1536) + D. 1536
77
? E. , CHR$ 65 , STR$ 65
8+
E = 10
9+
? E.
10+
D = 3
11+
? D.(1536) + D. 1536
812
A = 1
913
? ABSA
1014
ABSA = 10
1115
? ABSA
12-

testsuite/tests/abbrev.chk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ Start
77
2468
88
1 A 65
99
1
10+
2468
11+
1
1012
10

0 commit comments

Comments
 (0)