| 1 |
---input--- |
| 2 |
.const .u32 foo = 42; |
| 3 |
.global .u32 bar[] = { 2, 3, 5 }; |
| 4 |
.global .u32 p1 = foo; // offset of foo in .const space |
| 5 |
.global .u32 p2 = generic(foo); // generic address of foo |
| 6 |
|
| 7 |
// array of generic-address pointers to elements of bar |
| 8 |
.global .u32 parr[] = { generic(bar), generic(bar)+4, |
| 9 |
generic(bar)+8 }; |
| 10 |
|
| 11 |
// examples using mask() operator are pruned for brevity |
| 12 |
.global .u8 addr[] = {0xff(foo), 0xff00(foo), 0xff0000(foo), ...}; |
| 13 |
|
| 14 |
.global .u8 addr2[] = {0xff(foo+4), 0xff00(foo+4), 0xff0000(foo+4),...} |
| 15 |
|
| 16 |
.global .u8 addr3[] = {0xff(generic(foo)), 0xff00(generic(foo)),...} |
| 17 |
|
| 18 |
.global .u8 addr4[] = {0xff(generic(foo)+4), 0xff00(generic(foo)+4),...} |
| 19 |
|
| 20 |
// mask() operator with integer const expression |
| 21 |
.global .u8 addr5[] = { 0xFF(1000 + 546), 0xFF00(131187), ...}; |
| 22 |
|
| 23 |
---tokens--- |
| 24 |
'.const' Keyword.Pseudo |
| 25 |
' ' Text.Whitespace |
| 26 |
'.u32' Keyword.Type |
| 27 |
' ' Text.Whitespace |
| 28 |
'foo' Name.Variable |
| 29 |
' ' Text.Whitespace |
| 30 |
'=' Punctuation |
| 31 |
' ' Text.Whitespace |
| 32 |
'42' Literal.Number |
| 33 |
';' Punctuation |
| 34 |
'\n' Text.Whitespace |
| 35 |
|
| 36 |
'.global' Keyword.Pseudo |
| 37 |
' ' Text.Whitespace |
| 38 |
'.u32' Keyword.Type |
| 39 |
' ' Text.Whitespace |
| 40 |
'bar' Keyword |
| 41 |
'[' Punctuation |
| 42 |
']' Punctuation |
| 43 |
' ' Text.Whitespace |
| 44 |
'=' Punctuation |
| 45 |
' ' Text.Whitespace |
| 46 |
'{' Punctuation |
| 47 |
' ' Text.Whitespace |
| 48 |
'2' Literal.Number |
| 49 |
',' Operator |
| 50 |
' ' Text.Whitespace |
| 51 |
'3' Literal.Number |
| 52 |
',' Operator |
| 53 |
' ' Text.Whitespace |
| 54 |
'5' Literal.Number |
| 55 |
' ' Text.Whitespace |
| 56 |
'}' Punctuation |
| 57 |
';' Punctuation |
| 58 |
'\n' Text.Whitespace |
| 59 |
|
| 60 |
'.global' Keyword.Pseudo |
| 61 |
' ' Text.Whitespace |
| 62 |
'.u32' Keyword.Type |
| 63 |
' ' Text.Whitespace |
| 64 |
'p1' Name.Variable |
| 65 |
' ' Text.Whitespace |
| 66 |
'=' Punctuation |
| 67 |
' ' Text.Whitespace |
| 68 |
'foo' Name.Variable |
| 69 |
';' Punctuation |
| 70 |
' ' Text.Whitespace |
| 71 |
'// offset of foo in .const space\n' Comment |
| 72 |
|
| 73 |
'.global' Keyword.Pseudo |
| 74 |
' ' Text.Whitespace |
| 75 |
'.u32' Keyword.Type |
| 76 |
' ' Text.Whitespace |
| 77 |
'p2' Name.Variable |
| 78 |
' ' Text.Whitespace |
| 79 |
'=' Punctuation |
| 80 |
' ' Text.Whitespace |
| 81 |
'generic' Name.Variable |
| 82 |
'(' Punctuation |
| 83 |
'foo' Name.Variable |
| 84 |
')' Punctuation |
| 85 |
';' Punctuation |
| 86 |
' ' Text.Whitespace |
| 87 |
'// generic address of foo\n' Comment |
| 88 |
|
| 89 |
'\n' Text.Whitespace |
| 90 |
|
| 91 |
'// array of generic-address pointers to elements of bar\n' Comment |
| 92 |
|
| 93 |
'.global' Keyword.Pseudo |
| 94 |
' ' Text.Whitespace |
| 95 |
'.u32' Keyword.Type |
| 96 |
' ' Text.Whitespace |
| 97 |
'parr' Name.Variable |
| 98 |
'[' Punctuation |
| 99 |
']' Punctuation |
| 100 |
' ' Text.Whitespace |
| 101 |
'=' Punctuation |
| 102 |
' ' Text.Whitespace |
| 103 |
'{' Punctuation |
| 104 |
' ' Text.Whitespace |
| 105 |
'generic' Name.Variable |
| 106 |
'(' Punctuation |
| 107 |
'bar' Keyword |
| 108 |
')' Punctuation |
| 109 |
',' Operator |
| 110 |
' ' Text.Whitespace |
| 111 |
'generic' Name.Variable |
| 112 |
'(' Punctuation |
| 113 |
'bar' Keyword |
| 114 |
')' Punctuation |
| 115 |
'+' Operator |
| 116 |
'4' Literal.Number |
| 117 |
',' Operator |
| 118 |
'\n' Text.Whitespace |
| 119 |
|
| 120 |
'generic' Name.Variable |
| 121 |
'(' Punctuation |
| 122 |
'bar' Keyword |
| 123 |
')' Punctuation |
| 124 |
'+' Operator |
| 125 |
'8' Literal.Number |
| 126 |
' ' Text.Whitespace |
| 127 |
'}' Punctuation |
| 128 |
';' Punctuation |
| 129 |
'\n\n' Text.Whitespace |
| 130 |
|
| 131 |
'// examples using mask() operator are pruned for brevity\n' Comment |
| 132 |
|
| 133 |
'.global' Keyword.Pseudo |
| 134 |
' ' Text.Whitespace |
| 135 |
'.u8' Keyword.Type |
| 136 |
' ' Text.Whitespace |
| 137 |
'add' Keyword |
| 138 |
'r' Name.Variable |
| 139 |
'[' Punctuation |
| 140 |
']' Punctuation |
| 141 |
' ' Text.Whitespace |
| 142 |
'=' Punctuation |
| 143 |
' ' Text.Whitespace |
| 144 |
'{' Punctuation |
| 145 |
'0xff' Literal.Number |
| 146 |
'(' Punctuation |
| 147 |
'foo' Name.Variable |
| 148 |
')' Punctuation |
| 149 |
',' Operator |
| 150 |
' ' Text.Whitespace |
| 151 |
'0xff00' Literal.Number |
| 152 |
'(' Punctuation |
| 153 |
'foo' Name.Variable |
| 154 |
')' Punctuation |
| 155 |
',' Operator |
| 156 |
' ' Text.Whitespace |
| 157 |
'0xff0000' Literal.Number |
| 158 |
'(' Punctuation |
| 159 |
'foo' Name.Variable |
| 160 |
')' Punctuation |
| 161 |
',' Operator |
| 162 |
' ' Text.Whitespace |
| 163 |
'...' Name.Variable |
| 164 |
'}' Punctuation |
| 165 |
';' Punctuation |
| 166 |
'\n\n' Text.Whitespace |
| 167 |
|
| 168 |
'.global' Keyword.Pseudo |
| 169 |
' ' Text.Whitespace |
| 170 |
'.u8' Keyword.Type |
| 171 |
' ' Text.Whitespace |
| 172 |
'add' Keyword |
| 173 |
'r2' Name.Variable |
| 174 |
'[' Punctuation |
| 175 |
']' Punctuation |
| 176 |
' ' Text.Whitespace |
| 177 |
'=' Punctuation |
| 178 |
' ' Text.Whitespace |
| 179 |
'{' Punctuation |
| 180 |
'0xff' Literal.Number |
| 181 |
'(' Punctuation |
| 182 |
'foo' Name.Variable |
| 183 |
'+' Operator |
| 184 |
'4' Literal.Number |
| 185 |
')' Punctuation |
| 186 |
',' Operator |
| 187 |
' ' Text.Whitespace |
| 188 |
'0xff00' Literal.Number |
| 189 |
'(' Punctuation |
| 190 |
'foo' Name.Variable |
| 191 |
'+' Operator |
| 192 |
'4' Literal.Number |
| 193 |
')' Punctuation |
| 194 |
',' Operator |
| 195 |
' ' Text.Whitespace |
| 196 |
'0xff0000' Literal.Number |
| 197 |
'(' Punctuation |
| 198 |
'foo' Name.Variable |
| 199 |
'+' Operator |
| 200 |
'4' Literal.Number |
| 201 |
')' Punctuation |
| 202 |
',' Operator |
| 203 |
'...' Name.Variable |
| 204 |
'}' Punctuation |
| 205 |
'\n\n' Text.Whitespace |
| 206 |
|
| 207 |
'.global' Keyword.Pseudo |
| 208 |
' ' Text.Whitespace |
| 209 |
'.u8' Keyword.Type |
| 210 |
' ' Text.Whitespace |
| 211 |
'add' Keyword |
| 212 |
'r3' Name.Variable |
| 213 |
'[' Punctuation |
| 214 |
']' Punctuation |
| 215 |
' ' Text.Whitespace |
| 216 |
'=' Punctuation |
| 217 |
' ' Text.Whitespace |
| 218 |
'{' Punctuation |
| 219 |
'0xff' Literal.Number |
| 220 |
'(' Punctuation |
| 221 |
'generic' Name.Variable |
| 222 |
'(' Punctuation |
| 223 |
'foo' Name.Variable |
| 224 |
')' Punctuation |
| 225 |
')' Punctuation |
| 226 |
',' Operator |
| 227 |
' ' Text.Whitespace |
| 228 |
'0xff00' Literal.Number |
| 229 |
'(' Punctuation |
| 230 |
'generic' Name.Variable |
| 231 |
'(' Punctuation |
| 232 |
'foo' Name.Variable |
| 233 |
')' Punctuation |
| 234 |
')' Punctuation |
| 235 |
',' Operator |
| 236 |
'...' Name.Variable |
| 237 |
'}' Punctuation |
| 238 |
'\n\n' Text.Whitespace |
| 239 |
|
| 240 |
'.global' Keyword.Pseudo |
| 241 |
' ' Text.Whitespace |
| 242 |
'.u8' Keyword.Type |
| 243 |
' ' Text.Whitespace |
| 244 |
'add' Keyword |
| 245 |
'r4' Name.Variable |
| 246 |
'[' Punctuation |
| 247 |
']' Punctuation |
| 248 |
' ' Text.Whitespace |
| 249 |
'=' Punctuation |
| 250 |
' ' Text.Whitespace |
| 251 |
'{' Punctuation |
| 252 |
'0xff' Literal.Number |
| 253 |
'(' Punctuation |
| 254 |
'generic' Name.Variable |
| 255 |
'(' Punctuation |
| 256 |
'foo' Name.Variable |
| 257 |
')' Punctuation |
| 258 |
'+' Operator |
| 259 |
'4' Literal.Number |
| 260 |
')' Punctuation |
| 261 |
',' Operator |
| 262 |
' ' Text.Whitespace |
| 263 |
'0xff00' Literal.Number |
| 264 |
'(' Punctuation |
| 265 |
'generic' Name.Variable |
| 266 |
'(' Punctuation |
| 267 |
'foo' Name.Variable |
| 268 |
')' Punctuation |
| 269 |
'+' Operator |
| 270 |
'4' Literal.Number |
| 271 |
')' Punctuation |
| 272 |
',' Operator |
| 273 |
'...' Name.Variable |
| 274 |
'}' Punctuation |
| 275 |
'\n\n' Text.Whitespace |
| 276 |
|
| 277 |
'// mask() operator with integer const expression\n' Comment |
| 278 |
|
| 279 |
'.global' Keyword.Pseudo |
| 280 |
' ' Text.Whitespace |
| 281 |
'.u8' Keyword.Type |
| 282 |
' ' Text.Whitespace |
| 283 |
'add' Keyword |
| 284 |
'r5' Name.Variable |
| 285 |
'[' Punctuation |
| 286 |
']' Punctuation |
| 287 |
' ' Text.Whitespace |
| 288 |
'=' Punctuation |
| 289 |
' ' Text.Whitespace |
| 290 |
'{' Punctuation |
| 291 |
' ' Text.Whitespace |
| 292 |
'0xFF' Literal.Number |
| 293 |
'(' Punctuation |
| 294 |
'1000' Literal.Number |
| 295 |
' ' Text.Whitespace |
| 296 |
'+' Operator |
| 297 |
' ' Text.Whitespace |
| 298 |
'546' Literal.Number |
| 299 |
')' Punctuation |
| 300 |
',' Operator |
| 301 |
' ' Text.Whitespace |
| 302 |
'0xFF00' Literal.Number |
| 303 |
'(' Punctuation |
| 304 |
'131187' Literal.Number |
| 305 |
')' Punctuation |
| 306 |
',' Operator |
| 307 |
' ' Text.Whitespace |
| 308 |
'...' Name.Variable |
| 309 |
'}' Punctuation |
| 310 |
';' Punctuation |
| 311 |
'\n' Text.Whitespace |