| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1105,6 +1105,10 @@ | |||
| 1105 | 1105 | "alias": "vb", | |
| 1106 | 1106 | "owner": "Golmote" | |
| 1107 | 1107 | }, | |
| 1108 | + "warpscript": { | ||
| 1109 | + "title": "WarpScript", | ||
| 1110 | + "owner": "RunDevelopment" | ||
| 1111 | + }, | ||
| 1108 | 1112 | "wasm": { | |
| 1109 | 1113 | "title": "WebAssembly", | |
| 1110 | 1114 | "owner": "Golmote" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,21 @@ | |||
| 1 | + Prism.languages.warpscript = { | ||
| 2 | + 'comment': /#.*|\/\/.*|\/\*[\s\S]*?\*\//, | ||
| 3 | + 'string': { | ||
| 4 | + pattern: /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'|<'(?:[^\\']|'(?!>)|\\.)*'>/, | ||
| 5 | + greedy: true | ||
| 6 | + }, | ||
| 7 | + 'variable': /\$\S+/, | ||
| 8 | + 'macro': { | ||
| 9 | + pattern: /@\S+/, | ||
| 10 | + alias: 'property' | ||
| 11 | + }, | ||
| 12 | + // WarpScript doesn't have any keywords, these are all functions under the control category | ||
| 13 | + // https://www.warp10.io/tags/control | ||
| 14 | + 'keyword': /\b(?:BREAK|CHECKMACRO|CONTINUE|CUDF|DEFINED|DEFINEDMACRO|EVAL|FAIL|FOR|FOREACH|FORSTEP|IFT|IFTE|MSGFAIL|NRETURN|RETHROW|RETURN|SWITCH|TRY|UDF|UNTIL|WHILE)\b/, | ||
| 15 | + 'number': /[+-]?\b(?:NaN|Infinity|\d+(?:\.\d*)?(?:[Ee][+-]?\d+)?|0x[\da-fA-F]+|0b[01]+)\b/, | ||
| 16 | + 'boolean': /\b(?:false|true|F|T)\b/, | ||
| 17 | + 'punctuation': /<%|%>|[{}[\]()]/, | ||
| 18 | + // Some operators from the "operators" category | ||
| 19 | + // https://www.warp10.io/tags/operators | ||
| 20 | + 'operator': /==|&&?|\|\|?|\*\*?|>>>?|<<|==|[<>!~]=?|[-/%^]|\+!?|\b(?:AND|NOT|OR)\b/ | ||
| 21 | + }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,22 @@ | |||
| 1 | + <h2>Full example</h2> | ||
| 2 | + <pre><code>// Source: https://www.warp10.io/content/04_Tutorials/01_WarpScript/05_Best_Practices | ||
| 3 | + | ||
| 4 | + //factorial macro. take a number on the stack, push its factorial | ||
| 5 | + <% | ||
| 6 | + 'input' STORE | ||
| 7 | + 1 | ||
| 8 | + 1 $input <% * %> FOR | ||
| 9 | + %> 'factorial' STORE | ||
| 10 | + | ||
| 11 | + //build a map with key from 1 to 10 and value = key! | ||
| 12 | + {} 'result' STORE | ||
| 13 | + | ||
| 14 | + 1 10 | ||
| 15 | + <% | ||
| 16 | + 'key' STORE | ||
| 17 | + $result $key @factorial $key PUT | ||
| 18 | + DROP //remove the map let by PUT | ||
| 19 | + %> FOR | ||
| 20 | + | ||
| 21 | + //push the result on the stack | ||
| 22 | + $result</code></pre> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,17 @@ | |||
| 1 | + false | ||
| 2 | + true | ||
| 3 | + F | ||
| 4 | + T | ||
| 5 | + | ||
| 6 | + ---------------------------------------------------- | ||
| 7 | + | ||
| 8 | + [ | ||
| 9 | + ["boolean", "false"], | ||
| 10 | + ["boolean", "true"], | ||
| 11 | + ["boolean", "F"], | ||
| 12 | + ["boolean", "T"] | ||
| 13 | + ] | ||
| 14 | + | ||
| 15 | + ---------------------------------------------------- | ||
| 16 | + | ||
| 17 | + Checks for booleans. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,19 @@ | |||
| 1 | + # Python style comments, starting with a '#' and extending to the end of the line | ||
| 2 | + | ||
| 3 | + // Java style comments, extending to the end of the line after the '//' | ||
| 4 | + | ||
| 5 | + /* | ||
| 6 | + C style block comments, possibly spanning multiple lines | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | + ---------------------------------------------------- | ||
| 10 | + | ||
| 11 | + [ | ||
| 12 | + ["comment", "# Python style comments, starting with a '#' and extending to the end of the line"], | ||
| 13 | + ["comment", "// Java style comments, extending to the end of the line after the '//'"], | ||
| 14 | + ["comment", "/*\r\n C style block comments, possibly spanning multiple lines\r\n*/"] | ||
| 15 | + ] | ||
| 16 | + | ||
| 17 | + ---------------------------------------------------- | ||
| 18 | + | ||
| 19 | + Checks for comments. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,35 @@ | |||
| 1 | + 123 | ||
| 2 | + -123 | ||
| 3 | + 5e4 | ||
| 4 | + 5e-4 | ||
| 5 | + 123.546 | ||
| 6 | + 123.546E-5 | ||
| 7 | + | ||
| 8 | + 0xFFF | ||
| 9 | + 0b10101 | ||
| 10 | + | ||
| 11 | + NaN | ||
| 12 | + Infinity | ||
| 13 | + -Infinity | ||
| 14 | + | ||
| 15 | + ---------------------------------------------------- | ||
| 16 | + | ||
| 17 | + [ | ||
| 18 | + ["number", "123"], | ||
| 19 | + ["number", "-123"], | ||
| 20 | + ["number", "5e4"], | ||
| 21 | + ["number", "5e-4"], | ||
| 22 | + ["number", "123.546"], | ||
| 23 | + ["number", "123.546E-5"], | ||
| 24 | + | ||
| 25 | + ["number", "0xFFF"], | ||
| 26 | + ["number", "0b10101"], | ||
| 27 | + | ||
| 28 | + ["number", "NaN"], | ||
| 29 | + ["number", "Infinity"], | ||
| 30 | + ["number", "-Infinity"] | ||
| 31 | + ] | ||
| 32 | + | ||
| 33 | + ---------------------------------------------------- | ||
| 34 | + | ||
| 35 | + Checks for numbers. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,45 @@ | |||
| 1 | + != < > ~= <= == >= | ||
| 2 | + % * + - / ** | ||
| 3 | + ! && AND OR NOT || | ||
| 4 | + & ^ | >>> ~ << >> | ||
| 5 | + +! | ||
| 6 | + | ||
| 7 | + ---------------------------------------------------- | ||
| 8 | + | ||
| 9 | + [ | ||
| 10 | + ["operator", "!="], | ||
| 11 | + ["operator", "<"], | ||
| 12 | + ["operator", ">"], | ||
| 13 | + ["operator", "~="], | ||
| 14 | + ["operator", "<="], | ||
| 15 | + ["operator", "=="], | ||
| 16 | + ["operator", ">="], | ||
| 17 | + | ||
| 18 | + ["operator", "%"], | ||
| 19 | + ["operator", "*"], | ||
| 20 | + ["operator", "+"], | ||
| 21 | + ["operator", "-"], | ||
| 22 | + ["operator", "/"], | ||
| 23 | + ["operator", "**"], | ||
| 24 | + | ||
| 25 | + ["operator", "!"], | ||
| 26 | + ["operator", "&&"], | ||
| 27 | + ["operator", "AND"], | ||
| 28 | + ["operator", "OR"], | ||
| 29 | + ["operator", "NOT"], | ||
| 30 | + ["operator", "||"], | ||
| 31 | + | ||
| 32 | + ["operator", "&"], | ||
| 33 | + ["operator", "^"], | ||
| 34 | + ["operator", "|"], | ||
| 35 | + ["operator", ">>>"], | ||
| 36 | + ["operator", "~"], | ||
| 37 | + ["operator", "<<"], | ||
| 38 | + ["operator", ">>"], | ||
| 39 | + | ||
| 40 | + ["operator", "+!"] | ||
| 41 | + ] | ||
| 42 | + | ||
| 43 | + ---------------------------------------------------- | ||
| 44 | + | ||
| 45 | + Checks for operators. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,19 @@ | |||
| 1 | + <% %> | ||
| 2 | + ( ) [ ] { } | ||
| 3 | + | ||
| 4 | + ---------------------------------------------------- | ||
| 5 | + | ||
| 6 | + [ | ||
| 7 | + ["punctuation", "<%"], | ||
| 8 | + ["punctuation", "%>"], | ||
| 9 | + ["punctuation", "("], | ||
| 10 | + ["punctuation", ")"], | ||
| 11 | + ["punctuation", "["], | ||
| 12 | + ["punctuation", "]"], | ||
| 13 | + ["punctuation", "{"], | ||
| 14 | + ["punctuation", "}"] | ||
| 15 | + ] | ||
| 16 | + | ||
| 17 | + ---------------------------------------------------- | ||
| 18 | + | ||
| 19 | + Checks for punctuation. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments