✨ tokenize newline and ;
as delimiters
This commit is contained in:
parent
ad8d67413f
commit
7b967b2e59
@ -2,7 +2,6 @@
|
||||
# one-line comments (from prefix to EOL)
|
||||
mov $1 42 # comment
|
||||
mov $1 42 // comment
|
||||
mov $1 42 ; comment
|
||||
|
||||
# block comments
|
||||
/*
|
||||
@ -14,6 +13,11 @@ mov $1 42 ; comment
|
||||
mov /* Inline block comment */ $1 42
|
||||
|
||||
|
||||
## DELIMITERS ##
|
||||
# `;` acts like a fake newline
|
||||
mov $1 42; typ $1; echo $1
|
||||
|
||||
|
||||
## ESCAPE SEQUENCES AND INTEGER PREFIXES ##
|
||||
# quote escaping
|
||||
"Here comes a quote: \"Lorem ipsum\". This had to be escaped!"
|
||||
|
@ -63,8 +63,15 @@ class Juicescript_lexer {
|
||||
break;
|
||||
|
||||
|
||||
// DELIMITER //
|
||||
case ";":
|
||||
this.token_add({type: Juicescript.token_type.DELIMITER});
|
||||
break;
|
||||
|
||||
|
||||
// NEWLINE //
|
||||
case "\n":
|
||||
this.token_add({type: Juicescript.token_type.DELIMITER});
|
||||
this.line++;
|
||||
break;
|
||||
|
||||
@ -113,7 +120,6 @@ class Juicescript_lexer {
|
||||
|
||||
// COMMENTS //
|
||||
case "#":
|
||||
case ";":
|
||||
case "/":
|
||||
// block comment
|
||||
if(char === "/" && this.match("*")){
|
||||
|
@ -26,6 +26,9 @@ class Juicescript {
|
||||
// special chars
|
||||
"AMPERSAND",
|
||||
|
||||
// delimiters
|
||||
"DELIMITER",
|
||||
|
||||
// meta stuff
|
||||
"EOF"
|
||||
);
|
||||
|
@ -1,6 +1,5 @@
|
||||
mov $1 42 # comment
|
||||
mov $1 42 // comment
|
||||
mov $1 42 ; comment
|
||||
|
||||
# block comments
|
||||
/*
|
||||
|
Reference in New Issue
Block a user