Skip to content

Commit

Permalink
Merge pull request #412 from paulscottrobson/decimals
Browse files Browse the repository at this point in the history
Decimal tokenisation fix
  • Loading branch information
paulscottrobson authored Apr 4, 2024
2 parents 3d477e1 + 4140c87 commit 0d0a732
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
Binary file modified basic/scripts/__pycache__/tokeniser.cpython-311.pyc
Binary file not shown.
27 changes: 23 additions & 4 deletions basic/sources/editing/tokenise/helpers/tokio.asm
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,42 @@ _TEILoop:
bcc _TEIEndMainID
jsr TOKGetNext ; get and consume
jsr TOKToUpper ; capitalise it and add it
jsr _TEIAddChar
jsr TEIAddChar
bra _TEILoop
_TEIEndMainID:
cmp #"$" ; do we have a string ?
bne _TEINotString
jsr _TEIAddChar ; add it
jsr TEIAddChar ; add it
jsr TOKGetNext ; consume $
jsr TOKGet ; get next
_TEINotString:
cmp #"(" ; do we have an array ?
bne _TEINotArray
jsr _TEIAddChar ; add (
jsr TEIAddChar ; add (
jsr TOKGetNext ; consume (
_TEINotArray:
rts

_TEIAddChar:
; ************************************************************************************************
;
; Extract sequence of digits into the tokElement buffer
;
; ************************************************************************************************

TOKExtractDigits:
stz tokElement
_TEDLoop:
jsr TOKGet ; get next, check end of token text
beq _TEDEndDigits ; end of line
jsr TOKIsDigit ; check digit
bcc _TEDEndDigits
jsr TOKGetNext ; get and consume and add
jsr TEIAddChar
bra _TEDLoop
_TEDEndDigits:
rts

TEIAddChar:
inc tokElement ; add it.
ldx tokElement
sta tokElement,x
Expand Down
3 changes: 1 addition & 2 deletions basic/sources/editing/tokenise/workers/tok_intconstant.asm
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
; ************************************************************************************************

TokeniseIntConst:
jsr TOKExtractIdentifier ; extract an identifier into the tokElement Buffer

jsr TOKExtractDigits ; extract an identifier into the tokElement Buffer
lda #tokElement & $FF ; set up to convert it.
sta ControlParameters+4
lda #tokElement >> 8
Expand Down
20 changes: 1 addition & 19 deletions basic/test.bsc
Original file line number Diff line number Diff line change
@@ -1,19 +1 @@
0 ' library line
0 ' another library line
rect 10,10 solid ink 2 to 100,100 to 110,120 to 130,440 to 140,500
edit
cls
for i = 0 to 100
for j = 0 to 100
doke $FF04,i:doke $FF06,j:poke $FF08,c
call send.message(5,39)
c = (c + 1) & $FF
next
next
end

proc send.message(g,f)
while peek($FF00):wend
poke $FF01,f:poke $FF00,g
while peek($FF00):wend
endproc
10 print 1.2

0 comments on commit 0d0a732

Please sign in to comment.