Mercurial > hg > index.cgi
comparison lwcc/tree.c @ 506:7e8298f7bc0a
Add basic syntax for typecasting
Add parser support for type casts. This current scheme handles only integer
types.
Also include parenthesis grouping in expressions.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 27 Oct 2019 12:06:01 -0600 |
parents | 14a40f8bb4eb |
children |
comparison
equal
deleted
inserted
replaced
505:59b8c8b15bd4 | 506:7e8298f7bc0a |
---|---|
88 "OPER_RSHASS", | 88 "OPER_RSHASS", |
89 "OPER_BWANDASS", | 89 "OPER_BWANDASS", |
90 "OPER_BWXORASS", | 90 "OPER_BWXORASS", |
91 "OPER_BWORASS", | 91 "OPER_BWORASS", |
92 "OPER_COMMA", | 92 "OPER_COMMA", |
93 "TYPECAST", | |
93 }; | 94 }; |
94 | 95 |
95 | 96 |
96 | 97 |
97 node_t *node_create(int type, ...) | 98 node_t *node_create(int type, ...) |
149 | 150 |
150 case NODE_DECL: | 151 case NODE_DECL: |
151 nargs = 2; | 152 nargs = 2; |
152 break; | 153 break; |
153 | 154 |
155 case NODE_TYPECAST: | |
156 nargs = 2; | |
157 break; | |
158 | |
154 case NODE_OPER_POSTINC: | 159 case NODE_OPER_POSTINC: |
155 case NODE_OPER_POSTDEC: | 160 case NODE_OPER_POSTDEC: |
156 nargs = 1; | 161 nargs = 1; |
157 break; | 162 break; |
158 | 163 |