Add support for the xor operator.
This commit is contained in:
parent
c3e1ef1064
commit
803b81e3f4
|
@ -120,6 +120,7 @@ char* manglename(char* name, char prefix);
|
||||||
#define LESS 42
|
#define LESS 42
|
||||||
#define GREATEQ 43
|
#define GREATEQ 43
|
||||||
#define GREAT 44
|
#define GREAT 44
|
||||||
|
#define EOR 45
|
||||||
|
|
||||||
#define ASSIGN 49
|
#define ASSIGN 49
|
||||||
#define ASPLUS 50
|
#define ASPLUS 50
|
||||||
|
@ -137,11 +138,12 @@ char* manglename(char* name, char prefix);
|
||||||
#define ASLESS 62
|
#define ASLESS 62
|
||||||
#define ASGTQ 63
|
#define ASGTQ 63
|
||||||
#define ASGREAT 64
|
#define ASGREAT 64
|
||||||
|
#define ASEOR 65
|
||||||
|
|
||||||
#define CON 65
|
#define CON 70
|
||||||
#define STRING 66
|
#define STRING 71
|
||||||
#define NAME 67
|
#define NAME 72
|
||||||
#define KEYW 68
|
#define KEYW 73
|
||||||
|
|
||||||
#define SQUOTE 121
|
#define SQUOTE 121
|
||||||
#define DQUOTE 122
|
#define DQUOTE 122
|
||||||
|
|
|
@ -393,7 +393,7 @@ loop:
|
||||||
if (ctab[peekc = spnextchar()] == LETTER)
|
if (ctab[peekc = spnextchar()] == LETTER)
|
||||||
return ASSIGN;
|
return ASSIGN;
|
||||||
c = symbol();
|
c = symbol();
|
||||||
if (PLUS <= c && c <= GREAT)
|
if (PLUS <= c && c <= EOR)
|
||||||
return c + ASPLUS-PLUS;
|
return c + ASPLUS-PLUS;
|
||||||
if (c == ASSIGN)
|
if (c == ASSIGN)
|
||||||
return EQUAL;
|
return EQUAL;
|
||||||
|
@ -1236,7 +1236,7 @@ int opdope[] = {
|
||||||
024005, /* < */
|
024005, /* < */
|
||||||
024005, /* >= */
|
024005, /* >= */
|
||||||
024005, /* > */
|
024005, /* > */
|
||||||
000000, /* 45 */
|
017005, /* ^ */
|
||||||
000000, /* 46 */
|
000000, /* 46 */
|
||||||
000000, /* 47 */
|
000000, /* 47 */
|
||||||
000000, /* 48 */
|
000000, /* 48 */
|
||||||
|
@ -1256,6 +1256,11 @@ int opdope[] = {
|
||||||
012213, /* =< */
|
012213, /* =< */
|
||||||
012213, /* =>= */
|
012213, /* =>= */
|
||||||
012213, /* => */
|
012213, /* => */
|
||||||
|
012213, /* =^ */
|
||||||
|
000000, /* 66 */
|
||||||
|
000000, /* 67 */
|
||||||
|
000000, /* 68 */
|
||||||
|
000000, /* 69 */
|
||||||
000000, /* CON */
|
000000, /* CON */
|
||||||
000000, /* STRING */
|
000000, /* STRING */
|
||||||
000000 /* NAME */
|
000000 /* NAME */
|
||||||
|
@ -1273,7 +1278,7 @@ char ctab[128] = {
|
||||||
UNKN, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
UNKN, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
||||||
LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
||||||
LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
||||||
LETTER, LETTER, LETTER, LBRACK, UNKN, RBRACK, UNKN, LETTER,
|
LETTER, LETTER, LETTER, LBRACK, UNKN, RBRACK, EOR, LETTER,
|
||||||
UNKN, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
UNKN, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
||||||
LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
||||||
LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
|
||||||
|
@ -1294,6 +1299,7 @@ void printtoken(int tok, FILE *out)
|
||||||
strtab[7] = "RPARN";
|
strtab[7] = "RPARN";
|
||||||
strtab[8] = "COLON";
|
strtab[8] = "COLON";
|
||||||
strtab[9] = "COMMA";
|
strtab[9] = "COMMA";
|
||||||
|
strtab[10] = "HASH";
|
||||||
|
|
||||||
strtab[15] = "MCALL";
|
strtab[15] = "MCALL";
|
||||||
strtab[16] = "CALL";
|
strtab[16] = "CALL";
|
||||||
|
@ -1322,6 +1328,7 @@ void printtoken(int tok, FILE *out)
|
||||||
strtab[42] = "LESS";
|
strtab[42] = "LESS";
|
||||||
strtab[43] = "GREATEQ";
|
strtab[43] = "GREATEQ";
|
||||||
strtab[44] = "GREAT";
|
strtab[44] = "GREAT";
|
||||||
|
strtab[45] = "EOR";
|
||||||
|
|
||||||
strtab[49] = "ASSIGN";
|
strtab[49] = "ASSIGN";
|
||||||
strtab[50] = "ASPLUS";
|
strtab[50] = "ASPLUS";
|
||||||
|
@ -1339,11 +1346,12 @@ void printtoken(int tok, FILE *out)
|
||||||
strtab[62] = "ASLESS";
|
strtab[62] = "ASLESS";
|
||||||
strtab[63] = "ASGTQ";
|
strtab[63] = "ASGTQ";
|
||||||
strtab[64] = "ASGREAT";
|
strtab[64] = "ASGREAT";
|
||||||
|
strtab[65] = "ASEOR";
|
||||||
|
|
||||||
strtab[65] = "CON";
|
strtab[70] = "CON";
|
||||||
strtab[66] = "STRING";
|
strtab[71] = "STRING";
|
||||||
strtab[67] = "NAME";
|
strtab[72] = "NAME";
|
||||||
strtab[68] = "KEYW";
|
strtab[73] = "KEYW";
|
||||||
|
|
||||||
strtab[127] = "UNKN";
|
strtab[127] = "UNKN";
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,7 @@ lvalexp(struct tnode *tr)
|
||||||
case ASLESS:
|
case ASLESS:
|
||||||
case ASGTQ:
|
case ASGTQ:
|
||||||
case ASGREAT:
|
case ASGREAT:
|
||||||
|
case ASEOR:
|
||||||
tr->op -= ASPLUS-PLUS;
|
tr->op -= ASPLUS-PLUS;
|
||||||
rcexpr(block(ASSIGN,0,tr->tr1,tr));
|
rcexpr(block(ASSIGN,0,tr->tr1,tr));
|
||||||
return;
|
return;
|
||||||
|
@ -249,6 +250,11 @@ rcexpr(struct tnode *tr)
|
||||||
C_ior(wordsize);
|
C_ior(wordsize);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case EOR:
|
||||||
|
binary(tr);
|
||||||
|
C_xor(wordsize);
|
||||||
|
return;
|
||||||
|
|
||||||
case LSHIFT:
|
case LSHIFT:
|
||||||
binary(tr);
|
binary(tr);
|
||||||
C_sli(wordsize);
|
C_sli(wordsize);
|
||||||
|
|
Loading…
Reference in a new issue