git @ Cat's Eye Technologies Velo / master
Merge pull request #4 from catseye/develop-2019-2 Develop 2019 2 Chris Pressey authored 2 years ago GitHub committed 2 years ago
6 changed file(s) with 37 addition(s) and 46 deletion(s). Raw diff Collapse all Expand all
00 Velo
11 ====
22
3 _Language version 0.1, distribution revision 2019.0306_
3 _Language version 0.1, distribution revision 2019.0326_
44
55 > "Jaws was never my scene, and I don't like Star Wars."
66 > -- Queen, "Bicycle Race"
00 #!/usr/bin/env ruby
11
22 require 'pathname'
3 pn = Pathname.new(File.dirname(__FILE__)) + '../src'
4 $:.push(pn.realpath())
3 $:.push(Pathname.new(__FILE__).realpath().dirname() + '../src/')
54 require 'velo'
0 examplePrograms = [
1 {
2 "contents": "Jonkers = {\n IO.print {Hello}\n}.create new\n",
3 "filename": "class.velo"
4 },
5 {
6 "contents": "IO.print ({Hello, }.\n concat {world!})\n",
7 "filename": "concat.velo"
8 },
9 {
10 "contents": "extend IO\na = {Hello, world!}\nprint a\n",
11 "filename": "hello-world.velo"
12 },
13 {
14 "contents": "yes = {IO.print {Yes}}\nno = {IO.print {No}}\nif ({X}.equals {Y}), yes, no\nif ({X}.equals {X}), yes, no\n",
15 "filename": "if.velo"
16 },
17 {
18 "contents": "bar = {IO.print {Hello, }.concat #1}.method\nbar {there.}\n",
19 "filename": "method-args.velo"
20 },
21 {
22 "contents": "count = {\n temp = #1\n if (temp.equals {XXXXXX}), { IO.print {Done!}}, {\n IO.print temp\n count temp.concat {X}\n }\n}.method\ncount {X}\n",
23 "filename": "recur.velo"
24 },
25 {
26 "contents": "eeyore = IO\nfoo = {eeyore.print {Hello, world! Sincerely yours, foo.}}.method\nfoo\n",
27 "filename": "script-method.velo"
28 }
29 ];
+0
-30
eg/index.js less more
0 examplePrograms = [
1 [
2 "class.velo",
3 "Jonkers = {\n IO.print {Hello}\n}.create new\n"
4 ],
5 [
6 "concat.velo",
7 "IO.print ({Hello, }.\n concat {world!})\n"
8 ],
9 [
10 "hello-world.velo",
11 "extend IO\na = {Hello, world!}\nprint a\n"
12 ],
13 [
14 "if.velo",
15 "yes = {IO.print {Yes}}\nno = {IO.print {No}}\nif ({X}.equals {Y}), yes, no\nif ({X}.equals {X}), yes, no\n"
16 ],
17 [
18 "method-args.velo",
19 "bar = {IO.print {Hello, }.concat #1}.method\nbar {there.}\n"
20 ],
21 [
22 "recur.velo",
23 "count = {\n temp = #1\n if (temp.equals {XXXXXX}), { IO.print {Done!}}, {\n IO.print temp\n count temp.concat {X}\n }\n}.method\ncount {X}\n"
24 ],
25 [
26 "script-method.velo",
27 "eeyore = IO\nfoo = {eeyore.print {Hello, world! Sincerely yours, foo.}}.method\nfoo\n"
28 ]
29 ];
1717 var select = document.createElement("select");
1818 for (var i = 0; i < optionsArray.length; i++) {
1919 var op = document.createElement("option");
20 op.value = optionsArray[i].value;
21 op.text = optionsArray[i].text;
20 op.text = optionsArray[i].filename;
21 op.value = optionsArray[i].contents;
2222 select.options.add(op);
2323 }
2424 select.onchange = function(e) {
4141 }
4242
4343 var controlPanel = document.getElementById('control-panel');
44 var optionsArray = [];
45 for (var i = 0; i < examplePrograms.length; i++) {
46 optionsArray.push({
47 value: examplePrograms[i][1],
48 text: examplePrograms[i][0]
49 });
50 }
51
52 var select = makeSelect(controlPanel, "example program:", optionsArray, function(option) {
53 document.getElementById('editor').value = option.value;
44 var select = makeSelect(controlPanel, "example program:", examplePrograms, function(option) {
45 document.getElementById('editor').value = option.contents;
5446 });
5547 selectOptionByText(select, "hello-world.velo");
5648 }
1717 </div>
1818
1919 <script src="https://catseye.tc/contrib/fengari-web-v0.1.4/fengari-web.js"></script>
20 <script src="../../../eg/index.js"></script>
20 <script src="../../../eg/examplePrograms.jsonp.js"></script>
2121 <script src="velo-fengari-launcher.js"></script>
2222 <script type="application/lua" src="../src/velo.lua" async></script>
2323 <script>