hokusai-zero 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. checksums.yaml +7 -0
  2. data/Dockerfile +26 -0
  3. data/Gemfile +15 -0
  4. data/Gemfile.lock +91 -0
  5. data/LICENSE +21 -0
  6. data/README.md +28 -0
  7. data/ast/genheader +3 -0
  8. data/ast/include/hashmap.c +1151 -0
  9. data/ast/include/hashmap.c.license +20 -0
  10. data/ast/include/hashmap.h +54 -0
  11. data/ast/src/core/ast.c +448 -0
  12. data/ast/src/core/ast.h +259 -0
  13. data/ast/src/core/common.h +24 -0
  14. data/ast/src/core/component.c +85 -0
  15. data/ast/src/core/component.h +35 -0
  16. data/ast/src/core/hml.c +665 -0
  17. data/ast/src/core/hml.h +11 -0
  18. data/ast/src/core/input.c +458 -0
  19. data/ast/src/core/input.h +118 -0
  20. data/ast/src/core/style.c +101 -0
  21. data/ast/src/core/style.h +41 -0
  22. data/ast/src/core/text.c +784 -0
  23. data/ast/src/core/text.h +93 -0
  24. data/ast/src/core/util.c +140 -0
  25. data/ast/src/core/util.h +48 -0
  26. data/ast/src/hokusai.c +6 -0
  27. data/ast/src/hokusai.h +6 -0
  28. data/ast/test/fixtures/test.ui +13 -0
  29. data/ast/test/greatest.h +1266 -0
  30. data/ast/test/hokusai.c +14 -0
  31. data/ast/test/parser.c +234 -0
  32. data/ast/test/text.c +116 -0
  33. data/ext/extconf.rb +27 -0
  34. data/grammar/Cargo.lock +80 -0
  35. data/grammar/Cargo.toml +26 -0
  36. data/grammar/binding.gyp +20 -0
  37. data/grammar/bindings/node/binding.cc +28 -0
  38. data/grammar/bindings/node/index.js +19 -0
  39. data/grammar/bindings/rust/build.rs +40 -0
  40. data/grammar/bindings/rust/lib.rs +52 -0
  41. data/grammar/corpus/1_document.txt +131 -0
  42. data/grammar/corpus/2_selectors.txt +58 -0
  43. data/grammar/corpus/3_spaces.txt +69 -0
  44. data/grammar/corpus/4_errors.txt +10 -0
  45. data/grammar/corpus/5_macros.txt +175 -0
  46. data/grammar/corpus/6_styles.txt +81 -0
  47. data/grammar/grammar.js +275 -0
  48. data/grammar/package-lock.json +34 -0
  49. data/grammar/package.json +33 -0
  50. data/grammar/src/grammar.json +1269 -0
  51. data/grammar/src/node-types.json +474 -0
  52. data/grammar/src/parser.c +5772 -0
  53. data/grammar/src/scanner.c +258 -0
  54. data/grammar/src/tree_sitter/parser.h +230 -0
  55. data/grammar/src/tree_sitter/scanner.h +12 -0
  56. data/grammar/test.nml +10 -0
  57. data/hokusai.gemspec +19 -0
  58. data/ui/examples/assets/DigitalDisplay.ttf +0 -0
  59. data/ui/examples/assets/OpenSans-Regular.ttf +0 -0
  60. data/ui/examples/assets/addy.png +0 -0
  61. data/ui/examples/assets/baby_sean.png +0 -0
  62. data/ui/examples/assets/football-troll.png +0 -0
  63. data/ui/examples/assets/gear.png +0 -0
  64. data/ui/examples/assets/icecold.ttf +0 -0
  65. data/ui/examples/assets/science-troll.png +0 -0
  66. data/ui/examples/buddy.rb +31 -0
  67. data/ui/examples/clock.rb +58 -0
  68. data/ui/examples/counter.rb +123 -0
  69. data/ui/examples/dynamic.rb +147 -0
  70. data/ui/examples/foobar.rb +236 -0
  71. data/ui/examples/stock.rb +115 -0
  72. data/ui/examples/stock_decider/option.rb +74 -0
  73. data/ui/examples/tic_tac_toe.rb +246 -0
  74. data/ui/lib/lib_hokusai.rb +425 -0
  75. data/ui/spec/hokusai/ast_spec.rb +88 -0
  76. data/ui/spec/hokusai/automation/keys_transcoder_spec.rb +50 -0
  77. data/ui/spec/hokusai/automation/selector_spec.rb +68 -0
  78. data/ui/spec/hokusai/block_spec.rb +126 -0
  79. data/ui/spec/hokusai/directives_spec.rb +327 -0
  80. data/ui/spec/hokusai/e2e/client_spec.rb +58 -0
  81. data/ui/spec/hokusai/e2e/meta_spec.rb +42 -0
  82. data/ui/spec/hokusai/publisher_spec.rb +38 -0
  83. data/ui/spec/hokusai/slots_spec.rb +150 -0
  84. data/ui/spec/hokusai/util/piece_table_spec.rb +90 -0
  85. data/ui/spec/hokusai_spec.rb +0 -0
  86. data/ui/spec/spec_helper.rb +30 -0
  87. data/ui/src/hokusai/ast.rb +446 -0
  88. data/ui/src/hokusai/automation/client.rb +167 -0
  89. data/ui/src/hokusai/automation/constants.rb +98 -0
  90. data/ui/src/hokusai/automation/converters/selector_converter.rb +61 -0
  91. data/ui/src/hokusai/automation/driver.rb +54 -0
  92. data/ui/src/hokusai/automation/driver_command_queue.rb +50 -0
  93. data/ui/src/hokusai/automation/driver_commands/base.rb +79 -0
  94. data/ui/src/hokusai/automation/driver_commands/get_attribute.rb +41 -0
  95. data/ui/src/hokusai/automation/driver_commands/invoke.rb +33 -0
  96. data/ui/src/hokusai/automation/driver_commands/locate.rb +48 -0
  97. data/ui/src/hokusai/automation/driver_commands/trigger_keyboard.rb +94 -0
  98. data/ui/src/hokusai/automation/driver_commands/trigger_mouse.rb +213 -0
  99. data/ui/src/hokusai/automation/keys_transcoder.rb +128 -0
  100. data/ui/src/hokusai/automation/selector.rb +39 -0
  101. data/ui/src/hokusai/automation/server.rb +114 -0
  102. data/ui/src/hokusai/automation.rb +3 -0
  103. data/ui/src/hokusai/backends/raylib/config.rb +47 -0
  104. data/ui/src/hokusai/backends/raylib/font.rb +113 -0
  105. data/ui/src/hokusai/backends/raylib/keys.rb +124 -0
  106. data/ui/src/hokusai/backends/raylib.rb +449 -0
  107. data/ui/src/hokusai/backends/sdl2/Monaco.ttf +0 -0
  108. data/ui/src/hokusai/backends/sdl2/color.rb +12 -0
  109. data/ui/src/hokusai/backends/sdl2/config.rb +31 -0
  110. data/ui/src/hokusai/backends/sdl2/font.rb +127 -0
  111. data/ui/src/hokusai/backends/sdl2/keys.rb +119 -0
  112. data/ui/src/hokusai/backends/sdl2.rb +529 -0
  113. data/ui/src/hokusai/block.rb +237 -0
  114. data/ui/src/hokusai/blocks/button.rb +100 -0
  115. data/ui/src/hokusai/blocks/checkbox.rb +51 -0
  116. data/ui/src/hokusai/blocks/circle.rb +28 -0
  117. data/ui/src/hokusai/blocks/clipped.rb +23 -0
  118. data/ui/src/hokusai/blocks/cursor.rb +49 -0
  119. data/ui/src/hokusai/blocks/dynamic.rb +37 -0
  120. data/ui/src/hokusai/blocks/empty.rb +10 -0
  121. data/ui/src/hokusai/blocks/hblock.rb +35 -0
  122. data/ui/src/hokusai/blocks/image.rb +18 -0
  123. data/ui/src/hokusai/blocks/input.rb +200 -0
  124. data/ui/src/hokusai/blocks/label.rb +39 -0
  125. data/ui/src/hokusai/blocks/panel.rb +126 -0
  126. data/ui/src/hokusai/blocks/rect.rb +24 -0
  127. data/ui/src/hokusai/blocks/scissor_begin.rb +18 -0
  128. data/ui/src/hokusai/blocks/scissor_end.rb +12 -0
  129. data/ui/src/hokusai/blocks/scrollbar.rb +103 -0
  130. data/ui/src/hokusai/blocks/selectable.rb +77 -0
  131. data/ui/src/hokusai/blocks/svg.rb +20 -0
  132. data/ui/src/hokusai/blocks/text.rb +214 -0
  133. data/ui/src/hokusai/blocks/titlebar/osx.rb +145 -0
  134. data/ui/src/hokusai/blocks/toggle.rb +55 -0
  135. data/ui/src/hokusai/blocks/vblock.rb +35 -0
  136. data/ui/src/hokusai/commands/base.rb +22 -0
  137. data/ui/src/hokusai/commands/circle.rb +47 -0
  138. data/ui/src/hokusai/commands/image.rb +45 -0
  139. data/ui/src/hokusai/commands/rect.rb +158 -0
  140. data/ui/src/hokusai/commands/scissor.rb +22 -0
  141. data/ui/src/hokusai/commands/text.rb +92 -0
  142. data/ui/src/hokusai/commands.rb +87 -0
  143. data/ui/src/hokusai/diff.rb +124 -0
  144. data/ui/src/hokusai/error.rb +3 -0
  145. data/ui/src/hokusai/event.rb +54 -0
  146. data/ui/src/hokusai/events/keyboard.rb +84 -0
  147. data/ui/src/hokusai/events/mouse.rb +172 -0
  148. data/ui/src/hokusai/font.rb +280 -0
  149. data/ui/src/hokusai/meta.rb +152 -0
  150. data/ui/src/hokusai/mounting/loop_entry.rb +230 -0
  151. data/ui/src/hokusai/mounting/mount_entry.rb +74 -0
  152. data/ui/src/hokusai/mounting/update_entry.rb +101 -0
  153. data/ui/src/hokusai/node.rb +98 -0
  154. data/ui/src/hokusai/node_mounter.rb +102 -0
  155. data/ui/src/hokusai/painter.rb +214 -0
  156. data/ui/src/hokusai/publisher.rb +32 -0
  157. data/ui/src/hokusai/style.rb +72 -0
  158. data/ui/src/hokusai/types.rb +266 -0
  159. data/ui/src/hokusai/util/clamping_iterator.rb +202 -0
  160. data/ui/src/hokusai/util/piece_table.rb +111 -0
  161. data/ui/src/hokusai/util/selection.rb +145 -0
  162. data/ui/src/hokusai.rb +120 -0
  163. data/ui/vendor/.gitkeep +0 -0
  164. data/vendor/.gitkeep +0 -0
  165. data/xmake.lua +192 -0
  166. metadata +222 -0
@@ -0,0 +1,474 @@
1
+ [
2
+ {
3
+ "type": "args",
4
+ "named": true,
5
+ "fields": {},
6
+ "children": {
7
+ "multiple": true,
8
+ "required": true,
9
+ "types": [
10
+ {
11
+ "type": "arg",
12
+ "named": true
13
+ }
14
+ ]
15
+ }
16
+ },
17
+ {
18
+ "type": "attributes",
19
+ "named": true,
20
+ "fields": {},
21
+ "children": {
22
+ "multiple": true,
23
+ "required": false,
24
+ "types": [
25
+ {
26
+ "type": "event",
27
+ "named": true
28
+ },
29
+ {
30
+ "type": "prop",
31
+ "named": true
32
+ },
33
+ {
34
+ "type": "style",
35
+ "named": true
36
+ }
37
+ ]
38
+ }
39
+ },
40
+ {
41
+ "type": "children",
42
+ "named": true,
43
+ "fields": {},
44
+ "children": {
45
+ "multiple": true,
46
+ "required": true,
47
+ "types": [
48
+ {
49
+ "type": "element",
50
+ "named": true
51
+ },
52
+ {
53
+ "type": "else_macro",
54
+ "named": true
55
+ },
56
+ {
57
+ "type": "for_if_macro",
58
+ "named": true
59
+ },
60
+ {
61
+ "type": "for_macro",
62
+ "named": true
63
+ },
64
+ {
65
+ "type": "if_macro",
66
+ "named": true
67
+ }
68
+ ]
69
+ }
70
+ },
71
+ {
72
+ "type": "comment",
73
+ "named": true,
74
+ "fields": {}
75
+ },
76
+ {
77
+ "type": "document",
78
+ "named": true,
79
+ "fields": {},
80
+ "children": {
81
+ "multiple": true,
82
+ "required": true,
83
+ "types": [
84
+ {
85
+ "type": "style_template",
86
+ "named": true
87
+ },
88
+ {
89
+ "type": "template",
90
+ "named": true
91
+ }
92
+ ]
93
+ }
94
+ },
95
+ {
96
+ "type": "element",
97
+ "named": true,
98
+ "fields": {},
99
+ "children": {
100
+ "multiple": true,
101
+ "required": true,
102
+ "types": [
103
+ {
104
+ "type": "attributes",
105
+ "named": true
106
+ },
107
+ {
108
+ "type": "children",
109
+ "named": true
110
+ },
111
+ {
112
+ "type": "name",
113
+ "named": true
114
+ },
115
+ {
116
+ "type": "selectors",
117
+ "named": true
118
+ },
119
+ {
120
+ "type": "style_bool",
121
+ "named": true
122
+ },
123
+ {
124
+ "type": "style_float",
125
+ "named": true
126
+ },
127
+ {
128
+ "type": "style_func",
129
+ "named": true
130
+ },
131
+ {
132
+ "type": "style_int",
133
+ "named": true
134
+ },
135
+ {
136
+ "type": "style_string",
137
+ "named": true
138
+ }
139
+ ]
140
+ }
141
+ },
142
+ {
143
+ "type": "else_macro",
144
+ "named": true,
145
+ "fields": {},
146
+ "children": {
147
+ "multiple": false,
148
+ "required": true,
149
+ "types": [
150
+ {
151
+ "type": "children",
152
+ "named": true
153
+ }
154
+ ]
155
+ }
156
+ },
157
+ {
158
+ "type": "event",
159
+ "named": true,
160
+ "fields": {},
161
+ "children": {
162
+ "multiple": true,
163
+ "required": true,
164
+ "types": [
165
+ {
166
+ "type": "function",
167
+ "named": true
168
+ },
169
+ {
170
+ "type": "name",
171
+ "named": true
172
+ }
173
+ ]
174
+ }
175
+ },
176
+ {
177
+ "type": "for_if_macro",
178
+ "named": true,
179
+ "fields": {},
180
+ "children": {
181
+ "multiple": true,
182
+ "required": true,
183
+ "types": [
184
+ {
185
+ "type": "children",
186
+ "named": true
187
+ },
188
+ {
189
+ "type": "if_function",
190
+ "named": true
191
+ },
192
+ {
193
+ "type": "list_name",
194
+ "named": true
195
+ },
196
+ {
197
+ "type": "name",
198
+ "named": true
199
+ }
200
+ ]
201
+ }
202
+ },
203
+ {
204
+ "type": "for_macro",
205
+ "named": true,
206
+ "fields": {},
207
+ "children": {
208
+ "multiple": true,
209
+ "required": true,
210
+ "types": [
211
+ {
212
+ "type": "children",
213
+ "named": true
214
+ },
215
+ {
216
+ "type": "list_name",
217
+ "named": true
218
+ },
219
+ {
220
+ "type": "name",
221
+ "named": true
222
+ }
223
+ ]
224
+ }
225
+ },
226
+ {
227
+ "type": "function",
228
+ "named": true,
229
+ "fields": {},
230
+ "children": {
231
+ "multiple": true,
232
+ "required": false,
233
+ "types": [
234
+ {
235
+ "type": "args",
236
+ "named": true
237
+ },
238
+ {
239
+ "type": "name",
240
+ "named": true
241
+ }
242
+ ]
243
+ }
244
+ },
245
+ {
246
+ "type": "if_function",
247
+ "named": true,
248
+ "fields": {},
249
+ "children": {
250
+ "multiple": true,
251
+ "required": true,
252
+ "types": [
253
+ {
254
+ "type": "args",
255
+ "named": true
256
+ },
257
+ {
258
+ "type": "name",
259
+ "named": true
260
+ }
261
+ ]
262
+ }
263
+ },
264
+ {
265
+ "type": "if_macro",
266
+ "named": true,
267
+ "fields": {},
268
+ "children": {
269
+ "multiple": true,
270
+ "required": true,
271
+ "types": [
272
+ {
273
+ "type": "children",
274
+ "named": true
275
+ },
276
+ {
277
+ "type": "function",
278
+ "named": true
279
+ }
280
+ ]
281
+ }
282
+ },
283
+ {
284
+ "type": "prop",
285
+ "named": true,
286
+ "fields": {},
287
+ "children": {
288
+ "multiple": true,
289
+ "required": true,
290
+ "types": [
291
+ {
292
+ "type": "computed",
293
+ "named": true
294
+ },
295
+ {
296
+ "type": "function",
297
+ "named": true
298
+ },
299
+ {
300
+ "type": "name",
301
+ "named": true
302
+ }
303
+ ]
304
+ }
305
+ },
306
+ {
307
+ "type": "selectors",
308
+ "named": true,
309
+ "fields": {},
310
+ "children": {
311
+ "multiple": true,
312
+ "required": true,
313
+ "types": [
314
+ {
315
+ "type": "class",
316
+ "named": true
317
+ },
318
+ {
319
+ "type": "id",
320
+ "named": true
321
+ }
322
+ ]
323
+ }
324
+ },
325
+ {
326
+ "type": "style",
327
+ "named": true,
328
+ "fields": {},
329
+ "children": {
330
+ "multiple": true,
331
+ "required": true,
332
+ "types": [
333
+ {
334
+ "type": "children",
335
+ "named": true
336
+ },
337
+ {
338
+ "type": "name",
339
+ "named": true
340
+ }
341
+ ]
342
+ }
343
+ },
344
+ {
345
+ "type": "style_float",
346
+ "named": true,
347
+ "fields": {}
348
+ },
349
+ {
350
+ "type": "style_func",
351
+ "named": true,
352
+ "fields": {},
353
+ "children": {
354
+ "multiple": true,
355
+ "required": true,
356
+ "types": [
357
+ {
358
+ "type": "function",
359
+ "named": true
360
+ },
361
+ {
362
+ "type": "value",
363
+ "named": true
364
+ }
365
+ ]
366
+ }
367
+ },
368
+ {
369
+ "type": "style_template",
370
+ "named": true,
371
+ "fields": {},
372
+ "children": {
373
+ "multiple": true,
374
+ "required": true,
375
+ "types": [
376
+ {
377
+ "type": "style",
378
+ "named": true
379
+ }
380
+ ]
381
+ }
382
+ },
383
+ {
384
+ "type": "template",
385
+ "named": true,
386
+ "fields": {},
387
+ "children": {
388
+ "multiple": true,
389
+ "required": true,
390
+ "types": [
391
+ {
392
+ "type": "element",
393
+ "named": true
394
+ },
395
+ {
396
+ "type": "else_macro",
397
+ "named": true
398
+ },
399
+ {
400
+ "type": "for_if_macro",
401
+ "named": true
402
+ },
403
+ {
404
+ "type": "for_macro",
405
+ "named": true
406
+ },
407
+ {
408
+ "type": "if_macro",
409
+ "named": true
410
+ }
411
+ ]
412
+ }
413
+ },
414
+ {
415
+ "type": "!#",
416
+ "named": false
417
+ },
418
+ {
419
+ "type": "#!",
420
+ "named": false
421
+ },
422
+ {
423
+ "type": "[",
424
+ "named": false
425
+ },
426
+ {
427
+ "type": "]",
428
+ "named": false
429
+ },
430
+ {
431
+ "type": "arg",
432
+ "named": true
433
+ },
434
+ {
435
+ "type": "class",
436
+ "named": true
437
+ },
438
+ {
439
+ "type": "computed",
440
+ "named": true
441
+ },
442
+ {
443
+ "type": "id",
444
+ "named": true
445
+ },
446
+ {
447
+ "type": "in",
448
+ "named": false
449
+ },
450
+ {
451
+ "type": "list_name",
452
+ "named": true
453
+ },
454
+ {
455
+ "type": "name",
456
+ "named": true
457
+ },
458
+ {
459
+ "type": "style_bool",
460
+ "named": true
461
+ },
462
+ {
463
+ "type": "style_int",
464
+ "named": true
465
+ },
466
+ {
467
+ "type": "style_string",
468
+ "named": true
469
+ },
470
+ {
471
+ "type": "value",
472
+ "named": true
473
+ }
474
+ ]