Skip to content

Commit b4d2bbe

Browse files
committed
Doc
1 parent ef0056f commit b4d2bbe

File tree

8 files changed

+69
-28
lines changed

8 files changed

+69
-28
lines changed

EasyCoder.tar.gz

19.7 MB
Binary file not shown.

easycoder/easycoder-min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

easycoder/easycoder.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,6 +2240,7 @@ const EasyCoder_Core = {
22402240
if (command.name) {
22412241
const symbolRecord = program.getSymbolRecord(command.name);
22422242
EasyCoder.scripts[symbolRecord.program].exit();
2243+
symbolRecord.program = null;
22432244
} else {
22442245
return 0;
22452246
}

js/plugins/browser.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,34 @@ const EasyCoder_Browser = {
510510
}
511511
},
512512

513+
Focus: {
514+
515+
compile: (compiler) => {
516+
const lino = compiler.getLino();
517+
if (compiler.nextIsSymbol()) {
518+
const symbol = compiler.getToken();
519+
compiler.next();
520+
compiler.addCommand({
521+
domain: `browser`,
522+
keyword: `focus`,
523+
lino,
524+
symbol
525+
});
526+
return true;
527+
}
528+
compiler.addWarning(`Unrecognised syntax in 'focus'`);
529+
return false;
530+
},
531+
532+
run: (program) => {
533+
const command = program[program.pc];
534+
const symbol = program.getSymbolRecord(command.symbol);
535+
const element = symbol.element[symbol.index];
536+
element.focus();
537+
return command.pc + 1;
538+
}
539+
},
540+
513541
FORM: {
514542

515543
compile: (compiler) => {
@@ -2347,6 +2375,8 @@ const EasyCoder_Browser = {
23472375
return EasyCoder_Browser.FIELDSET;
23482376
case `file`:
23492377
return EasyCoder_Browser.FILE;
2378+
case `focus`:
2379+
return EasyCoder_Browser.Focus;
23502380
case `form`:
23512381
return EasyCoder_Browser.FORM;
23522382
case `fullscreen`:

resources/doc/browser.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@
219219
"syntax": "request fullscreen [exit]",
220220
"description": "This manages fullscreen mode, where the content of the document occupies the entire screen with now browser element being visible.%0a%0aThis feature allows **_EasyCoder_** to be used for display systems where the whole screen is used, with no title bar or other window furniture visible.%0a%0aNote that if you go into fullscreen mode you may need to provide some means of returning, as the browser Back button will not be visible.",
221221
"examples": "request fullscreen%0arequest fullscreen exit"
222+
},
223+
"focus": {
224+
"syntax": "focus [element]",
225+
"description": "Requests the focus to be applied to the field whose name is given.",
226+
"examples": "focus NameField%0afocus OKButton"
222227
}
223228
},
224229
"values": {

resources/doc/core.json

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,6 @@
242242
"description": "Returns one integer ~m:value~ modulo another, which is to say, the remainder after dividing the former by the latter.",
243243
"examples": "put Count modulo 10 into Count"
244244
},
245-
"the index of": {
246-
"syntax": "the index of",
247-
"description": "The (numeric) value of the current index of a named array variable. This is the value set by ~l:index!index {variable} to ...~.",
248-
"examples": "put the index of Button into Index"
249-
},
250245
"property": {
251246
"syntax": "property {name} of {JSON string}",
252247
"description": "~m:property~ is used to access an item in a JSON structure. In _**EasyCoder**_, JSON objects are ~dq~stringified~dq~ and kept in plain text variables. When you request a ~m:property~ from such an object it is first parsed then the requested property is extracted for you. See also ~l:element~ and ~l:set|k!set property~.",
@@ -278,8 +273,8 @@
278273
"examples": "put tan X radius R into Length"
279274
},
280275
"left": {
281-
"syntax": "left {count} of {Text}",
282-
"description": "returns the leftmost ~m:{count}~ characters of ~m:{Text}~.%0a",
276+
"syntax": "left {count} of {text}",
277+
"description": "returns the leftmost ~m:{count}~ characters of ~m:{text}~.%0a",
283278
"examples": "put left 5 of Text into Prefix"
284279
},
285280
"right": {
@@ -293,9 +288,9 @@
293288
"examples": "put from 8 of Sentence into Phrase%0aput from X to Y of `the quick brown fox` into Extract"
294289
},
295290
"position": {
296-
"syntax": "the position of [the last] {needle} in {haystack}",
297-
"description": "returns the position in ~m:{haystack}~ of either the first or the last occurrence of ~m:{needle}~, where both ~m:{needle}~ and ~m:{haystack}~ are text values.%0a%0aIf ~m:{needle}~ is not contained in ~m:{haystack}~ the value ~m:-1~ is returned.%0a",
298-
"examples": "put the position of `fox` in `The quick brown fox jumps over the lazy dog` into Pos (Pos=16)%0aput the position of the last `dot` in `dot dot dot` into P (P=8)"
291+
"syntax": "the position [nocase] of [the last] {needle} in {haystack}",
292+
"description": "returns the position in ~m:{haystack}~ of either the first or the last occurrence of ~m:{needle}~, where both ~m:{needle}~ and ~m:{haystack}~ are text values.%0a%0aIf ~m:{needle}~ is not contained in ~m:{haystack}~ the value ~m:-1~ is returned.%0a%0aIf the optional ~m:nocase~ is given the match is done with case ignored.%0a",
293+
"examples": "put the position of `fox` in `The quick brown fox jumps over the lazy dog` into Pos (Pos=16)%0aput the position nocase of the last `dot` in `Dot dot Dot` into P (P=8)"
299294
},
300295
"decode": {
301296
"syntax": "decode {variable}",
@@ -345,6 +340,26 @@
345340
"syntax": "date {value}",
346341
"description": "Returns the timestamp of a given date - the number of seconds since the epoch (January 1, 1970).%0a%0aThe value returned will depend on the format given. The first example above returns 1561420800000, which is the UTC value for the date given, but the second and third return values for the local timezone. The last one returns GMT (which is the same as UTC).%0a%0aSee also ~l:today~, ~l:now~ and ~l:format~.",
347342
"examples": "put date `2019-06-25` into TheDate%0aput date `2019-06-25 00:00:00` into TheDate%0aput date `Tuesday June 25 2019` into TheDate%0aput date `Tuesday June 25 2019 GMT` into TheDate"
343+
},
344+
"char[acter]": {
345+
"syntax": "char[acter] {index} of {value}",
346+
"description": "Extracts a single character from a string. Both ~m:index~ and ~m:value~ can be either symbols or values.",
347+
"examples": "put char N of Text into C%0aprint character 5 of ~dq~helpful~dq~ --> ~dq~u~dq~"
348+
},
349+
"split": {
350+
"syntax": "split {value} on {value} giving/into {variable}",
351+
"description": "Splits a value into an array of parts on the given separator. If no separator is given the separator is set to a newline.%0a%0aThe result is an array variable.",
352+
"examples": "split Text into Lines%0asplit CSV on `,` giving Items%0asplit `1,2,3,4,5` on Comma into Numbers"
353+
},
354+
"index of": {
355+
"syntax": "the index of",
356+
"description": "The (numeric) value of the current index of a named array variable. This is the value set by ~l:index!index {variable} to ...~.",
357+
"examples": "put the index of Button into Index"
358+
},
359+
"length of": {
360+
"syntax": "length of {value}",
361+
"description": "Measures a text variable.",
362+
"examples": "put the length of Name into Length"
348363
}
349364
},
350365
"conditions": {
@@ -354,9 +369,9 @@
354369
"examples": "if EditorModule is not running goto StartEditor"
355370
},
356371
"numeric": {
357-
"syntax": "numeric",
372+
"syntax": "[not] numeric",
358373
"description": "Tests if a value is numeric",
359-
"examples": "if TheValue is numeric ..."
374+
"examples": "if TheValue is numeric ...%0aif char N of Value is not numeric ..."
360375
},
361376
"even": {
362377
"syntax": "even",

resources/doc/json.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,14 @@
3030
"description": "This renames a property in a JSON object.",
3131
"examples": "json rename `mail` to `email` in Details"
3232
},
33-
"rest get": {
34-
"syntax": "rest get {variable} from {endpoint} [or ...]",
35-
"description": "This issues a REST GET request to the named ~m:endpoint~, giving it the ~l:variable|k|core~ to receive the contents of the request. If there is an error and the ~m:or~ clause has been provided this will be executed, allowing you to take appropriate actions, otherwise the error will be unrecoverable and the program will stop. See also ~l:rest post~.%0a%0aThe REST server comes with a selection of useful endpoints but in many cases you will need to add new ones for the tables you add to the database. The server has an extension mechanism; you will find a file called ~m:rest-local.php~ in the top-level ~m:resources~ folder of your WordPress installation. Use this to add functionality; don~sq~t alter the main REST server as it will be overwritten in a future update to _**EasyCoder**_.",
36-
"examples": "rest get Record from `_/ec_users/25 or%0abegin%0a  alert `Couldn~sq~t retrieve data`%0a  stop%0aend"
37-
},
38-
"rest post": {
39-
"syntax": "rest post [{value}] to {endpoint} [giving {variable}] [or ...]",
40-
"description": "This issues a REST POST request to the named ~m:endpoint~, giving it the ~m:value~ as a JSON string. You can optionally collect the response from the server by using ~m:giving~. If there is an error and the ~m:or~ clause has been provided this will be executed, allowing you to take appropriate actions, otherwise the error will be unrecoverable and the program will stop. See also ~l:rest get~.%0a%0aIf the request is entirely contained in the URL you can omit the ~m:{value}~.%0a%0aThe REST server comes with a selection of useful endpoints and you can add new ones for extra tables you add to the database. The server has an extension mechanism; you will find a file called ~m:rest-local.php~ in the top-level ~m:resources~ folder of your WordPress installation. Use this to add functionality; don~sq~t alter the main REST server as it will be overwritten in future updates to _**EasyCoder**_.",
41-
"examples": "rest post MyData to `_/ec_markers` giving Response%0aor begin%0a  alert the error%0a  step%0aend%0arest post to `_/ec_test/dummy`"
42-
},
4333
"json sort": {
4434
"syntax": "json sort {list}",
4535
"description": "Sorts the contents of a list into ascending alphabetical order.",
4636
"examples": "json sort MyList"
4737
},
4838
"json split": {
4939
"syntax": "json split {item} [on {separator}] into {variable}",
50-
"description": "Splits a variable into an array of parts on the given separator. If no separator is given the separator is set to a newline (\n).",
40+
"description": "Splits a variable into an array of parts on the given separator. If no separator is given the separator is set to a newline (%0a).",
5141
"examples": "json split Paragraph into Lines%0ajson split Text on `~` into Tokens"
5242
}
5343
},

resources/doc/rest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"rest get": {
44
"syntax": "rest get {variable} from {endpoint} [or ...]",
55
"description": "This issues a REST GET request to the named ~m:endpoint~, giving it the ~l:variable|k|core~ to receive the contents of the request. If there is an error and the ~m:or~ clause has been provided this will be executed, allowing you to take appropriate actions, otherwise the error will be unrecoverable and the program will stop. See also ~l:rest post~.%0a%0aThe REST server comes with a selection of useful endpoints but in many cases you will need to add new ones for the tables you add to the database. The server has an extension mechanism; you will find a file called ~m:rest-local.php~ in the top-level ~m:resources~ folder of your WordPress installation. Use this to add functionality; don~sq~t alter the main REST server as it will be overwritten in a future update to _**EasyCoder**_.",
6-
"examples": "rest get Record from `/resources/users/25 or%0abegin%0a  alert `Couldn~sq~t retrieve data`%0a  stop%0aend"
6+
"examples": "rest get Record from `_/ec_users/25 or%0abegin%0a  alert `Couldn~sq~t retrieve data`%0a  stop%0aend"
77
},
88
"rest post": {
99
"syntax": "rest post [{value}] to {endpoint} [giving {variable}] [or ...]",

0 commit comments

Comments
 (0)