Add support for the ~ operator.

This commit is contained in:
David Given 2017-01-01 17:40:06 +00:00
parent b1576e2c77
commit 374e7a1c57
3 changed files with 10 additions and 2 deletions

View file

@ -104,6 +104,7 @@ char* manglename(char* name, char prefix);
#define AMPER 23 #define AMPER 23
#define STAR 24 #define STAR 24
#define QUEST 25 #define QUEST 25
#define NOT 26
#define PLUS 30 #define PLUS 30
#define MINUS 31 #define MINUS 31

View file

@ -1060,6 +1060,7 @@ tand:
goto oponst; goto oponst;
case EXCLA: case EXCLA:
case NOT:
if (andflg) if (andflg)
goto syntax; goto syntax;
goto oponst; goto oponst;
@ -1225,7 +1226,7 @@ int opdope[] = {
034200, /* &un */ 034200, /* &un */
034200, /* *un */ 034200, /* *un */
014201, /* ? */ 014201, /* ? */
000000, /* 26 */ 034200, /* ~un */
000000, /* 27 */ 000000, /* 27 */
000000, /* 28 */ 000000, /* 28 */
000000, /* 29 */ 000000, /* 29 */
@ -1290,7 +1291,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, LBRACE, OR, RBRACE, UNKN, UNKN LETTER, LETTER, LETTER, LBRACE, OR, RBRACE, NOT, UNKN
}; };
/* debug function */ /* debug function */
@ -1320,6 +1321,7 @@ void printtoken(int tok, FILE *out)
strtab[23] = "AMPER"; strtab[23] = "AMPER";
strtab[24] = "STAR"; strtab[24] = "STAR";
strtab[25] = "QUEST"; strtab[25] = "QUEST";
strtab[26] = "NOT";
strtab[30] = "PLUS"; strtab[30] = "PLUS";
strtab[31] = "MINUS"; strtab[31] = "MINUS";

View file

@ -305,6 +305,11 @@ rcexpr(struct tnode *tr)
C_ngi(wordsize); C_ngi(wordsize);
return; return;
case NOT:
rcexpr(tr->tr1);
C_com(wordsize);
return;
case QUEST: case QUEST:
cbranch(tr->tr1, o1=isn++); cbranch(tr->tr1, o1=isn++);
rcexpr(tr->tr2->tr1); rcexpr(tr->tr2->tr1);