BBx-Kitchen / bbj-language-server

BBj Language Server
MIT License
7 stars 6 forks source link

PRINT @ - mnemonic #58

Closed StephanWald closed 1 year ago

StephanWald commented 1 year ago
print (printchan) @(3), r
print (printchan) @(0,22), r

https://documentation.basis.cloud/BASISHelp/WebHelp/usr/Character_Devices/General/using_mnemonics.htm

StephanWald commented 1 year ago

More comprehensive sample about Mnemonics:

REM using mnemonic in output:
PRINT 'CS','BR',@(0,0),"Hello World",'ER',@(10,10),"This is a Demo",@(0,20),

PRINT (0)'CS','BR',@(0,0),"Hello World",'ER',@(10,10),"This is a Demo",@(0,20),

REM but it's also allowed in INPUT 
INPUT 'CS','BR',@(0,0),"Hello World",'ER',@(10,10),"Enter your name:",@(30),X$

REM for completeness sake an even more complex input:
INPUT (0,err=*same)'CS','BR',@(0,0),"Hello World",'ER',@(10,10),"Enter your name: ",'CL',X$:(""=fin,LEN=1,24)

rem Mnemonics are in a way like Strings:
X$='CS'+'BR'+@(0,0)+"Hello World"+'ER'+@(10,10)+"This is a Demo"+@(0,20)
PRINT X$,

REM Hence, they can also be concatenated with plus during output:
PRINT 'CS'+'BR'+@(0,0)+"Hello World"+'ER'+@(10,10)+"This is a Demo"+@(0,20),

fin:
release
dhuebner commented 1 year ago

@StephanWald It is not clear to me from the documentation if a variables can be used in mnemonics. Is following valid?

x=1, y=2
@(x, y)
StephanWald commented 1 year ago

Yes, any number or string in any of the mnemonics (not only this specific one) can be a variable

dhuebner commented 1 year ago

@StephanWald Your example is now part of the automatic tests and is passing.