ranger-compiler 3.0.3 → 3.0.5
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.
- package/CHANGELOG.md +27 -0
- package/README.md +1 -1
- package/dist/Lang.rgr +158 -9
- package/dist/lib/JSON.rgr +31 -4
- package/dist/lib/RangerProcess.rgr +273 -0
- package/dist/lib/stdlib.rgr +33 -3
- package/dist/package.json +1 -1
- package/dist/rgrc.js +1139 -47
- package/package.json +2 -2
- package/dist/lib/lib/ACEEditor.rgr +0 -5
- package/dist/lib/lib/Ajax.rgr +0 -196
- package/dist/lib/lib/CmdParams.rgr +0 -72
- package/dist/lib/lib/Crypto.rgr +0 -90
- package/dist/lib/lib/DOMLib.rgr +0 -307
- package/dist/lib/lib/Engine3D.rgr +0 -870
- package/dist/lib/lib/ImmutableVector.rgr +0 -364
- package/dist/lib/lib/IndexedDB.rgr +0 -32
- package/dist/lib/lib/JSON.rgr +0 -702
- package/dist/lib/lib/JinxProcess.rgr +0 -838
- package/dist/lib/lib/SQL.rgr +0 -44
- package/dist/lib/lib/ServiceLib.rgr +0 -9
- package/dist/lib/lib/Storage.rgr +0 -89
- package/dist/lib/lib/Time.rgr +0 -75
- package/dist/lib/lib/Timers.rgr +0 -176
- package/dist/lib/lib/TypedArrays.rgr +0 -14
- package/dist/lib/lib/ViewLib.rgr +0 -851
- package/dist/lib/lib/WebLib.rgr +0 -47
- package/dist/lib/lib/WebServerLib.rgr +0 -137
- package/dist/lib/lib/ranger-dir.rgr +0 -175
- package/dist/lib/lib/stdlib.rgr +0 -665
- package/dist/lib/lib/stdops.rgr +0 -168
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ranger-compiler",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "Ranger cross-language compiler - compile once, run anywhere",
|
|
5
5
|
"main": "dist/api.js",
|
|
6
6
|
"types": "dist/api.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build:dist": "npm run compile && npm run build:dist:copy",
|
|
26
|
-
"build:dist:copy": "cp ./bin/output.js ./dist/rgrc.js && cp ./bin/Lang.rgr ./dist/Lang.rgr && cp ./bin/stdops.rgr ./dist/stdops.rgr && cp -r ./lib ./dist/lib",
|
|
26
|
+
"build:dist:copy": "cp ./bin/output.js ./dist/rgrc.js && cp ./bin/Lang.rgr ./dist/Lang.rgr && cp ./bin/stdops.rgr ./dist/stdops.rgr && rm -rf dist/lib && cp -r ./lib ./dist/lib",
|
|
27
27
|
"build:dist:module": "node bin/output.js -nodemodule -es6 -typescript ./compiler/ng_Compiler.rgr -d=./compiler/bin -o=api.ts && tsc --declaration --module commonjs --target es2015 --moduleResolution node --outDir ./dist ./compiler/bin/api.ts",
|
|
28
28
|
"prepublishOnly": "npm run build:dist && npm test",
|
|
29
29
|
"test-any-ts": "node bin/testcomp.js ./features/any/test_any.rgr -es6 -typescript",
|
package/dist/lib/lib/Ajax.rgr
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
Import "JSON.rgr"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
operators {
|
|
5
|
-
fetch_json _:void ( url:string callback:(_:void ( data:JSONDataObject )) error:(_:void ()) ) {
|
|
6
|
-
templates {
|
|
7
|
-
ranger ('(post_json ' (e 1) ' ' (e 2) ' ' (e 3) ' ' (e 4) ')' )
|
|
8
|
-
es6 ( "axios.get(" (e 1) ") .then((res)=>{
|
|
9
|
-
(("(e 2) ")(res.data));
|
|
10
|
-
})"
|
|
11
|
-
)
|
|
12
|
-
java7 (
|
|
13
|
-
""
|
|
14
|
-
)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
post_json _@(throws):void ( url:string data:JSONDataObject callback:(_:void ( data:JSONDataObject )) error:(_:void ()) ) {
|
|
18
|
-
templates {
|
|
19
|
-
ranger ('(post_json ' (e 1) ' ' (e 2) ' ' (e 3) ' ' (e 4) ')' )
|
|
20
|
-
es6 ( "axios.post(" (e 1) ", " (e 2) ") .then((res)=>{
|
|
21
|
-
(("(e 3) ")(res.data));
|
|
22
|
-
})"
|
|
23
|
-
)
|
|
24
|
-
java7 ( "AsyncPostTest.PostJSONData( (new AsyncPostTest() { " nl I
|
|
25
|
-
"@Override" nl
|
|
26
|
-
"protected void onPostExecute(String strData) {" nl I
|
|
27
|
-
'try {' I
|
|
28
|
-
(e 3) ".run(new JSONObject(strData)); " nl i
|
|
29
|
-
'} catch( Exception e) {}' nl i
|
|
30
|
-
"}" nl i
|
|
31
|
-
"})," (e 1) ", " (e 2) " ); " (imp "android.os.AsyncTask")
|
|
32
|
-
(imp "org.json.JSONObject") (plugin 'maven' ( (dep 'org.json' 'json' '20171018' ) ) )
|
|
33
|
-
(java_class 'AsyncPostTest' `
|
|
34
|
-
import android.os.AsyncTask;
|
|
35
|
-
|
|
36
|
-
import java.io.BufferedReader;
|
|
37
|
-
import java.io.DataOutputStream;
|
|
38
|
-
import java.io.InputStreamReader;
|
|
39
|
-
import java.net.HttpURLConnection;
|
|
40
|
-
import java.net.URL;
|
|
41
|
-
import org.json.JSONObject;
|
|
42
|
-
|
|
43
|
-
class AsyncPostTest extends AsyncTask<String, Void, String> {
|
|
44
|
-
|
|
45
|
-
private Exception exception;
|
|
46
|
-
public String dataToSend = "";
|
|
47
|
-
public String urlToSend = "";
|
|
48
|
-
static void PostJSONData( AsyncPostTest req, String url, JSONObject data ) {
|
|
49
|
-
req.dataToSend = data.toString();
|
|
50
|
-
req.urlToSend = url;
|
|
51
|
-
req.execute();
|
|
52
|
-
}
|
|
53
|
-
protected String doInBackground(String... urls) {
|
|
54
|
-
HttpURLConnection urlConnection = null;
|
|
55
|
-
StringBuilder x = new StringBuilder();
|
|
56
|
-
try {
|
|
57
|
-
|
|
58
|
-
URL url = new URL(this.urlToSend);
|
|
59
|
-
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
|
60
|
-
connection.setConnectTimeout(500);
|
|
61
|
-
connection.setReadTimeout(500);
|
|
62
|
-
// Allow Outputs (sending)
|
|
63
|
-
connection.setDoOutput(true);
|
|
64
|
-
connection.setUseCaches(false);
|
|
65
|
-
|
|
66
|
-
// Enable POST method
|
|
67
|
-
connection.setRequestMethod("POST");
|
|
68
|
-
connection.setRequestProperty("Content-Type", "application/json");
|
|
69
|
-
connection.setRequestProperty("charset", "utf-8");
|
|
70
|
-
DataOutputStream printout = new DataOutputStream(connection.getOutputStream());
|
|
71
|
-
printout.write(this.dataToSend.getBytes("UTF8"));
|
|
72
|
-
printout.flush();
|
|
73
|
-
// Here you read any answer from server.
|
|
74
|
-
BufferedReader serverAnswer = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
|
75
|
-
String read_data = "";
|
|
76
|
-
String line;
|
|
77
|
-
while ((line = serverAnswer.readLine()) != null) {
|
|
78
|
-
read_data = read_data + line;
|
|
79
|
-
}
|
|
80
|
-
printout.close();
|
|
81
|
-
serverAnswer.close();
|
|
82
|
-
printout.close();
|
|
83
|
-
return read_data;
|
|
84
|
-
} catch (Exception e) {
|
|
85
|
-
e.printStackTrace();
|
|
86
|
-
} finally {
|
|
87
|
-
if (urlConnection != null) {
|
|
88
|
-
urlConnection.disconnect();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return x.toString();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
protected void onPostExecute(String strData) {
|
|
95
|
-
// TODO: check this.exception
|
|
96
|
-
// TODO: do something with the feed
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
`)
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
https_post_json _@(throws):void ( url:string data:JSONDataObject callback:(_:void ( data:JSONDataObject )) error:(_:void ()) ) {
|
|
106
|
-
templates {
|
|
107
|
-
ranger ('(post_json ' (e 1) ' ' (e 2) ' ' (e 3) ' ' (e 4) ')' )
|
|
108
|
-
es6 ( "axios.post(" (e 1) ", " (e 2) ") .then((res)=>{
|
|
109
|
-
(("(e 3) ")(res.data));
|
|
110
|
-
})"
|
|
111
|
-
)
|
|
112
|
-
java7 ( "AsyncHttpsPostTest.PostJSONData( (new AsyncHttpsPostTest() { " nl I
|
|
113
|
-
"@Override" nl
|
|
114
|
-
"protected void onPostExecute(String strData) {" nl I
|
|
115
|
-
'try {' I
|
|
116
|
-
(e 3) ".run(new JSONObject(strData)); " nl i
|
|
117
|
-
'} catch( Exception e) {'nl I
|
|
118
|
-
(e 4) ".run(); " nl i
|
|
119
|
-
'}' nl i
|
|
120
|
-
"}" nl i
|
|
121
|
-
"})," (e 1) ", " (e 2) " ); " (imp "android.os.AsyncTask")
|
|
122
|
-
(imp "org.json.JSONObject") (plugin 'maven' ( (dep 'org.json' 'json' '20171018' ) ) )
|
|
123
|
-
(java_class 'AsyncHttpsPostTest' `
|
|
124
|
-
import android.os.AsyncTask;
|
|
125
|
-
|
|
126
|
-
import java.io.BufferedReader;
|
|
127
|
-
import java.io.DataOutputStream;
|
|
128
|
-
import java.io.InputStreamReader;
|
|
129
|
-
import javax.net.ssl.HttpsURLConnection;
|
|
130
|
-
import java.net.URL;
|
|
131
|
-
import org.json.JSONObject;
|
|
132
|
-
|
|
133
|
-
class AsyncHttpsPostTest extends AsyncTask<String, Void, String> {
|
|
134
|
-
|
|
135
|
-
private Exception exception;
|
|
136
|
-
public String dataToSend = "";
|
|
137
|
-
public String urlToSend = "";
|
|
138
|
-
static void PostJSONData( AsyncHttpsPostTest req, String url, JSONObject data ) {
|
|
139
|
-
req.dataToSend = data.toString();
|
|
140
|
-
req.urlToSend = url;
|
|
141
|
-
req.execute();
|
|
142
|
-
}
|
|
143
|
-
protected String doInBackground(String... urls) {
|
|
144
|
-
HttpsURLConnection urlConnection = null;
|
|
145
|
-
StringBuilder x = new StringBuilder();
|
|
146
|
-
try {
|
|
147
|
-
|
|
148
|
-
URL url = new URL(this.urlToSend);
|
|
149
|
-
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
|
150
|
-
connection.setConnectTimeout(500);
|
|
151
|
-
connection.setReadTimeout(500);
|
|
152
|
-
// Allow Outputs (sending)
|
|
153
|
-
connection.setDoOutput(true);
|
|
154
|
-
connection.setUseCaches(false);
|
|
155
|
-
|
|
156
|
-
// Enable POST method
|
|
157
|
-
connection.setRequestMethod("POST");
|
|
158
|
-
connection.setRequestProperty("Content-Type", "application/json");
|
|
159
|
-
connection.setRequestProperty("charset", "utf-8");
|
|
160
|
-
DataOutputStream printout = new DataOutputStream(connection.getOutputStream());
|
|
161
|
-
printout.write(this.dataToSend.getBytes("UTF8"));
|
|
162
|
-
printout.flush();
|
|
163
|
-
// Here you read any answer from server.
|
|
164
|
-
BufferedReader serverAnswer = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
|
165
|
-
String read_data = "";
|
|
166
|
-
String line;
|
|
167
|
-
while ((line = serverAnswer.readLine()) != null) {
|
|
168
|
-
read_data = read_data + line;
|
|
169
|
-
}
|
|
170
|
-
printout.close();
|
|
171
|
-
serverAnswer.close();
|
|
172
|
-
printout.close();
|
|
173
|
-
return read_data;
|
|
174
|
-
} catch (Exception e) {
|
|
175
|
-
e.printStackTrace();
|
|
176
|
-
} finally {
|
|
177
|
-
if (urlConnection != null) {
|
|
178
|
-
urlConnection.disconnect();
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return x.toString();
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
protected void onPostExecute(String strData) {
|
|
185
|
-
// TODO: check this.exception
|
|
186
|
-
// TODO: do something with the feed
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
`)
|
|
191
|
-
)
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
; -i file2.pdf -o file3.pdf
|
|
4
|
-
class CmdParams @serialize(true) {
|
|
5
|
-
|
|
6
|
-
def flags:[string:boolean]
|
|
7
|
-
def params:[string:string]
|
|
8
|
-
def values:[string]
|
|
9
|
-
|
|
10
|
-
fn hasParam:boolean (name:string) {
|
|
11
|
-
return (has params name)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
fn getParam@(optional):string ( name:string) {
|
|
15
|
-
return (get params name)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
; -p=100
|
|
19
|
-
; -o=""
|
|
20
|
-
fn collect() {
|
|
21
|
-
def cnt (shell_arg_cnt)
|
|
22
|
-
def i 0
|
|
23
|
-
while( cnt > 0 ) {
|
|
24
|
-
def argStr (shell_arg i)
|
|
25
|
-
def firstC (charAt argStr 0)
|
|
26
|
-
if( firstC == (ccode "-") ) {
|
|
27
|
-
def pS (substring argStr 1 (strlen argStr))
|
|
28
|
-
def parts (strsplit pS "=")
|
|
29
|
-
if( (array_length parts) == 1 ) {
|
|
30
|
-
def flag (itemAt parts 0)
|
|
31
|
-
set flags flag true
|
|
32
|
-
} {
|
|
33
|
-
def name (itemAt parts 0)
|
|
34
|
-
remove_index parts 0
|
|
35
|
-
def value (join parts "=")
|
|
36
|
-
set params name value
|
|
37
|
-
}
|
|
38
|
-
} {
|
|
39
|
-
push values argStr
|
|
40
|
-
}
|
|
41
|
-
cnt = cnt - 1
|
|
42
|
-
i = i + 1
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
class test_cmdparams {
|
|
48
|
-
|
|
49
|
-
fn run () {
|
|
50
|
-
def prms (new CmdParams)
|
|
51
|
-
prms.collect()
|
|
52
|
-
print "--- params ----"
|
|
53
|
-
def pNames (keys prms.params)
|
|
54
|
-
for pNames v:string i {
|
|
55
|
-
print v + " = " + (unwrap (get prms.params v))
|
|
56
|
-
}
|
|
57
|
-
print "--- flags ----"
|
|
58
|
-
def flagNames (keys prms.flags)
|
|
59
|
-
for flagNames v:string i {
|
|
60
|
-
print v
|
|
61
|
-
}
|
|
62
|
-
print "--- values ----"
|
|
63
|
-
for prms.values v:string i {
|
|
64
|
-
print v
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
sfn m@(main) () {
|
|
69
|
-
def o (new test_cmdparams)
|
|
70
|
-
o.run()
|
|
71
|
-
}
|
|
72
|
-
}
|
package/dist/lib/lib/Crypto.rgr
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Import "TypedArrays.rgr"
|
|
3
|
-
|
|
4
|
-
systemclass RandomGenerator {
|
|
5
|
-
java7 SecureRandom ( (imp 'java.security.SecureRandom'))
|
|
6
|
-
es6 RandomSource
|
|
7
|
-
}
|
|
8
|
-
systemclass KeyGenerator {
|
|
9
|
-
java7 KeyGenerator ( (imp 'javax.crypto.KeyGenerator'))
|
|
10
|
-
}
|
|
11
|
-
systemclass SecretKey {
|
|
12
|
-
java7 SecretKeySpec ( (imp 'javax.crypto.spec.SecretKeySpec'))
|
|
13
|
-
}
|
|
14
|
-
systemclass Cipher {
|
|
15
|
-
java7 Cipher ( (imp 'javax.crypto.Cipher'))
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
operators {
|
|
21
|
-
|
|
22
|
-
newRandomGenerator _:RandomGenerator () {
|
|
23
|
-
templates {
|
|
24
|
-
java7 ('SecureRandom.getInstance("SHA1PRNG")')
|
|
25
|
-
es6 ( 'window.crypto' )
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
generate _:void ( generator:RandomGenerator buff:RUint32Array) {
|
|
30
|
-
templates {
|
|
31
|
-
es6 ( (e 1) '.getRandomValues(' (e 2) ')')
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
setSeed _:void ( g:RandomGenerator str:string) {
|
|
36
|
-
templates {
|
|
37
|
-
java7 ((e 1) '.setSeed(' (e 2) '.getBytes());')
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
newKeyGenerator _:KeyGenerator () {
|
|
42
|
-
templates {
|
|
43
|
-
java7 ( 'KeyGenerator.getInstance("AES")')
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
init _:void ( kg:KeyGenerator keylen:int rand:RandomGenerator) {
|
|
47
|
-
templates {
|
|
48
|
-
java7 ( (e 1 ) '.init(' (e 2) ', ' (e 3)');' )
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
createAESKey _:SecretKey ( gen:KeyGenerator) {
|
|
52
|
-
templates {
|
|
53
|
-
java7 ('new SecretKeySpec(('(e 1)'.generateKey()).getEncoded(), "AES")')
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
createAESKey _:SecretKey ( bytes:Bytes) {
|
|
57
|
-
templates {
|
|
58
|
-
java7 ('new SecretKeySpec('(e 1)', 0, 128 / 8 , "AES")')
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
newAESCipher _:Cipher ( ) {
|
|
62
|
-
templates {
|
|
63
|
-
java7 ( 'Cipher.getInstance("AES")')
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
init_decoder _:void ( c:Cipher key:SecretKey ) {
|
|
67
|
-
templates {
|
|
68
|
-
java7 ( (e 1) '.init(Cipher.DECRYPT_MODE, ' (e 2) ');')
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
init_encoder _:void ( c:Cipher key:SecretKey ) {
|
|
72
|
-
templates {
|
|
73
|
-
java7 ( (e 1) '.init(Cipher.ENCRYPT_MODE, ' (e 2) ');')
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
encode _@(throws):Bytes ( c:Cipher data:Bytes ) {
|
|
77
|
-
templates {
|
|
78
|
-
java7 ( (e 1) '.doFinal(' (e 2) ')')
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
decode _@(throws):Bytes ( c:Cipher data:Bytes ) {
|
|
82
|
-
templates {
|
|
83
|
-
java7 ( (e 1) '.doFinal(' (e 2) ')')
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
package/dist/lib/lib/DOMLib.rgr
DELETED
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
Import "ViewLib.rgr"
|
|
2
|
-
Import "ACEEditor.rgr"
|
|
3
|
-
|
|
4
|
-
systemclass SystemCanvasElement {
|
|
5
|
-
es6 CanvasElement
|
|
6
|
-
}
|
|
7
|
-
systemclass CanvasDrawCtx {
|
|
8
|
-
es6 CanvasDrawCtx
|
|
9
|
-
}
|
|
10
|
-
systemclass ACEEditor {
|
|
11
|
-
es6 ACE
|
|
12
|
-
}
|
|
13
|
-
systemclass MediaQueryList {
|
|
14
|
-
es6 Object
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
systemunion CoordinateType (double int)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
operator type:void es6 {
|
|
22
|
-
fn window:string ( location@(keyword) ) ('document.location.hash')
|
|
23
|
-
fn hashchange ( cb:(_void ()) ) ('window.addEventListener("hashchange",(_event)=>{ (' (e 1) ')()})')
|
|
24
|
-
|
|
25
|
-
fn mediaQuery:MediaQueryList (query:string) ('window.matchMedia(' (e 1) ')')
|
|
26
|
-
fn matches:boolean (q:MediaQueryList) ( (e 1) '.matches')
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
operators {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
set _:string ( el:ACEEditor text:string ) {
|
|
33
|
-
templates {
|
|
34
|
-
es6 ( (e 1) ".setValue(" (e 2) ")")
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
valueof _:string ( el:ACEEditor ) {
|
|
39
|
-
templates {
|
|
40
|
-
es6 ( (e 1) ".getValue()")
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
create_ace _:ACEEditor ( el:ViewGroup) {
|
|
44
|
-
templates {
|
|
45
|
-
es6 ("ace.edit(" (e 1) ")" )
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
create_ace _:ACEEditor ( el:View) {
|
|
49
|
-
templates {
|
|
50
|
-
es6 ("ace.edit(" (e 1) ")" )
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
set_mode _:void ( el:ACEEditor name:string) {
|
|
54
|
-
templates {
|
|
55
|
-
es6 ( (e 1 )".getSession().setMode(" (e 2) ") " )
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
onChange _:void ( el:ACEEditor code:block) {
|
|
59
|
-
templates {
|
|
60
|
-
es6 ( (e 1 ) ".on(\"input\", () => {" nl I (block 2) i nl "}) " )
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
eval_code _:void (code:string) {
|
|
65
|
-
templates {
|
|
66
|
-
es6 ( "eval(" (e 1 ) ")")
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
window_width _:int () {
|
|
70
|
-
templates {
|
|
71
|
-
es6 ( 'window.innerWidth')
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
window_height _:int () {
|
|
75
|
-
templates {
|
|
76
|
-
es6 ( 'window.innerHeight')
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
ctx _:CanvasDrawCtx (elem:SystemCanvasElement ) {
|
|
80
|
-
templates {
|
|
81
|
-
es6 ((e 1 ) '.getContext("2d")')
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
beginPath _:void ( ctx:CanvasDrawCtx ) {
|
|
86
|
-
templates {
|
|
87
|
-
es6 ( (e 1) ".beginPath();" nl)
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
moveTo _:void (x:CoordinateType y:CoordinateType) {
|
|
91
|
-
templates {
|
|
92
|
-
es6 ( (e 1) ".moveTo(" (e 1) "," (e 2) ");" nl)
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
lineTo _:void (x:CoordinateType y:CoordinateType) {
|
|
96
|
-
templates {
|
|
97
|
-
es6 ( (e 1) ".lineTo(" (e 1) "," (e 2) ");" nl )
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
fill _:void () {
|
|
101
|
-
templates {
|
|
102
|
-
es6 ( (e 1) ".fill()")
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
create_canvas _:SystemCanvasElement ( width:int height:int ) {
|
|
107
|
-
templates {
|
|
108
|
-
es6 ( 'document.createElement("canvas")' )
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
setWidth _:void ( c:SystemCanvasElement width:int) {
|
|
112
|
-
templates {
|
|
113
|
-
es6 ( (e 1) '.width = ' (e 2) ';' nl (e 1) '.style.width = ' (e 2) ' +"px";' nl)
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
setHeight _:void ( c:SystemCanvasElement height:int) {
|
|
117
|
-
templates {
|
|
118
|
-
es6 ( (e 1) '.height = ' (e 2) ';' nl (e 1) '.style.height = ' (e 2) ' +"px";' nl)
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
append _:void ( el:ViewGroup c:SystemCanvasElement ) {
|
|
123
|
-
templates {
|
|
124
|
-
es6 ( (e 1) '.appendChild(' (e 2) ')')
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
beginPath _:void (c:CanvasDrawCtx) {
|
|
129
|
-
templates {
|
|
130
|
-
es6 ( (e 1 ) ".beginPath()")
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
scale _:void (c:CanvasDrawCtx amount:CoordinateType) {
|
|
134
|
-
templates {
|
|
135
|
-
es6 ( (e 1 ) ".scale(" (e 2) ", " (e 2) ")")
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
translate _:void (c:CanvasDrawCtx x:CoordinateType y:CoordinateType) {
|
|
139
|
-
templates {
|
|
140
|
-
es6 ( (e 1 ) ".translate(" (e 2) ", " (e 3) ")")
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
fill _:void (c:CanvasDrawCtx) {
|
|
144
|
-
templates {
|
|
145
|
-
es6 ( (e 1 ) ".fill()")
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
stroke _:void (c:CanvasDrawCtx) {
|
|
149
|
-
templates {
|
|
150
|
-
es6 ( (e 1 ) ".stroke()")
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
stroke _:void (c:CanvasDrawCtx color:string width:CoordinateType) {
|
|
154
|
-
templates {
|
|
155
|
-
es6 ( (e 1 ) ".strokeStyle = " (e 2) nl (e 1 ) ".lineWidth = " (e 3) nl )
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
stroke _:void (c:CanvasDrawCtx color:string) {
|
|
159
|
-
templates {
|
|
160
|
-
es6 ( (e 1 ) ".strokeStyle = " (e 2))
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
fillStyle _:void (c:CanvasDrawCtx color:string) {
|
|
164
|
-
templates {
|
|
165
|
-
es6 ( (e 1 ) ".fillStyle = " (e 2))
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
moveTo _:void (c:CanvasDrawCtx x:CoordinateType y:CoordinateType) {
|
|
169
|
-
templates {
|
|
170
|
-
es6 ( (e 1 ) ".moveTo(" (e 2) "," (e 3) ")")
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
lineTo _:void (c:CanvasDrawCtx x:CoordinateType y:CoordinateType) {
|
|
174
|
-
templates {
|
|
175
|
-
es6 ( (e 1 ) ".lineTo(" (e 2) "," (e 3) ")")
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
bezierCurveTo _:void (c:CanvasDrawCtx x1:CoordinateType y1:CoordinateType x2:CoordinateType y2:CoordinateType x3:CoordinateType y3:CoordinateType) {
|
|
179
|
-
templates {
|
|
180
|
-
es6 ( (e 1 ) ".bezierCurveTo(" (e 2) "," (e 3) "," (e 4) "," (e 5) "," (e 6) "," (e 7) ")")
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
get_context _:CanvasDrawCtx ( e:SystemCanvasElement) {
|
|
184
|
-
templates {
|
|
185
|
-
es6 ( (e 1 ) ".getContext(\"2d\") ")
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
save _:void ( e:CanvasDrawCtx) {
|
|
189
|
-
templates {
|
|
190
|
-
es6 ( (e 1) '.save()')
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
restore _:void ( e:CanvasDrawCtx) {
|
|
194
|
-
templates {
|
|
195
|
-
es6 ( (e 1) '.restore()')
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
opacity _:void (e:CanvasDrawCtx v:double) {
|
|
199
|
-
templates {
|
|
200
|
-
es6 ( (e 1) '.globalAlpha = ' (e 2))
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
document_body base:ViewGroup () {
|
|
204
|
-
templates {
|
|
205
|
-
es6 ("document.body")
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
create_text _:ViewGroup ( text:string) {
|
|
209
|
-
templates {
|
|
210
|
-
es6 ("document.createTextNode( " (e 1) ")")
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
getChild _@(optional):ViewGroup ( el:ViewGroup i:int) {
|
|
214
|
-
templates {
|
|
215
|
-
es6 ( (e 1) ".children[" (e 2) "]")
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
; myAnchor.parentNode.replaceChild(mySpan, myAnchor);
|
|
219
|
-
replace_dom _:ViewGroup ( oldEl:ViewGroup newEl:ViewGroup ) {
|
|
220
|
-
templates {
|
|
221
|
-
es6 ( (e 1) ".parentNode.replaceChild( " (e 2) ", " (e 1) ")")
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
clear _:ViewGroup ( oldEl:ViewGroup ) {
|
|
225
|
-
templates {
|
|
226
|
-
es6 ( "while( " (e 1) ".firstChild) " (e 1) ".removeChild( " (e 1) ".firstChild);" )
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
remove_dom _:ViewGroup ( oldEl:ViewGroup ) {
|
|
230
|
-
templates {
|
|
231
|
-
es6 ( "(" (e 1) ".parentNode ? " (e 1) ".parentNode.removeChild( " (e 1) ") : null);")
|
|
232
|
-
ranger ( '(remove_dom ' (e 1) ')' )
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
create_element _:ViewGroup ( elName:string) {
|
|
236
|
-
templates {
|
|
237
|
-
es6 ("document.createElement( " (e 1) ")")
|
|
238
|
-
ranger ("(create_dom " (e 1) ")")
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
set_class _:void ( el:ViewGroup className:string ) {
|
|
242
|
-
templates {
|
|
243
|
-
es6 ( (e 1) ".className = " (e 2))
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
value _:void ( el:ViewGroup value:string ) {
|
|
247
|
-
templates {
|
|
248
|
-
es6 ( (e 1) ".value = " (e 2))
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
value _:string ( el:ViewGroup) {
|
|
252
|
-
templates {
|
|
253
|
-
es6 ( (e 1) ".value")
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
add_listener _:void (el:ViewGroup name:string cb:(_:void (event:DOMEvent))) {
|
|
257
|
-
templates {
|
|
258
|
-
es6 ( (e 1) ".addEventListener( " ( e 2 ) ", " (e 3) ")")
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
clone _:ViewGroup (elem:ViewGroup) {
|
|
262
|
-
templates {
|
|
263
|
-
es6 ( (e 1) ".cloneNode(true)")
|
|
264
|
-
ranger ( '(clone ' (e 1 )' )')
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
insert _:void (el:ViewGroup newChild:ViewGroup index:int) {
|
|
268
|
-
templates {
|
|
269
|
-
es6 ( (e 1) ".insertBefore( " (e 2) ", " (e 1) ".children[" (e 3) "]);")
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
add _:void (el:ViewGroup newChild:ViewGroup) {
|
|
273
|
-
templates {
|
|
274
|
-
es6 ( (e 1) ".appendChild(" (e 2) ");")
|
|
275
|
-
ranger ( '(add ' (e 1 )' ' (e 2) ' )')
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
attr _:void (el:ViewGroup name:string value:string ) {
|
|
279
|
-
templates {
|
|
280
|
-
es6 ( (e 1) ".setAttribute(" (e 2) ", " (e 3)")")
|
|
281
|
-
ranger ('(attr ' (e 1 ) ' ' (e 2 ) ' ' (e 3 ) ' ) ')
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
text _:void (el:ViewGroup value:string ) {
|
|
285
|
-
templates {
|
|
286
|
-
es6 ( (e 1) ".textContent = " (e 2) )
|
|
287
|
-
ranger ('(text ' (e 1) ' ' (e 2) ')')
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
find_canvas _@(optional):SystemCanvasElement (id:string) {
|
|
291
|
-
templates {
|
|
292
|
-
es6 ( 'document.getElementById(' (e 1) ')')
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
find_element _@(optional):ViewGroup (id:string) {
|
|
296
|
-
templates {
|
|
297
|
-
es6 ( 'document.getElementById(' (e 1) ')')
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
find_element_by_attr _@(optional):ViewGroup ( attr:string value:string ) {
|
|
301
|
-
templates {
|
|
302
|
-
es6 ( `document.querySelectorAll('[' + ` (e 1) ` + '="' + ` (e 2) ` + '"]')[0]` )
|
|
303
|
-
ranger ( '(find_element_by_attr ' (e 1) ' ' (e 2) ')' )
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|