fix some js errors :3

This commit is contained in:
Mewrry the Kitty 2026-01-03 14:55:15 -06:00
parent f508089e34
commit 51ea28a804
3 changed files with 18 additions and 24 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/itty/

View file

@ -82,14 +82,14 @@ function showHelp(){
"\t<filename> is the `.spin' or `.spinc' file to\n" + "\t<filename> is the `.spin' or `.spinc' file to\n" +
"\t compile/run\n" + "\t compile/run\n" +
"Flags:\n" + "Flags:\n" +
"\t—help Print this help page and exit.\n" "\t—help Print this help page and exit.\n" +
"\t—version Print version and exit.\n" "\t—version Print version and exit.\n" +
"\t—compile Compile the code to a .spinc file.\n" + "\t—compile Compile the code to a .spinc file.\n" +
"\t The .spinc file must be specified\n" + "\t The .spinc file must be specified\n" +
"\t with `—output'.\n" + "\t with `—output'.\n" +
"\t—output <file> Specifies the output file for the\n" + "\t—output <file> Specifies the output file for the\n" +
"\t `—compile' flag.\n" + "\t `—compile' flag.\n"
) );
}; };
function showVersion(){ function showVersion(){
@ -98,7 +98,7 @@ function showVersion(){
// ^ // ^
"Spinny for itty\n" + "Spinny for itty\n" +
"Version 0.0.3\n" + "Version 0.0.3\n" +
"Known spinc versions:\n" "Known spinc versions:\n" +
" • `noversion'\n" " • `noversion'\n"
) )
}; };
@ -169,7 +169,7 @@ function parseCliArgs() {
class spinnyParser { class spinnyParser {
const INSIDE = { INSIDE = {
FILE: 0, FILE: 0,
INTER: 1, INTER: 1,
LAZY: 2 LAZY: 2
@ -264,32 +264,25 @@ class spinnyParser {
parseWord(inside) { parseWord(inside) {
this.debugStack.push(["Word", this.index]) this.debugStack.push(["Word", this.index])
let bang = false; let bang = false;
let word = {}
word[CMPVER.KEYS.BANG] = false;
if (this.now() === "!") { if (this.now() === "!") {
bang = true; word[CMPVER.KEYS.BANG] = true;
this.next(); this.next();
} }
switch (this.now()) { switch (this.now()) {
case "{": case "{":
return { word[CMPVER.KEYS.TYPE] = CMPVER.TYPE.LAZY;
CMPVER.KEYS.BANG:bang, word[CMPVER.KEYS.LINES] = this.parseLazy();
CMPVER.KEYS.TYPE:CMPVER.TYPE.LAZY,
CMPVER.KEYS.LINES:this.parseLazy()
}
case "`": case "`":
return { word[CMPVER.KEYS.TYPE] = CMPVER.TYPE.LIT;
CMPVER.KEYS.BANG:bang, word[CMPVER.KEYS.PARTS] = this.parseLiteral();
CMPVER.KEYS.TYPE:CMPVER.TYPE.LIT,
CMPVER.KEYS.PARTS:this.parseLiteral()
}
default: default:
return { word[CMPVER.KEYS.TYPE] = CMPVER.TYPE.ID;
CMPVER.KEYS.BANG:bang, word[CMPVER.KEYS.PARTS] = this.parseIdentifier(inside);
CMPVER.KEYS.TYPE:CMPVER.TYPE.ID,
CMPVER.KEYS.PARTS:this.parseIdentifier(inside)
}
} }
this.debugStack.pop() this.debugStack.pop()
return word
} }
parseLazy() { parseLazy() {

File diff suppressed because one or more lines are too long