[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [StrongED] Re: v4.70a12 BASIC Assembler comments



In message <5689534530list01@xxxxxxxxxxxxxxxx>
          Martin <list01@xxxxxxxxxxxxxxxx> wrote:

> On 11 Oct in article <187c4d8956.fjgraute@xxxxxxxxx>,
>    Fred Graute <fjgraute@xxxxxxxxx> wrote:
> > In message <568862453dlist01@xxxxxxxxxxxxxxxx>
> >           Martin <list01@xxxxxxxxxxxxxxxx> wrote:
> 
> > > I think there is a problem with assembler comments in BASIC...
> > > 
> > > When using both BASIC and BasAsm modes, if a comment within [...]
> > > assembler statements is preceeded by either ; or \ then any BASIC
> > > keywords which happen to be in the comment are tokenised. 

[snip]

> > You can turn off the option 'Detect ASM sections' in Global Choices ->
> > BASIC to go back to the old behaviour.
> 
> Thanks for the explanation, Fred. 
> Turning that option off does seem to fix the problem.
> 
> However, it all still seems backwards to me!
> Surely anything in a comment should not be tokenized?

Ideally, yes, but BASIC tokenises line by line so it never sees the full
program. It's only during execution that BASIC seems to keep track of
whether it's in an assembler section or not.

> Hmmm. But I see that BASIC tokenises comments after ;\ but not after REM.
> Perhaps it is a BASIC bug?

The reason I'm guessing is that REM is known to be followed by a
comment. For ;\ this is only the case when in an assembler section.
As ; can be used in INPUT, PRINT, and VDU you'd have to check the
context carefully.

It might be possible to see if a ; starts a comment by checking that
it's not part of keyword or in a string. Question is how reliable this
is and how much work to implement it. Also, what if it's just a typo
(missed Shift on ':') would that lead to an unexpected result?

The experiments with (de-) tokenisation of BASIC in 4.70a12 have shown
me that it's quite a tricky thing, lots of pitfalls. In particular if
you're dealing with selections where you may not have the full context.

Cheers,
Fred.

-- 
StrongED Developer
http://www.stronged.iconbar.com/

--=20
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxx
List archives at http://www.Torrens.org/RO/StrongED/index.html