Date : Mon, 27 Jan 2014 18:38:17 +0000
From : jgh@... (J.G.Harston)
Subject: Crunching BASIC code
I'm updating some code that crunches tokenised BASIC code[1], and want
to check something.
outside quoted strings, is it correct that any spaces immediately
before a token and immediately after a token can be stripped out, eg:
(spc)(spc)[token](spc)(spc)[token](spc)[token] etc. can be safely
crunched to:
[token][token][token] etc.
Running through it in my head it certainly seems correct, and my PDP11
BASIC internals work that way, and I've never had any problems crunching
code that way.
Similarly, is it correct that spaces before and after an arithmetic
operator can be stripped, eg
(anything)(spaces)+(spaces)(anything)(spaces)*(spaces)(anything) can be
safely crunched to:
(anything)+(anything)*(anything)
I'm sure I read an Acorn User or Micro User article on this years ago,
but cannot find it.
[1]mdfs.net/Software/CommandSrc/BasUtils/Crunching
--
J.G.Harston - jgh@... - mdfs.net