aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs
diff options
context:
space:
mode:
Diffstat (limited to 'spec/inputs')
-rw-r--r--spec/inputs/macro.yue33
-rw-r--r--spec/inputs/macro_export.yue18
2 files changed, 51 insertions, 0 deletions
diff --git a/spec/inputs/macro.yue b/spec/inputs/macro.yue
index ae14f53..a2e1046 100644
--- a/spec/inputs/macro.yue
+++ b/spec/inputs/macro.yue
@@ -5,6 +5,39 @@ import "macro_export" as {
5 5
6import "macro_todo" as $ 6import "macro_todo" as $
7 7
8macro WindowFlag = $enum(
9 NoNav
10 NoDecoration
11 NoTitleBar
12 NoResize
13 NoMove
14 NoScrollbar
15 NoScrollWithMouse
16 NoCollapse
17 AlwaysAutoResize
18 NoSavedSettings
19 NoInputs
20 MenuBar
21 HorizontalScrollbar
22 NoFocusOnAppearing
23 NoBringToFrontOnFocus
24 AlwaysVerticalScrollbar
25 AlwaysHorizontalScrollbar
26 NoNavInputs
27 NoNavFocus
28 UnsavedDocument
29)
30
31print $WindowFlag AlwaysAutoResize
32print $WindowFlag(
33 NoNav
34 NoDecoration
35 NoTitleBar
36 NoResize
37 NoMove
38 NoScrollbar
39)
40
8$asserts item == nil 41$asserts item == nil
9 42
10$myconfig false 43$myconfig false
diff --git a/spec/inputs/macro_export.yue b/spec/inputs/macro_export.yue
index eec5848..cc7d459 100644
--- a/spec/inputs/macro_export.yue
+++ b/spec/inputs/macro_export.yue
@@ -44,6 +44,24 @@ do
44 _dst_.#{field} = _src_.#{field} 44 _dst_.#{field} = _src_.#{field}
45"}" 45"}"
46 46
47export macro enum = (...) ->
48 items = {...}
49 items = [item\gsub('"', '') for item in *items]
50 itemSet = {item, true for item in *items}
51 (...) ->
52 count = select "#", ...
53 if 1 < count
54 result = "["
55 for i = 1, count
56 item = select i, ...
57 error "got \"#{item}\", expecting one of #{table.concat items, ', '}" unless itemSet[item]
58 result ..= "\"#{item}\","
59 result .. "]"
60 else
61 item = select 1, ...
62 error "got \"#{item}\", expecting one of #{table.concat items, ', '}" unless itemSet[item]
63 "\"#{item}\""
64
47$ -> 65$ ->
48 global debugMode = true 66 global debugMode = true
49 global debugMacro = true 67 global debugMacro = true