xo-reader xo-expression xo-tokenizer xo-jit: comparison + apply
This commit is contained in:
parent
7a9357954d
commit
93b2daab6c
28 changed files with 720 additions and 171 deletions
|
|
@ -211,7 +211,11 @@ namespace xo {
|
|||
/* can't be 1char punctuation -- can begin assignment token */
|
||||
return false;
|
||||
case '=':
|
||||
return true;
|
||||
/* can't be 1char punctuation -- can begin comparison token '==' */
|
||||
return false;
|
||||
case '!':
|
||||
/* can't be 1char punctuation -- can begin comparison token '!=' */
|
||||
return false;
|
||||
case '-':
|
||||
/* can't be punctuation
|
||||
* - can appear inside f64 token: e.g. 1.23e-9.
|
||||
|
|
@ -246,6 +250,12 @@ namespace xo {
|
|||
case ':':
|
||||
/* can begin := */
|
||||
return true;
|
||||
case '=':
|
||||
/* can begin == */
|
||||
return true;
|
||||
case '!':
|
||||
/* can begin != */
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -446,6 +456,30 @@ namespace xo {
|
|||
++ix;
|
||||
}
|
||||
break;
|
||||
case '=':
|
||||
log && log("singleassign or cmpeq token");
|
||||
|
||||
if (*(ix + 1) == '=') {
|
||||
tk_type = tokentype::tk_cmpeq;
|
||||
++ix;
|
||||
++ix;
|
||||
} else {
|
||||
/* standalone '=' */
|
||||
tk_type = tokentype::tk_singleassign;
|
||||
++ix;
|
||||
}
|
||||
break;
|
||||
case '!':
|
||||
if (*(ix + 1) == '=') {
|
||||
tk_type = tokentype::tk_cmpne;
|
||||
++ix;
|
||||
++ix;
|
||||
} else {
|
||||
/* standlone '!' */
|
||||
|
||||
// TODO
|
||||
}
|
||||
break;
|
||||
case '"':
|
||||
{
|
||||
log && log("recognize string-token");
|
||||
|
|
@ -638,10 +672,6 @@ namespace xo {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case '=':
|
||||
tk_type = tokentype::tk_singleassign;
|
||||
++ix;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,6 +126,11 @@ namespace xo {
|
|||
/** operator @c '/' **/
|
||||
tk_slash,
|
||||
|
||||
/** operator @c '==' **/
|
||||
tk_cmpeq,
|
||||
/** operator @c '!=' **/
|
||||
tk_cmpne,
|
||||
|
||||
/** keyword @c 'type' **/
|
||||
tk_type,
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ namespace xo {
|
|||
CASE(tk_star);
|
||||
CASE(tk_slash);
|
||||
|
||||
CASE(tk_cmpeq);
|
||||
CASE(tk_cmpne);
|
||||
|
||||
CASE(tk_type);
|
||||
CASE(tk_def);
|
||||
CASE(tk_lambda);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue