mirror of
https://github.com/ksherlock/mpw-shell.git
synced 2024-12-27 03:32:05 +00:00
add missing (mostly macroman) operators
This commit is contained in:
parent
6199944350
commit
91590e92aa
@ -322,6 +322,8 @@ int expression_parser::precedence(int op) {
|
||||
case '<=':
|
||||
case '>':
|
||||
case '>=':
|
||||
case 0xb2:
|
||||
case 0xb3:
|
||||
return 6;
|
||||
|
||||
case '==':
|
||||
@ -388,9 +390,11 @@ value expression_parser::eval(int op, value &lhs, value &rhs) {
|
||||
return lhs.to_number() < rhs.to_number();
|
||||
|
||||
case '<=':
|
||||
case 0xb2:
|
||||
return lhs.to_number() <= rhs.to_number();
|
||||
|
||||
case '>=':
|
||||
case 0xb3:
|
||||
return lhs.to_number() >= rhs.to_number();
|
||||
|
||||
case '>>':
|
||||
|
@ -70,6 +70,22 @@
|
||||
|
||||
# eval-only.
|
||||
|
||||
# macroman ≤
|
||||
0xb2 when eval
|
||||
%push_token => { tokens.emplace_back("\xb2", '<='); };
|
||||
|
||||
# macroman ≠
|
||||
0xad when eval
|
||||
%push_token => { tokens.emplace_back("\xad", '!='); };
|
||||
|
||||
# macroman ¬
|
||||
0xc2 when eval
|
||||
%push_token => { tokens.emplace_back("\xc2", '!'); };
|
||||
|
||||
# macroman ÷
|
||||
0xd6 when eval
|
||||
%push_token => { tokens.emplace_back("\xd6", '/'); };
|
||||
|
||||
'||' when eval
|
||||
%push_token => { tokens.emplace_back("||", '||'); };
|
||||
'|' when eval
|
||||
@ -78,13 +94,14 @@
|
||||
'&&' when eval
|
||||
%push_token => { tokens.emplace_back("&&", '&&'); };
|
||||
|
||||
|
||||
'(' when eval
|
||||
%push_token => { tokens.emplace_back("(", '('); };
|
||||
|
||||
')' when eval
|
||||
%push_token => { tokens.emplace_back(")", ')'); };
|
||||
|
||||
'<>' when eval
|
||||
%push_token => { tokens.emplace_back("<>", '!='); };
|
||||
|
||||
'<<' when eval
|
||||
%push_token => { tokens.emplace_back("<<", '<<'); };
|
||||
|
Loading…
Reference in New Issue
Block a user