✨ make compare use strict typing
This commit is contained in:
parent
7b967b2e59
commit
e23418cf6f
@ -107,14 +107,10 @@ if|ifl <cond>
|
|||||||
$1 # same as `$1 == true`
|
$1 # same as `$1 == true`
|
||||||
!$1 # same as `$1 != true`
|
!$1 # same as `$1 != true`
|
||||||
|
|
||||||
# loosely typed compare
|
# strongly typed compare
|
||||||
$1 == $2
|
$1 == $2
|
||||||
$1 != $2
|
$1 != $2
|
||||||
|
|
||||||
# strongly typed compare
|
|
||||||
$1 === $2
|
|
||||||
$1 !== $2
|
|
||||||
|
|
||||||
# numerical / alphabetical compare
|
# numerical / alphabetical compare
|
||||||
$1 < $2
|
$1 < $2
|
||||||
$1 <= $2
|
$1 <= $2
|
||||||
|
10
src/lexer.js
10
src/lexer.js
@ -78,15 +78,13 @@ class Juicescript_lexer {
|
|||||||
|
|
||||||
// OPERATORS //
|
// OPERATORS //
|
||||||
case "!":
|
case "!":
|
||||||
if (!this.match("=")) this.token_add({type: Juicescript.token_type.NOT});
|
if (this.match("=")) this.token_add({type: Juicescript.token_type.NOT_EQUAL});
|
||||||
else if (!this.match("=")) this.token_add({type: Juicescript.token_type.NOT_EQUAL});
|
else this.token_add({type: Juicescript.token_type.NOT});
|
||||||
else this.token_add({type: Juicescript.token_type.STRICT_NOT_EQUAL});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "=":
|
case "=":
|
||||||
if (!this.match("=")) this.token_add({type: Juicescript.token_type.EQUAL});
|
if (this.match("=")) this.token_add({type: Juicescript.token_type.EQUAL});
|
||||||
else if (!this.match("=")) this.token_add({type: Juicescript.token_type.EQUAL});
|
else this.warning("unexpected character '" + char + "'");
|
||||||
else this.token_add({type: Juicescript.token_type.STRICT_EQUAL});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "<":
|
case "<":
|
||||||
|
@ -15,7 +15,6 @@ class Juicescript {
|
|||||||
// operators
|
// operators
|
||||||
"NOT",
|
"NOT",
|
||||||
"EQUAL", "NOT_EQUAL",
|
"EQUAL", "NOT_EQUAL",
|
||||||
"STRICT_EQUAL", "STRICT_NOT_EQUAL",
|
|
||||||
"GREATER", "GREATER_EQUAL",
|
"GREATER", "GREATER_EQUAL",
|
||||||
"LESS", "LESS_EQUAL",
|
"LESS", "LESS_EQUAL",
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user