Allowed long tokens within comments (typically URLs)

This commit is contained in:
Andrew Alderwick 2021-08-25 22:56:24 +01:00
parent 5b4ec0be6b
commit 61b8750bae
2 changed files with 8 additions and 6 deletions

View File

@ -56,7 +56,7 @@
( returns the next number in a 65,535-long sequence,
which is never zero but every other 16-bit number
appears once before the sequence repeats )
( http://www.retroprogramming.com/2017/07/ xorshift-pseudorandom-numbers-in-z80.html )
( http://www.retroprogramming.com/2017/07/xorshift-pseudorandom-numbers-in-z80.html )
,&seed LDR2
DUP2 #70 SFT2 EOR2
DUP2 #09 SFT2 EOR2
@ -68,7 +68,7 @@
@prng2 ( -- number* )
( returns the next number in a (2^32-1)-long sequence )
( http://b2d-f9r.blogspot.com/2010/08/ 16-bit-xorshift-rng-now-with-more.html )
( http://b2d-f9r.blogspot.com/2010/08/16-bit-xorshift-rng-now-with-more.html )
,&x LDR2
DUP2 #50 SFT2 EOR2
DUP2 #03 SFT2 EOR2

View File

@ -157,12 +157,12 @@ makemacro(char *name, FILE *f)
return error("Macro name is invalid", name);
m = &p.macros[p.mlen++];
scpy(name, m->name, 64);
while(fscanf(f, "%s", word)) {
while(fscanf(f, "%63s", word)) {
if(word[0] == '{') continue;
if(word[0] == '}') break;
if(m->len > 64)
return error("Macro too large", name);
if(slen(word) >= 64)
if(slen(word) >= 63)
return error("Word too long", name);
scpy(word, m->items[m->len++], 64);
}
@ -290,8 +290,10 @@ pass1(FILE *f)
int ccmnt = 0;
Uint16 addr = 0;
char w[64], scope[64], subw[64];
while(fscanf(f, "%s", w) == 1) {
while(fscanf(f, "%63s", w) == 1) {
if(skipblock(w, &ccmnt, '(', ')')) continue;
if(slen(w) == 63)
fprintf(stderr, "Warning: token beginning with \"%s\" is too long\n", w);
if(w[0] == '|') {
if(!sihx(w + 1))
return error("Pass 1 - Invalid padding", w);
@ -320,7 +322,7 @@ pass2(FILE *f)
{
int ccmnt = 0, cmacr = 0;
char w[64], scope[64], subw[64];
while(fscanf(f, "%s", w) == 1) {
while(fscanf(f, "%63s", w) == 1) {
if(w[0] == '%') continue;
if(w[0] == '&') continue;
if(w[0] == '[') continue;