fix some js errors :3
This commit is contained in:
parent
f508089e34
commit
51ea28a804
3 changed files with 18 additions and 24 deletions
39
spinny.js
39
spinny.js
|
|
@ -82,14 +82,14 @@ function showHelp(){
|
|||
"\t<filename> is the `.spin' or `.spinc' file to\n" +
|
||||
"\t compile/run\n" +
|
||||
"Flags:\n" +
|
||||
"\t—help Print this help page and exit.\n"
|
||||
"\t—version Print version and exit.\n"
|
||||
"\t—help Print this help page and exit.\n" +
|
||||
"\t—version Print version and exit.\n" +
|
||||
"\t—compile Compile the code to a .spinc file.\n" +
|
||||
"\t The .spinc file must be specified\n" +
|
||||
"\t with `—output'.\n" +
|
||||
"\t—output <file> Specifies the output file for the\n" +
|
||||
"\t `—compile' flag.\n" +
|
||||
)
|
||||
"\t `—compile' flag.\n"
|
||||
);
|
||||
};
|
||||
|
||||
function showVersion(){
|
||||
|
|
@ -98,7 +98,7 @@ function showVersion(){
|
|||
// ^
|
||||
"Spinny for itty\n" +
|
||||
"Version 0.0.3\n" +
|
||||
"Known spinc versions:\n"
|
||||
"Known spinc versions:\n" +
|
||||
" • `noversion'\n"
|
||||
)
|
||||
};
|
||||
|
|
@ -169,7 +169,7 @@ function parseCliArgs() {
|
|||
|
||||
|
||||
class spinnyParser {
|
||||
const INSIDE = {
|
||||
INSIDE = {
|
||||
FILE: 0,
|
||||
INTER: 1,
|
||||
LAZY: 2
|
||||
|
|
@ -264,32 +264,25 @@ class spinnyParser {
|
|||
parseWord(inside) {
|
||||
this.debugStack.push(["Word", this.index])
|
||||
let bang = false;
|
||||
let word = {}
|
||||
word[CMPVER.KEYS.BANG] = false;
|
||||
if (this.now() === "!") {
|
||||
bang = true;
|
||||
word[CMPVER.KEYS.BANG] = true;
|
||||
this.next();
|
||||
}
|
||||
switch (this.now()) {
|
||||
case "{":
|
||||
return {
|
||||
CMPVER.KEYS.BANG:bang,
|
||||
CMPVER.KEYS.TYPE:CMPVER.TYPE.LAZY,
|
||||
CMPVER.KEYS.LINES:this.parseLazy()
|
||||
}
|
||||
word[CMPVER.KEYS.TYPE] = CMPVER.TYPE.LAZY;
|
||||
word[CMPVER.KEYS.LINES] = this.parseLazy();
|
||||
case "`":
|
||||
return {
|
||||
CMPVER.KEYS.BANG:bang,
|
||||
CMPVER.KEYS.TYPE:CMPVER.TYPE.LIT,
|
||||
CMPVER.KEYS.PARTS:this.parseLiteral()
|
||||
}
|
||||
word[CMPVER.KEYS.TYPE] = CMPVER.TYPE.LIT;
|
||||
word[CMPVER.KEYS.PARTS] = this.parseLiteral();
|
||||
default:
|
||||
return {
|
||||
CMPVER.KEYS.BANG:bang,
|
||||
CMPVER.KEYS.TYPE:CMPVER.TYPE.ID,
|
||||
CMPVER.KEYS.PARTS:this.parseIdentifier(inside)
|
||||
}
|
||||
word[CMPVER.KEYS.TYPE] = CMPVER.TYPE.ID;
|
||||
word[CMPVER.KEYS.PARTS] = this.parseIdentifier(inside);
|
||||
}
|
||||
this.debugStack.pop()
|
||||
|
||||
return word
|
||||
}
|
||||
|
||||
parseLazy() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue