-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelp.txt
More file actions
360 lines (328 loc) · 11.6 KB
/
help.txt
File metadata and controls
360 lines (328 loc) · 11.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
/********
---- Tuxedo Baseline ----
-- Special (a.k.a "pa.t.ch" [patches]) --
<$n> ... </$n> - no.t.ch, any code put between the html-like tags will be treated as native JS
<$s> ... </$s> - so.t.ch, any code put between the html-like tags will be parsed as some TS, then JS (shorcuts, and threads can be used)
<$t> ... </$t> - to.t.ch, no need, just a proposal
-- Comments --
## - single line comment, or multi-line comment ending
#* - multi-line comment starter
#*# - multi-line comment starter ("author tags", or "embroider tags")
@aut - author
@lie - license
@dat - date
@tie - time
@url - url
@ver - version
##! - strict mode
## +thread - enable an html-attribute via inline script
can be: advance clean eval hide html-editor js-editor js-unit legacy math ugly wordy
## -thread - disable an html-attribute via inline script
can be: advance clean eval hide html-editor js-editor js-unit legacy math ugly wordy
## @x - emulates that JS version: 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.8.1, 1.8.5
## *a: b; - replace all $a with b (soft baste)
## **a: b; - replace all $a with parsed b (hard baste)
-- Sequences and Strings --
\c - escape character, for use in/out of strings (darns)
can be: / \ & ? : ; . @ # % $ < > + - * ( ) [ ] { } | ^
`...` - multiline string /runs script/
`...!white-sapce` - removes extra white space characters /!white-space can be put anywhere in the string/
-- Variables --
#a - var a
a--b - a_b
a#b - a[b]
a#0b - a[a.length - b]
@ - this or self, depending on the JS version
# - this or self, depending on the JS version
@a - this.a
$of - typeof
$del - delete
$args - arguments
$doc - document
$win - window
$nav - navigator
$loc - location
$cont - continue
$con - console
$# - Object
$Obj - Object
$obj - Object
.$id - getElementById
.$class - getElementsByClassName
.$tag - getElementsByTagName
.$html - innerHTML
.$text - innerText
.$val - value
.$qy - querySelector
.$Qy - querySelectorAll
...$args - depending on the JS version, either calls on the last constructor, or does nothing
a: b - if there isn't a comma after b, there will be one added, unless b is the last item
-- functions --
<- - return
$a b, c, d - function a(b, c, d)
:$a, b, c - function(a, b, c)
=$a, b, c - function(a, b, c)
,$a, b, c - function(a, b, c)
$: - function()
${ - function()
-- Loops and Statements --
a?? - test if a exists
a!?? - test if a doesn't exist
?a: - if a
?a { - if a
:: - else
}{ - else
:?a: - else if a
}?a{ - else if a
?#a, b - for a, to b by 1
?#a, b, c - for a = b, to c by 1
?#a, b, c, d - for a = b, to c, by d
-?#a, b - for a, to b by -1
-?#a, b, c - for a = b, to c by -1
-?#a, b, c, d - for a = b, to c, by d
?#a:b - for a in b
?#a:b ? c - for a, to b by 1, do c /!deprecated/ use ?#a,b {c}
?: - do
?a; - while a
?(a) - switch a
@def - default
@a: - case a
---- "Advance thread" features ----
.a - class x
.a b - class a extends b
*. - super
@(a, b, c) - constructor(a, b, c)
b => a - const a = b
a --> b - a = (arguments) => b
-> - =>
$*a, b, c: - void function(a, b, c)
$*a, b, c { - void function(a, b, c)
prom a - creates a promissory function (like Java's "interface", Tux "gusset"); see http://codepen.io/Ephellon/pen/MKWaja
Tux will automatically create a main function to call from, and switch through the number/type(s) of arguments to find a match
supported types: Array Boolean Function Number Object RegExp String Symbol * [any]
---- "Legacy thread" features ----
a ~= b - a = -(a - b)
a &= b - a = a && b
a |= b - a = a || b
a ^= b - if a != null, a = b
a ?= b - if a == null, a = b
-- Special --
@x..y: - "case x..y:" -- this will repeat "case ...:" for (x-y) times /i.e. "@4..6:" -> "case 4: case 5: case 6:"
-- Arrays (try limiting them to one per line) --
a[b..c] - a.slice(b, c)
a[..c] - a.slice(0, c)
a[b..] - a.slice(b)
a[.] - a.slice(0)
a[*] - a.split("")
a[*]b - a.split(b)
a[+]<b,c,...> - a.concat(b, c, ...)
a[++]<b,c,...> - a.push(b, c, ...)
a[<] - a.shift()
a[>]<b,c,...> - a.unshift(b, c, ...)
a[~]<b> - a.every(b)
a[&]<b> - a.join(b)
a[+?]<b,c> - a.indexOf(b, c) > -1
a[?]<b,c> - a.indexOf(b, c)
a[-?]<b,c> - a.lastIndexOf(b, c)
a[=] - a.reverse()
a[^]<b> - a.sort(b)
a[-] - a.pop()
d[] - if d is a number, it creates a d-dimension array (Tux Array "gores"), i.e. 3[] === [[[]]] /called on as [x][y][z]/
r:a - if r is a reserved word, it will be double-quoted
.r - if r is a reserved word, it will be double-quoted and bracketed; ["r"]
-- Strings --
"${a}" - interpolation, ..." + a + "...
'${a}' - interpolation, ...' + a + '...
`${a}` - interpolation, ...` + a + `...
"..." "..." - automatic concatination, "..." + "..."
'...' '...' - automatic concatination, '...' + '...'
`...` `...` - automatic concatination, `...` + `...`
d * "..." - (Tux String "gores") if d is a number, then the string will be repeated d many times
d * '...' - if d is a number, then the string will be repeated d many times
d * `...` - if d is a number, then the string will be repeated d many times
-- RegExp --
\a - Alpha characters, [a-zA-Z]
\A - Non-alpha characters, [^a-zA-Z]
\j - JS variables, [a-zA-Z\$_][\w\d\$_]*
\J - non-JS variables, [^a-zA-Z\$_][\w\d\$_]*
\k - lowercase, \k[A-fR-Z] = /[a-fr-z]/
\K - uppercase, \K[A0fR-Z] = /[A-FR-Z]/
---- "Math thread" features ----
a(b) = c - function a(b){ return c; }
da - if d is a number, then d * a
a~b - ((a % b + b) % b)
|a| - Math.abs(a)
a^b - Math.pow(a, b)
a**b - Math.pow(a, b)
/?a/ - Math.sqrt(a)
a/?b/ - "a" root of b, i.e. 3\x\ is the cube root of x
a%%b - Math.floor(a/b)
log a (b) - log, base a, of b /log(b) / log(a)/
@.property - Math.property, i.e. @.PI = Math.PI, @.log = Math.log /notice the ./
---- "Wordy thread" features ----
-- Loops and Statements --
a exists - test if a exists
a exist - test if a exists
a !exists - test if a doesn't exist
a !exist - test if a doesn't exist
if a: - if a
if a { - if a
else - automatic braces for else
else-if a: - else if a
else-if a { - else if a
else-when a: - else if a
else-when a { - else if a
else-where a: - else if a
else-where a { - else if a
if a then b else c - ternary operator, (a)?b:c
for a, b - for a, to b by 1
for a, b, c - for a = b, to c by 1
for a, b, c, d - for a = b, to c, by d
-for a, b - for a, to b by -1
-for a, b, c - for a = b, to c by -1
-for a, b, c, d - for a = b, to c, by d
for a: b - for a in b
for a in b - for a in b
for a: b? c - for a, to b by 1, do c
for a in b do c - for a, to b by 1, do c
do: - do
do - do
while a; - while a
until a; - while !a
switch a - switch a
a(b) from c while d - for each item in c, if d is true, do b = c[...], a(b)
a(b) from c - for each item in c, do b = c[...], a(b)
a() from b while c - for each item in b, if c is true, do a
-- Baseline --
#r - if r is a Tuxedo reserved word, then it will be a variable
\r - if r is a Tuxedo reserved word, then it will be a variable
AND - &&
OR - ||
XOR - ^
NOT - !
does not - !
do not - !
doesnt - !
does - !!
on - true
yes - true
good - true
off - false
no - false
bad - false
maybe - true | false /uses Math.random()/
is not - !==
isnt - !==
equals - ===
equal - ===
is - ===
the x is - x =
a = b in c - a = c[b]
a = b from c - a = c.indexOf(b)
<?> - ? armscye
<!> - ! armscye
<#> - # armscye
---- "Ugly thread" features ----
single line comments become multi-line
undefined - void 0
true - !0
!false - !0
!!true - !0
false - !1
!true - !1
!!false - !1
Number(a) - (+a)
a.toString() - a + ""
while(x) - for(;x;)
multiple zeros are "crunched" down to a 1eX form, i.e. 10000000 = 1e7
boolean tests become lazy, i.e. && = &, || = |
---- "JS-Unit thread" features ----
-- Baseline --
@@ - JSUNIT
@@toconsole - redirect all output to the console
(@Test ... { ... }#) - test to run, and optional event arguments
(@Test ... { ... }) - "empty" test, doesn't run
@Before - code to run before every test
@After - code to run after every test
-- Assert Tests --
@@assert(value, [comment]) - log that you wanted value
@@assertTrue(value, [comment]) - log that you wanted value to be true
@@assertFalse(value, [comment]) - log that you wanted value to be false
@@assertEquals(expected, recieved, [comment]) - log that you wanted recieved to equal expected
@@assertNotEquals(expected, recieved, [comment]) - log that you wanted recieved to not equal expected
@@assertNull(value, [comment]) - log that you wanted value to be null
@@assertNotNull(value, [comment]) - log that you wanted value to not be null
@@assertUndefined(value, [comment]) - log that you wanted typeof value to be undefined
@@assertNotUndefined(value, [comment]) - log that you wanted typeof value to not be undefined
@@assertNaN(value, [comment]) - log that you wanted value to be NaN
@@assertNotNaN(value, [comment]) - log that you wanted value to not be NaN
@@assertFail(comment) - log fail, "comment"
---- "Advance + Legacy cord [threads]" features ----
-- Splats --
$a b... - same as b = arguments
$a b, c... - c will be all arguments after b
$a b..., c - b will be all arguments before c
$a b, c..., d - c will be all arguments between b and d
a(b...) - same as a(b) uses .apply
a(b, c...) - a([b c]) uses .apply
a(b..., c) - a([b c]) uses .apply
a(b, c..., d) - a([b c d]) uses .apply
<@> - @ armscye
<&> - & armscye
---- Armscyes ----
! - "index_counter"
@ - "arguments"
# - "undefined"
? - "ANON"
* - "use strict"
& - "Array" or "[].slice.call"
---- Godets [Legacy] ----
a b - a(b)
a "b" - a("b")
a 'b' - a('b')
a `b` - a(`b`)
a /b/ - a(/b/)
---- Tuxedo Methods ----
* $ means executable
* ~ means "same as above," but with different arguments
* # means a property, that isn't a method
* tuxedo === tux
tux
.get
.form
$ .data - get form data from the URI
.storage
$ .set[...] - set the local storage [name, data, name, data ...]
$ .check[name] - see if the local storage at the name exists
$ .get[name] - get the local storage at the name
$ .delete[name] - delete the local storage at the name
$ .attr[element, attribute, value] - set the attribute as the value
$ .id[element, attribute, value] - set the attribute as the value
~ .id[element, html] - set the innerHTML as the value
~ .id[element] - just return the element, by id
$ .class[element, attribute, value] - set the attribute as the value
~ .class[element, html] - set the innerHTML as the value
~ .class[element] - just return the element, by class name
$ .tag[element, attribute, value] - set the attribute as the value
~ .tag[element, html] - set the innerHTML as the value
~ .tag[element] - just return the element, by tag name
$ .ele[element, number, attribute, value] - set the attribute as the value
~ .ele[element, number, html] - set the innerHTML as the value
~ .ele[element, number] - just return the element, by element name (via querySelector)
$ .save[data, name] - tux.storage.set(name, data)
$ .load[name] - tux.storage.get(name)
$ .delete[name] - tux.storage.delete(name)
$ .typeof[object] - returns the typeof "object" to a string, i.e. true === "<true>", [1, 2, 3] === "[1, 2, 3]"
$ .typeOf[a, b, c] - returns a string of each arguments type
$ .precompiled - returns an object as if a snap-shot of the data being compiled
# .content - returns the actual "snap-shot"
# .channels - returns the channels {no}
# .comments - returns an object of the comments {plural, single}
# .regexps - returns the regexps
# .strings - returns an object of strings {double, grave, single}
# .threads - returns an object of threads {available, disabled, enabled}
$ .stamp - returns an object containing a start, stop, and difference of the TuxedoScript compile time {start, end, span}
# .version - the TuxedoScript version
$ .support - returns an array of all JS versions supported by the user's browser i.e. [1.1 ... 1.8.5]
$ .runtime - returns the JS version that has been detected
********/