|
1 | 1 | local cat
|
2 | 2 |
|
3 |
| -cat.rule.inner.default = function (self) |
4 |
| - self.istruly = true |
| 3 | +cat.rule.default = function (self) |
| 4 | + self.isTruly = true |
5 | 5 | self.truly = self
|
6 | 6 | self.falsy = cat.class 'never'
|
7 | 7 | self.view = self.name
|
8 | 8 | end
|
9 | 9 |
|
10 |
| -cat.rule.inner.never = function (self) |
11 |
| - self.istruly = nil |
| 10 | +cat.rule.never = function (self) |
| 11 | + self.isTruly = nil |
12 | 12 | end
|
13 | 13 |
|
14 |
| -cat.rule.inner.any = function (self) |
15 |
| - self.istruly = nil |
| 14 | +cat.rule.any = function (self) |
| 15 | + self.isTruly = nil |
16 | 16 | self.truly = cat.class 'truly'
|
17 | 17 | self.falsy = cat.boolean(false) | cat.class 'nil'
|
18 | 18 | end
|
19 | 19 |
|
20 |
| -cat.rule.inner['nil'] = function (self) |
21 |
| - self.istruly = false |
| 20 | +cat.rule['nil'] = function (self) |
| 21 | + self.isTruly = false |
22 | 22 | self.truly = cat.class 'never'
|
23 | 23 | self.falsy = self
|
24 | 24 | end
|
25 | 25 |
|
26 |
| -cat.rule.inner.boolean = function (self) |
| 26 | +cat.rule.boolean = function (self) |
27 | 27 | if self.value == true then
|
28 |
| - self.istruly = true |
| 28 | + self.isTruly = true |
29 | 29 | self.truly = self
|
30 | 30 | self.falsy = cat.class 'never'
|
31 | 31 | elseif self.value == false then
|
32 |
| - self.istruly = false |
| 32 | + self.isTruly = false |
33 | 33 | self.truly = cat.class 'never'
|
34 | 34 | self.falsy = self
|
35 | 35 | else
|
36 |
| - self.istruly = nil |
| 36 | + self.isTruly = nil |
37 | 37 | self.truly = cat.boolean(true)
|
38 | 38 | self.falsy = cat.boolean(false)
|
39 | 39 | end
|
40 | 40 | end
|
41 | 41 |
|
42 |
| -cat.rule.inner.number = function (self) |
43 |
| - self.istruly = true |
| 42 | +cat.rule.number = function (self) |
| 43 | + self.isTruly = true |
44 | 44 | self.truly = self
|
45 | 45 | self.falsy = cat.class 'never'
|
46 | 46 | self.view = tostring(self.value)
|
47 | 47 | end
|
48 | 48 |
|
49 |
| -cat.rule.inner.integer = function (self) |
50 |
| - self.istruly = true |
| 49 | +cat.rule.integer = function (self) |
| 50 | + self.isTruly = true |
51 | 51 | self.truly = self
|
52 | 52 | self.falsy = cat.class 'never'
|
53 | 53 | self.view = tostring(self.value)
|
54 | 54 | end
|
55 | 55 |
|
56 |
| -cat.rule.inner.string = function (self) |
57 |
| - self.istruly = true |
| 56 | +cat.rule.string = function (self) |
| 57 | + self.isTruly = true |
58 | 58 | self.truly = self
|
59 | 59 | self.falsy = cat.class 'never'
|
60 | 60 | self.view = cat.util.viewString(self.value, self.quotation)
|
61 | 61 | end
|
62 | 62 |
|
63 |
| -cat.rule.inner.union = function (self) |
64 |
| - self.istruly = function (union) |
65 |
| - local istruly = union.subs[1].istruly |
66 |
| - if istruly == nil then |
| 63 | +cat.rule.union = function (self) |
| 64 | + self.isTruly = function (union) |
| 65 | + local isTruly = union.subs[1].isTruly |
| 66 | + if isTruly == nil then |
67 | 67 | return nil
|
68 | 68 | end
|
69 |
| - if istruly == true then |
| 69 | + if isTruly == true then |
70 | 70 | for i = 2, #union.subs do
|
71 |
| - if union.subs[i].istruly ~= true then |
| 71 | + if union.subs[i].isTruly ~= true then |
72 | 72 | return nil
|
73 | 73 | end
|
74 | 74 | end
|
75 | 75 | return true
|
76 | 76 | else
|
77 | 77 | for i = 2, #union.subs do
|
78 |
| - if union.subs[i].istruly ~= false then |
| 78 | + if union.subs[i].isTruly ~= false then |
79 | 79 | return nil
|
80 | 80 | end
|
81 | 81 | end
|
@@ -120,3 +120,9 @@ cat.rule.inner.union = function (self)
|
120 | 120 | return table.concat(views, '|')
|
121 | 121 | end
|
122 | 122 | end
|
| 123 | + |
| 124 | +cat.custom.dofile.onReturn = function (context) |
| 125 | + local filename = context.args[1].asString |
| 126 | + local file = cat.files[filename] |
| 127 | + return file.returns[1] |
| 128 | +end |
0 commit comments