diff --git a/client/package.json b/client/package.json index 3e525ec..87cad1b 100644 --- a/client/package.json +++ b/client/package.json @@ -2,7 +2,7 @@ "name": "speech2code.client", "displayName": "Speech2Code", "productName": "speech2code", - "version": "0.0.1-alpha.2", + "version": "0.0.1-alpha.3", "description": "Speech2Code main app - Enables you to code using just your voice", "author": { "email": "pedro42augusto@gmail.com", diff --git a/client/src/editors/vscode/prerequisites.ts b/client/src/editors/vscode/prerequisites.ts index bb31321..14da76b 100644 --- a/client/src/editors/vscode/prerequisites.ts +++ b/client/src/editors/vscode/prerequisites.ts @@ -2,10 +2,10 @@ import { dialog } from 'electron' import crossSpawn from 'cross-spawn' import path from 'path' import fs from 'fs' -import { isDev } from '../../utils' +import { isDev, appVersion } from '../../utils' const APP_NAME = 'speech2code' -const VSCODE_EXT_ID = 'pedroaugusto.speech2code' +const VSCODE_EXT_ID = 'pedroaugusto.speech2code@' + appVersion export function check() { // Does this machine has Visual Studio Code installed ? @@ -46,7 +46,7 @@ function checkVSCodeIsInstalled() { } function checkIfVSCodeExtensionIsAlreadyInstalled() { - const response = crossSpawn.sync('code', ['--list-extensions']) + const response = crossSpawn.sync('code', ['--list-extensions', '--show-versions']) if (response.error || response.stderr.toString() !== '') { const err = response.stderr.toString() diff --git a/client/src/resources/speech2code-0.0.1-alpha.2.vsix b/client/src/resources/speech2code-0.0.1-alpha.3.vsix similarity index 98% rename from client/src/resources/speech2code-0.0.1-alpha.2.vsix rename to client/src/resources/speech2code-0.0.1-alpha.3.vsix index 827d684..a8bd7aa 100644 Binary files a/client/src/resources/speech2code-0.0.1-alpha.2.vsix and b/client/src/resources/speech2code-0.0.1-alpha.3.vsix differ diff --git a/server/package.json b/server/package.json index d1c9899..1aba03a 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "speech2code.server", - "version": "0.0.1-alpha.2", + "version": "0.0.1-alpha.3", "description": "Speech to Code NodeJS server", "main": "src/app.js", "scripts": { diff --git a/spoken-vscode-driver/package.json b/spoken-vscode-driver/package.json index e3a5bcb..4b20c48 100644 --- a/spoken-vscode-driver/package.json +++ b/spoken-vscode-driver/package.json @@ -8,7 +8,7 @@ "email": "pedro42augusto@gmail.com", "url": "https://github.com/pedrooaugusto" }, - "version": "0.0.1-alpha.2", + "version": "0.0.1-alpha.3", "icon": "icon.png", "license": "MIT", "repository": { @@ -58,4 +58,4 @@ "dependencies": { "node-ipc": "^9.1.4" } -} +} \ No newline at end of file diff --git a/spoken-vscode-driver/speech2code-0.0.1-alpha.2.vsix b/spoken-vscode-driver/speech2code-0.0.1-alpha.3.vsix similarity index 98% rename from spoken-vscode-driver/speech2code-0.0.1-alpha.2.vsix rename to spoken-vscode-driver/speech2code-0.0.1-alpha.3.vsix index 827d684..a8bd7aa 100644 Binary files a/spoken-vscode-driver/speech2code-0.0.1-alpha.2.vsix and b/spoken-vscode-driver/speech2code-0.0.1-alpha.3.vsix differ diff --git a/spoken/package.json b/spoken/package.json index fa260ef..5ec3abf 100644 --- a/spoken/package.json +++ b/spoken/package.json @@ -1,6 +1,6 @@ { "name": "speech2code.spoken", - "version": "0.0.1-alpha.2", + "version": "0.0.1-alpha.3", "description": "Transforming natural language in code", "main": "dist/index.js", "scripts": { diff --git a/webapp/package.json b/webapp/package.json index d5f3e9c..751a709 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -1,7 +1,7 @@ { "name": "speech2code.webapp", "description": "The webapp react implementation of the speech2code frontend", - "version": "0.0.1-alpha.2", + "version": "0.0.1-alpha.3", "private": true, "dependencies": { "@testing-library/jest-dom": "^5.11.9", diff --git a/webapp/public/grammar.json b/webapp/public/grammar.json index bf561f1..882e77a 100644 --- a/webapp/public/grammar.json +++ b/webapp/public/grammar.json @@ -1 +1 @@ -{"normalizers":{"ordinalNumber":"function ordinalNumber(lang) {\r\n function OrdinalNumbers(last, tenFirstNumbers) {\r\n return (word, compareStr) => {\r\n if (compareStr(word, last)) return '-1'\r\n if (!Number.isNaN(parseInt(word, 10)))\r\n return parseInt(word, 10).toString()\r\n\r\n const i = tenFirstNumbers.findIndex((a) => compareStr(a, word))\r\n\r\n return i === -1 ? undefined : (i + 1).toString()\r\n }\r\n }\r\n\r\n if (lang === 'pt-BR')\r\n return OrdinalNumbers('último', [\r\n 'primeiro',\r\n 'segundo',\r\n 'terceiro',\r\n 'quarto',\r\n 'quinto',\r\n 'sexto',\r\n 'sétimo',\r\n 'oitavo',\r\n 'nono',\r\n 'décimo',\r\n ])\r\n\r\n return OrdinalNumbers('last', [\r\n 'first',\r\n 'second',\r\n 'third',\r\n 'fourth',\r\n 'fifth',\r\n 'sixth',\r\n 'seventh',\r\n 'eighth',\r\n 'ninth',\r\n 'tenth',\r\n ])\r\n }","boolean":"function boolean(lang) {\r\n return function(word, compareStr) {\r\n return word != undefined ? true : false\r\n }\r\n }","identity":"function identity(lang) {\r\n return function(word, compareStr) {\r\n return word\r\n }\r\n }","number":"function number(lang) {\r\n return function(word, compareStr) {\r\n const numbers = {\r\n 'pt-BR': ['zero', 'um', 'dois', 'três', 'quatro', 'cinco', 'seis', 'sete', 'oito', 'nove', 'dez'],\r\n 'en-US': ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']\r\n }\r\n\r\n if (!isNaN(parseInt(word))) return parseInt(word).toString()\r\n\r\n const val = numbers[lang].indexOf(word)\r\n\r\n if (val !== -1) return val.toString()\r\n\r\n // for some reason this is valid #42\r\n if (/^(#\\d+)$/.test(word)) return word.substr(1)\r\n\r\n return undefined\r\n }\r\n }","elementarMathOperation":"function elementarMathOperation(lang) {\r\n const enUS = [['plus', '+'], ['times', '*'], ['minus', '-'], ['divided', '/']];\r\n const ptBR = [['mais', '+'], ['vezes', '*'], ['menos', '-'], ['dividido', '/']];\r\n const langs = {\r\n 'en-US': enUS,\r\n 'pt-BR': ptBR\r\n };\r\n return (word, compareStr) => {\r\n const op = langs[lang].find(([name]) => compareStr(name, word)) || [];\r\n return op[1];\r\n };\r\n }"},"templates":{"{any}":{"value":"(.*)","examples":{"pt-BR":["quem é você","isto é um teste"],"en-US":["who are you","the universe is cracked"]}},"{term}":{"value":"^(?![\\* ]$).*","examples":{"pt-BR":["valor","lista","numero","texto","temp","a"],"en-US":["value","graph","number","text","temp","a"]}},"{ordinalNumber}":{"value":"(\\S+)","examples":{"pt-BR":["1ª","42ª","último","primeiro","sétimo"],"en-US":["1ª","42ª","last","first","fourth"]}},"{numeral}":{"value":"(\\d+)","examples":{"pt-BR":["1","42"],"en-US":["1","42"]}},"{number}":{"value":"^(?![\\* ]$).*","examples":{"pt-BR":["1","42"],"en-US":["1","42"]},"defaultNormalizer":"number"},"{char}":{"value":"(.)","examples":{"pt-BR":["a","B","A","z"],"en-US":["g","K","M"]}},"@anything":{"value":"","examples":{"pt-BR":["gap"],"en-US":["gap"]}}},"stopWords":{"en-US":{"words":["a -> P1 != (letter|symbol|word)","the","with","you","can","please","from -> S != (to)","to -> S != (from)","of","it","its","it's","is","are","was","were","in"],"expressions":[]},"pt-BR":{"words":["a -> P1 != (letra|símbolo|palavra)","o -> P1 != (letra|símbolo|palavra)","você","com","pode","na","do -> S != (até)","de -> S != (até)","da -> S != (até)","dos","das","as","os","para","é","era","estava","como","uma","vá"],"expressions":["por favor"]}},"modules":[{"id":"typescript","grammar":{"en-US":[{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(conditional)"}},{"v":"1","w":"2","value":{"label":"(statement)"}},{"v":"2","w":"3","value":{"label":"(if)"}},{"v":"3","w":"4","value":{"label":"(else)","store":"otherwise","normalizer":"boolean"}},{"v":"2","w":"5","value":{"label":"([expressions])","store":"condition"}},{"v":"3","w":"5","value":{"label":"([expressions])","store":"condition"}},{"v":"4","w":"5","value":{"label":"([expressions])","store":"condition"}}],"value":{"id":"condition","label":"Condition Statement","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Creates a if/else statement","desc":"Creates a if/else statement with the provided expression as condition","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Condition(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"Condition.\"');\r\n const anything = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang][0];\r\n let { condition = anything, otherwise = false } = command;\r\n condition = typeof condition === 'string' ? condition : condition === null || condition === void 0 ? void 0 : condition.value;\r\n let text = `if(${condition}) {\\n\\n}${otherwise ? ' else {\\n\\n}' : ''}`;\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n await editor.indentSelection([line._line - 3, 0], [line._line + (otherwise ? 8 : 3), 0]);\r\n await editor.goToLine(line._line);\r\n return null;\r\n}\r\nexports.default = Condition;\r\n","phrases":["conditional statement","conditional statement if else","conditional statement if else [expressions]","conditional statement if [expressions]","conditional statement [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"circle"},"parent":"sg3"},{"v":"8","value":{"shape":"circle"}},{"v":"10","value":{"shape":"doublecircle"}},{"v":"11","value":{"shape":"circle"}},{"v":"12","value":{"shape":"doublecircle"}},{"v":"13","value":{"shape":"circle"}},{"v":"sg3","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(cursor, pointer)"}},{"v":"1","w":"2","value":{"label":"(line)"}},{"v":"2","w":"3","value":{"label":"({number})","store":"line"}},{"v":"1","w":"5","value":{"label":"(symbol, letter)"}},{"v":"7","w":"5","value":{"label":"(symbol, letter)"}},{"v":"1","w":"7","value":{"label":"({ordinalNumber})","store":"leapSize","normalizer":"ordinalNumber"}},{"v":"5","w":"6","value":{"label":"({char})","store":"symbol"}},{"v":"1","w":"8","value":{"label":"(begin, end)","store":"linePosition"}},{"v":"8","w":"10","value":{"label":"(line)"}},{"v":"1","w":"11","value":{"label":"(next)"}},{"v":"11","w":"13","value":{"label":"({number})","store":"leapSize"}},{"v":"11","w":"12","value":{"label":"(symbol)"}},{"v":"13","w":"12","value":{"label":"(symbol)"}}],"value":{"id":"cursor","label":"Move cursor","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Move cursor","desc":"Moves the cursor to a different line or token","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function cursor(args, editor, context) {\r\n console.log('[Spoken]: Executing: \"cursor.\"');\r\n if (args.linePosition != null) {\r\n const pos = args.linePosition === LinePostionEnum.BEGIN ? 'BEGIN_LINE' : 'END_LINE';\r\n return await editor.moveCursorTo(pos);\r\n }\r\n else if (args.line) {\r\n return await editor.goToLine(args.line);\r\n }\r\n else if (!args.symbol) {\r\n const nth = parseInt(args.leapSize || '1', 10);\r\n return await editor.moveCursorTo(null, undefined, nth);\r\n }\r\n else {\r\n if (args.leapSize == undefined)\r\n args.leapSize = '1';\r\n const nth = parseInt(args.leapSize || '1', 10);\r\n return await editor.moveCursorTo('SYMBOL', args.symbol, nth);\r\n }\r\n return await editor.moveCursorTo('BEGIN_LINE');\r\n}\r\nvar LinePostionEnum;\r\n(function (LinePostionEnum) {\r\n LinePostionEnum[LinePostionEnum[\"BEGIN\"] = 0] = \"BEGIN\";\r\n LinePostionEnum[LinePostionEnum[\"END\"] = 1] = \"END\";\r\n})(LinePostionEnum || (LinePostionEnum = {}));\r\nexports.default = cursor;\r\n","phrases":["cursor line 42","cursor symbol K","pointer 1ª symbol g","pointer end line","pointer next symbol","cursor next 42 symbol"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(expression)"}},{"v":"1","w":"2","value":{"label":"([expressions])","store":"left"}},{"v":"2","w":"3","value":{"label":"([math_operator], [logical_operator])","store":"operation"}},{"v":"4","w":"3","value":{"label":"([math_operator], [logical_operator])","store":"operation"}},{"v":"3","w":"4","value":{"label":"([expressions])","store":"right"}}],"value":{"id":"elementar_math_op","label":"Elementar Math Operation","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","disableStopWords":"true","priority":"2","title":"Writes a elementar math operation","desc":"Writes a elementar math operation (*, -, +, /)","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function WriteElementarMathOperation(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"WriteElementarMathOperation\"');\r\n let operation = toArray(command.operation);\r\n let right = toArray(command.right);\r\n let text = toValue(command.left);\r\n for (let i = 0; i < right.length; i++) {\r\n if (operation[i].isNegative) {\r\n if (operation[i].operator === '===')\r\n text += ' !== ' + toValue(right[i]);\r\n else\r\n text = '!(' + text + ' ' + operation[i].operator + ' ' + toValue(right[i]) + ')';\r\n }\r\n else {\r\n text += ' ' + operation[i].operator + ' ' + toValue(right[i]);\r\n }\r\n }\r\n if (command.parent)\r\n return text;\r\n await editor.write(text);\r\n const wildcard = [command.left, ...right].find(item => typeof item !== 'string');\r\n if (wildcard) {\r\n const pos = await editor.findPositionOf(wildcard.value);\r\n if (pos.length) {\r\n return await editor.select(pos[0][0], pos[0][1] - 1, false);\r\n }\r\n }\r\n return undefined;\r\n}\r\nconst toArray = (arg) => Array.isArray(arg) ? arg : [arg];\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nexports.default = WriteElementarMathOperation;\r\n","phrases":["expression [expressions] [logical_operator] [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"doublecircle"}},{"v":"2","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"([number], [string], [variable_reference], [elementar_math_op], [function_call])","store":"expression"}},{"v":"0","w":"2","value":{"label":"(gap)","store":"wildCard","normalizer":"identity"}}],"value":{"id":"expressions","label":"Writes a expression","lang":"en-US","langName":"English","pad":"0.2","nodesep":"1","ranksep":"2","rankdir":"LR","alias":"true","title":"Writes a expression","desc":"Writes a expression in the editor, this is meant to be used inside another automatas","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Expression(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"Expression\"');\r\n const { expression, parent, wildCard } = command;\r\n if (parent) {\r\n return expression ? expression : { value: wildCard, isWildCard: true };\r\n }\r\n return await editor.write(expression || wildCard);\r\n}\r\nexports.default = Expression;\r\n","phrases":["[elementar_math_op]","gap"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"doublecircle"}},{"v":"8","value":{"shape":"circle"}},{"v":"9","value":{"shape":"circle"}},{"v":"10","value":{"shape":"doublecircle"}},{"v":"11","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(call, execute)"}},{"v":"1","w":"2","value":{"label":"(function)"}},{"v":"2","w":"3","value":{"label":"([multi_word_token])","store":"functionName","extraArgs":"{\"case\": \"camel\"}"}},{"v":"3","w":"4","value":{"label":"(λ)"}},{"v":"2","w":"4","value":{"label":"({term})","store":"functionName"}},{"v":"4","w":"11","value":{"label":"(of, on, at)","disableSpellcheck":"true"}},{"v":"4","w":"5","value":{"label":"([expressions])","store":"caller"}},{"v":"11","w":"5","value":{"label":"([expressions])","store":"caller"}},{"v":"4","w":"6","value":{"label":"(arguments)"}},{"v":"5","w":"6","value":{"label":"(arguments)"}},{"v":"6","w":"7","value":{"label":"([expressions])","store":"args"}},{"v":"7","w":"8","value":{"label":"(and)"}},{"v":"8","w":"7","value":{"label":"([expressions])","store":"args"}},{"v":"4","w":"9","value":{"label":"({number})","store":"argsNumber"}},{"v":"5","w":"9","value":{"label":"({number})","store":"argsNumber"}},{"v":"9","w":"10","value":{"label":"(arguments)"}}],"value":{"id":"function_call","label":"Calls a function","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","priority":"2","title":"Calls a function","desc":"Calls a function with the specified arguments in the desired caller","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function FunctionCall(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"FunctionCall\"');\r\n const anything = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang];\r\n const functionName = join(command.functionName);\r\n const argsNumber = command.argsNumber ? parseInt(command.argsNumber, 10) : command.oneArg ? 1 : NaN;\r\n const args = command.args ? toArray(command.args) : [];\r\n const caller = command.caller ? toValue(command.caller) : null;\r\n let text = functionName + '(';\r\n if (argsNumber) {\r\n text += new Array(argsNumber).fill(anything).join(', ');\r\n }\r\n else if (args.length) {\r\n text += (args.map(item => typeof item === 'string' ? item : anything).join(', '));\r\n }\r\n text += ')';\r\n if (caller)\r\n text = caller + '.' + text;\r\n if (command.parent)\r\n return text;\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n return await editor.indentSelection([line._line - 1, 0], [line._line - 1, line.character]);\r\n}\r\nconst toArray = (arg) => Array.isArray(arg) ? arg : [arg];\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nconst join = (item) => typeof item === 'string' ? item : item.join('');\r\nexports.default = FunctionCall;\r\n","phrases":["call function [multi_word_token]","call function temp","execute function [multi_word_token] [expressions]","call function [multi_word_token] at [expressions]","call function a [expressions]","call function a at [expressions]","call function [multi_word_token] [expressions] arguments [expressions]","execute function [multi_word_token] arguments [expressions]","call function [multi_word_token] at [expressions] arguments [expressions]","call function text [expressions] arguments [expressions]","execute function text arguments [expressions]","execute function text on [expressions] arguments [expressions]","execute function [multi_word_token] [expressions] 42 arguments","call function [multi_word_token] 1 arguments","execute function [multi_word_token] of [expressions] 42 arguments","call function a [expressions] 42 arguments"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(new, create, declare)"}},{"v":"1","w":"2","value":{"label":"(function)"}},{"v":"2","w":"3","value":{"label":"({term})","store":"fnName"}},{"v":"3","w":"4","value":{"label":"({number})","store":"argsNumber"}},{"v":"4","w":"5","value":{"label":"(arguments)"}},{"v":"3","w":"6","value":{"label":"(return, returning)"}},{"v":"5","w":"6","value":{"label":"(return, returning)"}},{"v":"6","w":"7","value":{"label":"([expressions])","store":"returnValue"}}],"value":{"id":"function_declaration","label":"Creates a function","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","priority":"2","title":"Creates a function","desc":"Creates a function with the desired number of args and return value","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function FunctionDeclaration(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"FunctionDeclaration\"');\r\n const anything = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang];\r\n let { fnName, argsNumber, returnValue } = command;\r\n argsNumber = argsNumber != null ? parseInt(argsNumber, 10) : 0;\r\n let text = `function ${fnName}(`;\r\n if (argsNumber > 0) {\r\n text += new Array(argsNumber).fill(anything).join(', ');\r\n }\r\n text += ') {\\n';\r\n if (returnValue != null) {\r\n text += 'return ' + toValue(returnValue);\r\n }\r\n text += '\\n}';\r\n if (command.parent)\r\n return text;\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n await editor.indentSelection([line._line - 3, 0], [line._line + 3, 0]);\r\n return await editor.goToLine(line._line);\r\n}\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nexports.default = FunctionDeclaration;\r\n","phrases":["declare function text","declare function graph 1 arguments","new function text 42 arguments return [expressions]","declare function temp return [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(go)"}},{"v":"1","w":"2","value":{"label":"(to)"}},{"v":"0","w":"3","value":{"label":"(line)"}},{"v":"1","w":"3","value":{"label":"(line)"}},{"v":"2","w":"3","value":{"label":"(line)"}},{"v":"3","w":"5","value":{"label":"(number)"}},{"v":"3","w":"4","value":{"label":"({number})","store":"line"}},{"v":"5","w":"4","value":{"label":"({number})","store":"line"}}],"value":{"id":"go_to_line","label":"Change line","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Change line","desc":"Moves the cursor to a different line","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function goToLine(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"goToLine.\"');\r\n return await editor.goToLine(command.line);\r\n}\r\nexports.default = goToLine;\r\n","phrases":["go to line 1","go to line number 1","go line 1","go line number 1","line 1","line number 1"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"},"parent":"sg21"},{"v":"1","value":{"shape":"doublecircle"}},{"v":"2","value":{"shape":"circle"},"parent":"sg21"},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"circle"}},{"v":"7","value":{"shape":"doublecircle"}},{"v":"sg21","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(and, or, equals)","store":"logicalOperator"}},{"v":"2","w":"1","value":{"label":"(and, or, equals)","store":"logicalOperator"}},{"v":"0","w":"2","value":{"label":"(not, negative)","store":"isNegative","normalizer":"boolean"}},{"v":"0","w":"3","value":{"label":"(less, greater)","store":"inequalityOperator"}},{"v":"2","w":"3","value":{"label":"(less, greater)","store":"inequalityOperator"}},{"v":"3","w":"4","value":{"label":"(or, λ)"}},{"v":"4","w":"5","value":{"label":"(equals)","store":"orEqual","normalizer":"boolean"}},{"v":"3","w":"7","value":{"label":"(than)"}},{"v":"5","w":"7","value":{"label":"(than)"}}],"value":{"id":"logical_operator","label":"Writes a logical operator","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","alias":"true","title":"Writes a logical operator","desc":"Writes a logical operator (===, !==, &&, ||, >, <, >=, <=) meant to be used inside expressions","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function LogicalOperator(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"LogicalOperator\"');\r\n const { logicalOperator, isNegative = false, inequalityOperator, orEqual = false } = command;\r\n if (logicalOperator !== undefined) {\r\n const operator = ['&&', '||', '==='][logicalOperator];\r\n return { operator, isNegative };\r\n }\r\n else if (inequalityOperator !== undefined) {\r\n const operator = ['<', '>'][inequalityOperator] + (orEqual ? '=' : '');\r\n return { operator, isNegative };\r\n }\r\n return { operator: 'error', isNegative: false };\r\n}\r\nexports.default = LogicalOperator;\r\n","phrases":["or","not equals","not greater or equals than","negative less than","less equals than","greater than"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(plus, times, minus, divided)","store":"mathOperator"}}],"value":{"id":"math_operator","label":"Writes a math operator","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","alias":"true","title":"Writes a math operator","desc":"Writes a math operator (*, -, +, /) meant to be used inside expressions","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function MathOperator(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"MathOperator\"');\r\n const { mathOperator } = command;\r\n const operator = ['+', '*', '-', '/'][mathOperator] || 'error';\r\n return { operator };\r\n}\r\n// @ts-ignore\r\nexports.default = MathOperator;\r\n","phrases":["divided"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"3","value":{"label":"(*)"}},{"v":"3","w":"3","value":{"label":"({any})","store":"words"}},{"v":"3","w":"4","value":{"label":"(*)"}}],"value":{"id":"multi_word_token","label":"Group multiple words together","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","disableStopWords":"true","title":"Group multiple words together","desc":"Group multiple words together in one variable meant to be used as alias in other commands","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function MultiWordTokens(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"MultiWordTokens\"');\r\n function camelCase(words) {\r\n return words.map((a, i) => i ? a.charAt(0).toUpperCase() + a.slice(1) : a);\r\n }\r\n if (((_a = command.extra) === null || _a === void 0 ? void 0 : _a.case) === 'camel') {\r\n return camelCase(command.words);\r\n }\r\n return command.words;\r\n}\r\nexports.default = MultiWordTokens;\r\n","phrases":["* *"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"},"parent":"sg26"},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"},"parent":"sg28"},{"v":"5","value":{"shape":"circle"},"parent":"sg26"},{"v":"sg26","value":{"shape":"circle"}},{"v":"sg28","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(new)"}},{"v":"5","w":"1","value":{"label":"(new)"}},{"v":"1","w":"2","value":{"label":"(line)"}},{"v":"5","w":"2","value":{"label":"(line)"}},{"v":"2","w":"3","value":{"label":"(above, below)","store":"position"}},{"v":"4","w":"3","value":{"label":"(above, below)","store":"position"}},{"v":"0","w":"4","value":{"label":"(line)"}},{"v":"0","w":"5","value":{"label":"(create)"}},{"v":"5","w":"5","value":{"label":"(a)"}}],"value":{"id":"new_line","label":"New line","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"New line","desc":"Creates a new line above or below the current line","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function newLine(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"new line.\"');\r\n return await editor.newLine(command.position);\r\n}\r\nexports.default = newLine;\r\n","phrases":["new line","create new line","create line","new line above","line below","create new line below","create line above"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"2","value":{"label":"(number)"}},{"v":"2","w":"3","value":{"label":"({number})","store":"number"}},{"v":"0","w":"3","value":{"label":"({number})","store":"number"}}],"value":{"id":"number","label":"Writes a number","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","priority":"2","title":"Writes a number","desc":"Writes a number in the editor","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function WriteNumber(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"WriteNumber\"');\r\n const { number, parent } = command;\r\n if (parent)\r\n return number;\r\n return await editor.write(number);\r\n}\r\nexports.default = WriteNumber;\r\n","phrases":["number 42","42"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"circle"}},{"v":"8","value":{"shape":"doublecircle"}},{"v":"9","value":{"shape":"circle"}},{"v":"10","value":{"shape":"circle"}},{"v":"11","value":{"shape":"circle"}},{"v":"12","value":{"shape":"circle"}},{"v":"13","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(repetition)"}},{"v":"1","w":"2","value":{"label":"(statement)"}},{"v":"2","w":"9","value":{"label":"(for)"}},{"v":"9","w":"10","value":{"label":"(every)"}},{"v":"10","w":"11","value":{"label":"({term})","store":"item"}},{"v":"11","w":"12","value":{"label":"(of, λ)"}},{"v":"12","w":"13","value":{"label":"([expressions])","store":"collection"}},{"v":"2","w":"3","value":{"label":"(from)"}},{"v":"3","w":"4","value":{"label":"([expressions])","store":"from"}},{"v":"4","w":"5","value":{"label":"(to)"}},{"v":"5","w":"6","value":{"label":"([expressions])","store":"to"}},{"v":"6","w":"7","value":{"label":"(step)"}},{"v":"7","w":"8","value":{"label":"([expressions])","store":"step"}}],"value":{"id":"repetition","label":"Repetition Statement","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Creates a for loop statement","desc":"Creates a for loop statement with the provided expressions as parameters","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Repetition(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"Repetition.\"');\r\n const gap = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang][0];\r\n let text = `for(${gap}; ${gap}; ${gap}) {\\n\\n}`;\r\n if (command.from == undefined && command.item == undefined) {\r\n text = `for(${gap}; ${gap}; ${gap}) {\\n\\n}`;\r\n }\r\n else if (command.from != null && command.to != null) {\r\n const from = toValue(command.from);\r\n const to = toValue(command.to);\r\n const step = command.step ? toValue(command.step) : 'i + 1';\r\n text = `for(let i = ${from}; i < ${to}; i = ${step}) {\\n\\n}`;\r\n }\r\n else if (command.item != null && command.collection != null) {\r\n const item = command.item;\r\n const collection = toValue(command.collection);\r\n text = `for(const ${item} of ${collection}) {\\n\\n}`;\r\n }\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n await editor.indentSelection([line._line - 3, 0], [line._line + 3, 0]);\r\n return await editor.goToLine(line._line);\r\n}\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nexports.default = Repetition;\r\n","phrases":["repetition statement","repetition statement from [expressions] to [expressions]","repetition statement from [expressions] to [expressions] step [expressions]","repetition statement for every temp of [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(run)"}},{"v":"1","w":"2","value":{"label":"(current, this)"}},{"v":"2","w":"3","value":{"label":"(file)"}}],"value":{"id":"run","label":"Run file","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Run current file","desc":"Run the current file in the terminal using node","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function run(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"run.\"');\r\n const info = await editor.fileInfo();\r\n return await editor.writeOnTerminal('node \"' + info.fileName + '\"');\r\n}\r\nexports.default = run;\r\n","phrases":["run current file"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"circle"}},{"v":"8","value":{"shape":"circle"}},{"v":"9","value":{"shape":"circle"}},{"v":"10","value":{"shape":"doublecircle"}},{"v":"11","value":{"shape":"circle"}},{"v":"12","value":{"shape":"circle"},"parent":"sg36"},{"v":"13","value":{"shape":"circle"}},{"v":"14","value":{"shape":"circle"}},{"v":"15","value":{"shape":"circle"}},{"v":"16","value":{"shape":"circle"}},{"v":"17","value":{"shape":"doublecircle"}},{"v":"18","value":{"shape":"circle"},"parent":"sg32"},{"v":"19","value":{"shape":"circle"}},{"v":"20","value":{"shape":"doublecircle"}},{"v":"sg32","value":{"shape":"circle"}},{"v":"sg36","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(select)"}},{"v":"1","w":"2","value":{"label":"(letter, symbol)"}},{"v":"18","w":"2","value":{"label":"(letter, symbol)"}},{"v":"2","w":"3","value":{"label":"({char})","store":"word"}},{"v":"1","w":"4","value":{"label":"(word)"}},{"v":"18","w":"4","value":{"label":"(word)"}},{"v":"4","w":"20","value":{"label":"([multi_word_token])","store":"word","extraArgs":"{\"case\": \"camel\"}"}},{"v":"4","w":"3","value":{"label":"({term})","store":"word"}},{"v":"1","w":"5","value":{"label":"(from)"}},{"v":"1","w":"18","value":{"label":"({ordinalNumber})","normalizer":"ordinalNumber","store":"wordPosition"}},{"v":"5","w":"13","value":{"label":"(line)","store":"selectLine"}},{"v":"13","w":"19","value":{"label":"(number)"}},{"v":"13","w":"14","value":{"label":"({number})","store":"from"}},{"v":"19","w":"14","value":{"label":"({number})","store":"from"}},{"v":"14","w":"15","value":{"label":"(to)"}},{"v":"15","w":"16","value":{"label":"(line, λ)"}},{"v":"16","w":"17","value":{"label":"({number})","store":"to"}},{"v":"5","w":"11","value":{"label":"({ordinalNumber})","normalizer":"ordinalNumber","store":"fromPosition"}},{"v":"5","w":"6","value":{"label":"(letter, symbol)"}},{"v":"11","w":"6","value":{"label":"(letter, symbol)"}},{"v":"6","w":"7","value":{"label":"({char})","store":"from"}},{"v":"7","w":"8","value":{"label":"(to)"}},{"v":"8","w":"9","value":{"label":"(letter, symbol, λ)"}},{"v":"12","w":"9","value":{"label":"(letter, symbol, λ)"}},{"v":"8","w":"12","value":{"label":"({ordinalNumber})","normalizer":"ordinalNumber","store":"toPosition"}},{"v":"9","w":"10","value":{"label":"({char})","store":"to"}}],"value":{"id":"select","label":"Select","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Select","desc":"Select a piece of the text in the current line","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Select(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"select\"');\r\n command.word = Array.isArray(command.word) ? command.word.join('') : command.word;\r\n if (command.selectLine != undefined) {\r\n return await editor.select(parseInt(command.from, 10), parseInt(command.to, 10), true);\r\n }\r\n else if (command.word != undefined) {\r\n const occurences = await editor.findPositionOf(command.word);\r\n let wordPosition = parseInt(command.wordPosition, 10) || 1;\r\n if (wordPosition === -1)\r\n wordPosition = occurences.length;\r\n if (occurences.length) {\r\n return await editor.select(occurences[wordPosition - 1][0], occurences[wordPosition - 1][1] - 1, false);\r\n }\r\n throw new Error('Nothing found for string: ' + command.word);\r\n }\r\n const from = command.from || '';\r\n const to = command.to || '';\r\n let fromPos = parseInt(command.fromPosition, 10) || 1;\r\n let toPos = parseInt(command.toPosition, 10) || 1;\r\n if (from === '' || to === '') {\r\n throw new Error('Invalid arguments!');\r\n }\r\n const matchFrom = await editor.findPositionOf(from);\r\n if (fromPos === -1)\r\n fromPos = matchFrom.length;\r\n const pad = matchFrom[fromPos - 1][1] || 0;\r\n const matchTo = await editor.findPositionOf(to, undefined, pad);\r\n if (toPos === -1)\r\n toPos = matchTo.length;\r\n return await editor.select(matchFrom[fromPos - 1][0], pad + matchTo[toPos - 1][0], false);\r\n}\r\nexports.default = Select;\r\n","phrases":["select letter K","select word text","select first letter g","select 42ª word a","select from letter K to K","select from letter M to 42ª letter g","select from 1ª symbol K to letter K","select from first symbol g to 42ª letter K","select from line 42 to line 1","select from line number 1 to 42","select word [multi_word_token]","select 1ª word [multi_word_token]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"2","value":{"label":"(string, text)"}},{"v":"2","w":"2","value":{"label":"({any})","store":"string"}},{"v":"2","w":"4","value":{"label":"(string, text)"}}],"value":{"id":"string","label":"Writes a string","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","disableStopWords":"true","priority":"2","title":"Writes a string","desc":"Writes a string in the editor","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function WriteString(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"WriteString\"');\r\n command.string = Array.isArray(command.string) ? command.string : [command.string];\r\n const text = '\"' + command.string.join(' ') + '\"';\r\n if (command.parent)\r\n return text;\r\n return await editor.write(text);\r\n}\r\nexports.default = WriteString;\r\n","phrases":["text string"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(new, declare, create)","store":"isNew","normalizer":"boolean"}},{"v":"0","w":"2","value":{"label":"(variable, constant)","store":"memType"}},{"v":"1","w":"2","value":{"label":"(variable, constant)","store":"memType"}},{"v":"2","w":"3","value":{"label":"(called, named)"}},{"v":"3","w":"4","value":{"label":"([multi_word_token])","store":"varName","extraArgs":"{\"case\": \"camel\"}"}},{"v":"2","w":"7","value":{"label":"({term})","store":"varName"}},{"v":"3","w":"7","value":{"label":"({term})","store":"varName"}},{"v":"4","w":"5","value":{"label":"(equals)"}},{"v":"7","w":"5","value":{"label":"(equals)"}},{"v":"5","w":"6","value":{"label":"([expressions])","store":"expression"}}],"value":{"id":"variable_assignment","label":"Stores a value in a variable","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Stores a value in a variable","desc":"Stores a number, string etc in a variable","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function NewVariable(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"NewVariable\"');\r\n let { isNew, varName, expression, memType } = command;\r\n const value = typeof expression === 'string' ? expression : expression === null || expression === void 0 ? void 0 : expression.value;\r\n const allocate = memType === 0 ? 'let ' : 'const ';\r\n varName = Array.isArray(varName) ? varName.join('') : varName;\r\n const text = `${isNew ? allocate : ''}${varName}${value ? ` = ${value}` : ''}`;\r\n await editor.write(text);\r\n if (typeof expression !== 'string') {\r\n const pos = await editor.findPositionOf(expression.value);\r\n if (pos.length) {\r\n return await editor.select(pos[0][0], pos[0][1] - 1, false);\r\n }\r\n }\r\n return undefined;\r\n}\r\nexports.default = NewVariable;\r\n","phrases":["declare variable called [multi_word_token]","variable named [multi_word_token]","new variable named [multi_word_token] equals [expressions]","create constant named a equals [expressions]","declare variable temp equals [expressions]","variable called [multi_word_token] equals [expressions]","variable called value equals [expressions]","variable text equals [expressions]","new constant called number","declare variable graph","constant named text","variable value"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(reference)"}},{"v":"0","w":"2","value":{"label":"(variable, constant)"}},{"v":"1","w":"2","value":{"label":"(variable, constant)"}},{"v":"0","w":"6","value":{"label":"(namespace)","store":"isNamespace","normalizer":"boolean"}},{"v":"1","w":"6","value":{"label":"(namespace)","store":"isNamespace","normalizer":"boolean"}},{"v":"6","w":"2","value":{"label":"(λ)"}},{"v":"2","w":"4","value":{"label":"(called)"}},{"v":"2","w":"3","value":{"label":"({term})","store":"varName"}},{"v":"4","w":"5","value":{"label":"([multi_word_token])","store":"varName","extraArgs":"{\"case\": \"camel\"}"}}],"value":{"id":"variable_reference","label":"References a variable","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"References a variable","desc":"Writes a variable or constant in the editor","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function VariableReference(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"VariableReference\"');\r\n let { varName, parent, isNamespace = false } = command;\r\n varName = Array.isArray(varName) ? varName : [varName];\r\n varName = isNamespace ? varName.map(a => a[0].toUpperCase() + a.substr(1)).join('') : varName.join('');\r\n if (parent)\r\n return varName;\r\n return await editor.write(varName);\r\n}\r\nexports.default = VariableReference;\r\n","phrases":["reference constant graph","reference namespace temp","variable temp","namespace number","reference variable called [multi_word_token]","reference namespace called [multi_word_token]","variable called [multi_word_token]","namespace called [multi_word_token]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"doublecircle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(print)"}},{"v":"0","w":"2","value":{"label":"(write)"}},{"v":"2","w":"1","value":{"label":"(down, λ)"}},{"v":"2","w":"3","value":{"label":"(it)"}},{"v":"3","w":"1","value":{"label":"(down, λ)"}},{"v":"1","w":"4","value":{"label":"(space)","store":"isSpace","normalizer":"boolean"}},{"v":"1","w":"5","value":{"label":"({any})","store":"text"}},{"v":"5","w":"5","value":{"label":"({any})","store":"text"}}],"value":{"id":"write","label":"Write text","lang":"en-US","langName":"English","pad":"0.2","disableStopWords":"true","rankdir":"LR","title":"Write text","desc":"Write some text in the editor","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function write(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"write.\"');\r\n const text = command.isSpace ? ' ' : Array.isArray(command.text) ? (_a = command.text) === null || _a === void 0 ? void 0 : _a.join(' ') : command.text;\r\n return await editor.write(text);\r\n}\r\nexports.default = write;\r\n","phrases":["print","write","write it","print space","write space","write it down space","print who are you the universe is cracked","write the universe is cracked the universe is cracked","write it down the universe is cracked the universe is cracked"]}}],"pt-BR":[{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(estrutura)"}},{"v":"1","w":"2","value":{"label":"(condicional)"}},{"v":"2","w":"3","value":{"label":"(se)","disableSpellcheck":"true"}},{"v":"2","w":"7","value":{"label":"([expressions])","store":"condition"}},{"v":"3","w":"7","value":{"label":"([expressions])","store":"condition"}},{"v":"3","w":"6","value":{"label":"(se)","disableSpellcheck":"true"}},{"v":"6","w":"4","value":{"label":"(não)","store":"otherwise","normalizer":"boolean","disableSpellcheck":"true"}},{"v":"3","w":"4","value":{"label":"(senão, sinal)","store":"otherwise","normalizer":"boolean","disableSpellcheck":"true"}},{"v":"4","w":"5","value":{"label":"([expressions])","store":"condition"}}],"value":{"id":"condition","label":"Estrutura condicional","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Estrutura condicional","desc":"Cria uma estrutura condicional if/else","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Condition(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"Condition.\"');\r\n const anything = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang][0];\r\n let { condition = anything, otherwise = false } = command;\r\n condition = typeof condition === 'string' ? condition : condition === null || condition === void 0 ? void 0 : condition.value;\r\n let text = `if(${condition}) {\\n\\n}${otherwise ? ' else {\\n\\n}' : ''}`;\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n await editor.indentSelection([line._line - 3, 0], [line._line + (otherwise ? 8 : 3), 0]);\r\n await editor.goToLine(line._line);\r\n return null;\r\n}\r\nexports.default = Condition;\r\n","phrases":["estrutura condicional","estrutura condicional se","estrutura condicional se sinal","estrutura condicional se se não","estrutura condicional se senão [expressions]","estrutura condicional se se não [expressions]","estrutura condicional se [expressions]","estrutura condicional [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"circle"},"parent":"sg5"},{"v":"8","value":{"shape":"circle"}},{"v":"10","value":{"shape":"doublecircle"}},{"v":"11","value":{"shape":"circle"}},{"v":"12","value":{"shape":"doublecircle"}},{"v":"13","value":{"shape":"circle"}},{"v":"sg5","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(cursor, ponteiro)"}},{"v":"1","w":"2","value":{"label":"(linha)"}},{"v":"2","w":"3","value":{"label":"({number})","store":"line"}},{"v":"1","w":"5","value":{"label":"(símbolo, letra)"}},{"v":"7","w":"5","value":{"label":"(símbolo, letra)"}},{"v":"1","w":"7","value":{"label":"({ordinalNumber})","store":"leapSize","normalizer":"ordinalNumber"}},{"v":"5","w":"6","value":{"label":"({char})","store":"symbol"}},{"v":"1","w":"8","value":{"label":"(começo, final)","store":"linePosition"}},{"v":"8","w":"10","value":{"label":"(linha)"}},{"v":"1","w":"11","value":{"label":"(próximo)"}},{"v":"11","w":"13","value":{"label":"({number})","store":"leapSize"}},{"v":"11","w":"12","value":{"label":"(símbolo, letra)"}},{"v":"13","w":"12","value":{"label":"(símbolo, letra)"}}],"value":{"id":"cursor","label":"Mover o cursor","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Mover o cursor","desc":"Move o cursor para uma linha ou símbolo","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function cursor(args, editor, context) {\r\n console.log('[Spoken]: Executing: \"cursor.\"');\r\n if (args.linePosition != null) {\r\n const pos = args.linePosition === LinePostionEnum.BEGIN ? 'BEGIN_LINE' : 'END_LINE';\r\n return await editor.moveCursorTo(pos);\r\n }\r\n else if (args.line) {\r\n return await editor.goToLine(args.line);\r\n }\r\n else if (!args.symbol) {\r\n const nth = parseInt(args.leapSize || '1', 10);\r\n return await editor.moveCursorTo(null, undefined, nth);\r\n }\r\n else {\r\n if (args.leapSize == undefined)\r\n args.leapSize = '1';\r\n const nth = parseInt(args.leapSize || '1', 10);\r\n return await editor.moveCursorTo('SYMBOL', args.symbol, nth);\r\n }\r\n return await editor.moveCursorTo('BEGIN_LINE');\r\n}\r\nvar LinePostionEnum;\r\n(function (LinePostionEnum) {\r\n LinePostionEnum[LinePostionEnum[\"BEGIN\"] = 0] = \"BEGIN\";\r\n LinePostionEnum[LinePostionEnum[\"END\"] = 1] = \"END\";\r\n})(LinePostionEnum || (LinePostionEnum = {}));\r\nexports.default = cursor;\r\n","phrases":["ponteiro linha 42","cursor letra z","cursor 42ª letra z","ponteiro final linha","cursor próximo letra","ponteiro próximo 1 símbolo"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(expressão)"}},{"v":"1","w":"2","value":{"label":"([expressions])","store":"left"}},{"v":"2","w":"3","value":{"label":"([math_operator], [logical_operator])","store":"operation"}},{"v":"4","w":"3","value":{"label":"([math_operator], [logical_operator])","store":"operation"}},{"v":"3","w":"4","value":{"label":"([expressions])","store":"right"}}],"value":{"id":"elementar_math_op","label":"Operação Matemática Elementar","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","disableStopWords":"true","priority":"2","title":"Escreve uma operação matemática elementar","desc":"Escreve uma operação matemática elementar (*, -, +, /)","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function WriteElementarMathOperation(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"WriteElementarMathOperation\"');\r\n let operation = toArray(command.operation);\r\n let right = toArray(command.right);\r\n let text = toValue(command.left);\r\n for (let i = 0; i < right.length; i++) {\r\n if (operation[i].isNegative) {\r\n if (operation[i].operator === '===')\r\n text += ' !== ' + toValue(right[i]);\r\n else\r\n text = '!(' + text + ' ' + operation[i].operator + ' ' + toValue(right[i]) + ')';\r\n }\r\n else {\r\n text += ' ' + operation[i].operator + ' ' + toValue(right[i]);\r\n }\r\n }\r\n if (command.parent)\r\n return text;\r\n await editor.write(text);\r\n const wildcard = [command.left, ...right].find(item => typeof item !== 'string');\r\n if (wildcard) {\r\n const pos = await editor.findPositionOf(wildcard.value);\r\n if (pos.length) {\r\n return await editor.select(pos[0][0], pos[0][1] - 1, false);\r\n }\r\n }\r\n return undefined;\r\n}\r\nconst toArray = (arg) => Array.isArray(arg) ? arg : [arg];\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nexports.default = WriteElementarMathOperation;\r\n","phrases":["expressão [expressions] [math_operator] [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"doublecircle"}},{"v":"2","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"([number], [string], [variable_reference], [elementar_math_op], [function_call])","store":"expression"}},{"v":"0","w":"2","value":{"label":"(gap)","store":"wildCard","normalizer":"identity"}}],"value":{"id":"expressions","label":"Escreve uma expressão","lang":"pt-BR","langName":"Português","pad":"0.2","nodesep":"1","ranksep":"2","rankdir":"LR","alias":"true","title":"Escreve uma expressão","desc":"Escreve uma expressão no editor de texto, esse automata foi projetado para ser usado em outros automatas","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Expression(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"Expression\"');\r\n const { expression, parent, wildCard } = command;\r\n if (parent) {\r\n return expression ? expression : { value: wildCard, isWildCard: true };\r\n }\r\n return await editor.write(expression || wildCard);\r\n}\r\nexports.default = Expression;\r\n","phrases":["[number]","gap"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"doublecircle"}},{"v":"8","value":{"shape":"circle"}},{"v":"9","value":{"shape":"circle"}},{"v":"10","value":{"shape":"doublecircle"}},{"v":"11","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(chame, chamar, execute)"}},{"v":"1","w":"2","value":{"label":"(função)"}},{"v":"2","w":"3","value":{"label":"([multi_word_token])","store":"functionName","extraArgs":"{\"case\": \"camel\"}"}},{"v":"3","w":"4","value":{"label":"(λ)"}},{"v":"2","w":"4","value":{"label":"({term})","store":"functionName"}},{"v":"4","w":"11","value":{"label":"(da, na)"}},{"v":"4","w":"5","value":{"label":"([expressions])","store":"caller"}},{"v":"11","w":"5","value":{"label":"([expressions])","store":"caller"}},{"v":"4","w":"6","value":{"label":"(argumentos)"}},{"v":"5","w":"6","value":{"label":"(argumentos)"}},{"v":"6","w":"7","value":{"label":"([expressions])","store":"args"}},{"v":"7","w":"8","value":{"label":"(e)"}},{"v":"8","w":"7","value":{"label":"([expressions])","store":"args"}},{"v":"4","w":"9","value":{"label":"({number})","store":"argsNumber"}},{"v":"5","w":"9","value":{"label":"({number})","store":"argsNumber"}},{"v":"9","w":"10","value":{"label":"(argumentos)"}}],"value":{"id":"function_call","label":"Chama uma função","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","priority":"2","title":"Chama uma função","desc":"Chama uma função com os determinados argumentos no determinado caller","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function FunctionCall(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"FunctionCall\"');\r\n const anything = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang];\r\n const functionName = join(command.functionName);\r\n const argsNumber = command.argsNumber ? parseInt(command.argsNumber, 10) : command.oneArg ? 1 : NaN;\r\n const args = command.args ? toArray(command.args) : [];\r\n const caller = command.caller ? toValue(command.caller) : null;\r\n let text = functionName + '(';\r\n if (argsNumber) {\r\n text += new Array(argsNumber).fill(anything).join(', ');\r\n }\r\n else if (args.length) {\r\n text += (args.map(item => typeof item === 'string' ? item : anything).join(', '));\r\n }\r\n text += ')';\r\n if (caller)\r\n text = caller + '.' + text;\r\n if (command.parent)\r\n return text;\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n return await editor.indentSelection([line._line - 1, 0], [line._line - 1, line.character]);\r\n}\r\nconst toArray = (arg) => Array.isArray(arg) ? arg : [arg];\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nconst join = (item) => typeof item === 'string' ? item : item.join('');\r\nexports.default = FunctionCall;\r\n","phrases":["chamar função [multi_word_token]","chame função temp","execute função [multi_word_token] [expressions]","chamar função [multi_word_token] na [expressions]","chamar função lista [expressions]","chame função valor na [expressions]","chamar função [multi_word_token] [expressions] argumentos [expressions]","execute função [multi_word_token] argumentos [expressions]","execute função [multi_word_token] na [expressions] argumentos [expressions]","execute função valor [expressions] argumentos [expressions]","execute função numero argumentos [expressions]","chamar função temp da [expressions] argumentos [expressions]","execute função [multi_word_token] [expressions] 42 argumentos","chamar função [multi_word_token] 42 argumentos","chame função [multi_word_token] na [expressions] 1 argumentos","chame função a [expressions] 42 argumentos"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(nova, declare, crie)"}},{"v":"1","w":"2","value":{"label":"(função)"}},{"v":"2","w":"3","value":{"label":"({term})","store":"fnName"}},{"v":"3","w":"4","value":{"label":"({number})","store":"argsNumber"}},{"v":"4","w":"5","value":{"label":"(argumentos)"}},{"v":"3","w":"6","value":{"label":"(retorna, retornando)"}},{"v":"5","w":"6","value":{"label":"(retorna, retornando)"}},{"v":"6","w":"7","value":{"label":"([expressions])","store":"returnValue"}}],"value":{"id":"function_declaration","label":"Cria uma função","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","priority":"2","title":"Cria uma função","desc":"Cria uma função com o número de argumentos especificados e um valor de retorno","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function FunctionDeclaration(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"FunctionDeclaration\"');\r\n const anything = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang];\r\n let { fnName, argsNumber, returnValue } = command;\r\n argsNumber = argsNumber != null ? parseInt(argsNumber, 10) : 0;\r\n let text = `function ${fnName}(`;\r\n if (argsNumber > 0) {\r\n text += new Array(argsNumber).fill(anything).join(', ');\r\n }\r\n text += ') {\\n';\r\n if (returnValue != null) {\r\n text += 'return ' + toValue(returnValue);\r\n }\r\n text += '\\n}';\r\n if (command.parent)\r\n return text;\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n await editor.indentSelection([line._line - 3, 0], [line._line + 3, 0]);\r\n return await editor.goToLine(line._line);\r\n}\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nexports.default = FunctionDeclaration;\r\n","phrases":["declare função a","declare função a 42 argumentos","crie função lista 1 argumentos retorna [expressions]","declare função texto retornando [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(vá, vai)"}},{"v":"1","w":"2","value":{"label":"(para)"}},{"v":"2","w":"5","value":{"label":"(a)"}},{"v":"0","w":"3","value":{"label":"(linha)"}},{"v":"1","w":"3","value":{"label":"(linha)"}},{"v":"2","w":"3","value":{"label":"(linha)"}},{"v":"5","w":"3","value":{"label":"(linha)"}},{"v":"3","w":"6","value":{"label":"(número)"}},{"v":"3","w":"4","value":{"label":"({number})","store":"line"}},{"v":"6","w":"4","value":{"label":"({number})","store":"line"}}],"value":{"id":"go_to_line","label":"Trocar linha","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Trocar linha","desc":"Move or cursor para uma linha diferente","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function goToLine(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"goToLine.\"');\r\n return await editor.goToLine(command.line);\r\n}\r\nexports.default = goToLine;\r\n","phrases":["vai para linha 42","vai para linha número 42","vai para a linha 1","vá para a linha número 1","vá linha 42","vá linha número 42","linha 1","linha número 42"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"},"parent":"sg24"},{"v":"1","value":{"shape":"doublecircle"}},{"v":"2","value":{"shape":"circle"},"parent":"sg24"},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"doublecircle"}},{"v":"sg24","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(e, ou, igual)","store":"logicalOperator"}},{"v":"2","w":"1","value":{"label":"(e, ou, igual)","store":"logicalOperator"}},{"v":"0","w":"2","value":{"label":"(não, negativo)","store":"isNegative","normalizer":"boolean"}},{"v":"0","w":"3","value":{"label":"(menor, maior)","store":"inequalityOperator","disableSpellcheck":"true"}},{"v":"2","w":"3","value":{"label":"(menor, maior)","store":"inequalityOperator","disableSpellcheck":"true"}},{"v":"3","w":"4","value":{"label":"(ou)"}},{"v":"4","w":"5","value":{"label":"(igual)","store":"orEqual","normalizer":"boolean"}},{"v":"3","w":"7","value":{"label":"(que)"}},{"v":"5","w":"7","value":{"label":"(a)"}}],"value":{"id":"logical_operator","label":"Escreve um operador lógico","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","alias":"true","title":"Escreve um operador lógico","desc":"Escreve um operador lógico (===, !==, &&, ||, >, <, >=, <=) pensando para ser usado com expressões","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function LogicalOperator(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"LogicalOperator\"');\r\n const { logicalOperator, isNegative = false, inequalityOperator, orEqual = false } = command;\r\n if (logicalOperator !== undefined) {\r\n const operator = ['&&', '||', '==='][logicalOperator];\r\n return { operator, isNegative };\r\n }\r\n else if (inequalityOperator !== undefined) {\r\n const operator = ['<', '>'][inequalityOperator] + (orEqual ? '=' : '');\r\n return { operator, isNegative };\r\n }\r\n return { operator: 'error', isNegative: false };\r\n}\r\nexports.default = LogicalOperator;\r\n","phrases":["igual","não ou","não maior ou igual","menor ou igual","não menor ou igual a","negativo menor que","menor ou igual a","menor que"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(mais, vezes, menos, dividido)","store":"mathOperator","disableSpellcheck":"true"}}],"value":{"id":"math_operator","label":"Escreve um operador matemático","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","alias":"true","title":"Escreve uma operador matemático","desc":"Escreve um operador matemático (*, -, +, /) pensando para ser usado com expressões","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function MathOperator(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"MathOperator\"');\r\n const { mathOperator } = command;\r\n const operator = ['+', '*', '-', '/'][mathOperator] || 'error';\r\n return { operator };\r\n}\r\n// @ts-ignore\r\nexports.default = MathOperator;\r\n","phrases":["menos"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"3","value":{"label":"(*)"}},{"v":"3","w":"3","value":{"label":"({any})","store":"words"}},{"v":"3","w":"4","value":{"label":"(*)"}}],"value":{"id":"multi_word_token","label":"Agrupa múltiplas palavras","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","disableStopWords":"true","title":"Agrupa múltiplas palavras","desc":"Agrupa múltiplas palavras juntas, projetado para ser usado dentro de outros automatas","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function MultiWordTokens(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"MultiWordTokens\"');\r\n function camelCase(words) {\r\n return words.map((a, i) => i ? a.charAt(0).toUpperCase() + a.slice(1) : a);\r\n }\r\n if (((_a = command.extra) === null || _a === void 0 ? void 0 : _a.case) === 'camel') {\r\n return camelCase(command.words);\r\n }\r\n return command.words;\r\n}\r\nexports.default = MultiWordTokens;\r\n","phrases":["* *"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"},"parent":"sg29"},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"},"parent":"sg31"},{"v":"5","value":{"shape":"circle"},"parent":"sg29"},{"v":"sg29","value":{"shape":"circle"}},{"v":"sg31","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(nova)"}},{"v":"5","w":"1","value":{"label":"(nova)"}},{"v":"1","w":"2","value":{"label":"(linha)"}},{"v":"5","w":"2","value":{"label":"(linha)"}},{"v":"2","w":"3","value":{"label":"(acima, abaixo)","store":"position"}},{"v":"4","w":"3","value":{"label":"(acima, abaixo)","store":"position"}},{"v":"0","w":"4","value":{"label":"(linha)"}},{"v":"0","w":"5","value":{"label":"(crie)"}},{"v":"5","w":"5","value":{"label":"(uma)"}},{"v":"4","w":"2","value":{"label":"(nova)"}}],"value":{"id":"new_line","label":"Linha nova","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Linha nova","desc":"Cria uma linha nova abaixo ou acima da linha atual","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function newLine(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"new line.\"');\r\n return await editor.newLine(command.position);\r\n}\r\nexports.default = newLine;\r\n","phrases":["nova linha","linha nova","crie nova linha","crie linha","nova linha acima","linha nova acima","linha abaixo","crie nova linha acima","crie linha abaixo"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"2","value":{"label":"(número)"}},{"v":"2","w":"3","value":{"label":"({number})","store":"number"}}],"value":{"id":"number","label":"Escreve um número","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","priority":"2","title":"Escreve um número","desc":"Escreve um número no editor","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function WriteNumber(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"WriteNumber\"');\r\n const { number, parent } = command;\r\n if (parent)\r\n return number;\r\n return await editor.write(number);\r\n}\r\nexports.default = WriteNumber;\r\n","phrases":["número 42"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"circle"}},{"v":"8","value":{"shape":"doublecircle"}},{"v":"9","value":{"shape":"circle"}},{"v":"10","value":{"shape":"circle"}},{"v":"11","value":{"shape":"circle"}},{"v":"12","value":{"shape":"circle"}},{"v":"13","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(estrutura)"}},{"v":"1","w":"1","value":{"label":"(de)"}},{"v":"1","w":"2","value":{"label":"(repetição)"}},{"v":"2","w":"9","value":{"label":"(para)"}},{"v":"9","w":"10","value":{"label":"(todo)"}},{"v":"10","w":"11","value":{"label":"({term})","store":"item"}},{"v":"11","w":"12","value":{"label":"(de, da, do, em, λ)"}},{"v":"12","w":"13","value":{"label":"([expressions])","store":"collection"}},{"v":"2","w":"3","value":{"label":"(de, da, do, λ)"}},{"v":"3","w":"4","value":{"label":"([expressions])","store":"from"}},{"v":"4","w":"5","value":{"label":"(até)"}},{"v":"5","w":"6","value":{"label":"([expressions])","store":"to"}},{"v":"6","w":"7","value":{"label":"(etapa)"}},{"v":"7","w":"8","value":{"label":"([expressions])","store":"step"}}],"value":{"id":"repetition","label":"Estrutura de repetição","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Estrutura de repetição","desc":"Cria uma estrutura de repetição for","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Repetition(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"Repetition.\"');\r\n const gap = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang][0];\r\n let text = `for(${gap}; ${gap}; ${gap}) {\\n\\n}`;\r\n if (command.from == undefined && command.item == undefined) {\r\n text = `for(${gap}; ${gap}; ${gap}) {\\n\\n}`;\r\n }\r\n else if (command.from != null && command.to != null) {\r\n const from = toValue(command.from);\r\n const to = toValue(command.to);\r\n const step = command.step ? toValue(command.step) : 'i + 1';\r\n text = `for(let i = ${from}; i < ${to}; i = ${step}) {\\n\\n}`;\r\n }\r\n else if (command.item != null && command.collection != null) {\r\n const item = command.item;\r\n const collection = toValue(command.collection);\r\n text = `for(const ${item} of ${collection}) {\\n\\n}`;\r\n }\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n await editor.indentSelection([line._line - 3, 0], [line._line + 3, 0]);\r\n return await editor.goToLine(line._line);\r\n}\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nexports.default = Repetition;\r\n","phrases":["estrutura repetição","estrutura repetição da [expressions] até [expressions]","estrutura repetição da [expressions] até [expressions] etapa [expressions]","estrutura repetição para todo a em [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(execute, executar)"}},{"v":"1","w":"4","value":{"label":"(este)"}},{"v":"4","w":"3","value":{"label":"(arquivo)"}},{"v":"1","w":"2","value":{"label":"(arquivo)"}},{"v":"2","w":"3","value":{"label":"(atual)"}}],"value":{"id":"run","label":"Executar arquivo","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Executar arquivo","desc":"Executa o arquivo atual no terminal usando node","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function run(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"run.\"');\r\n const info = await editor.fileInfo();\r\n return await editor.writeOnTerminal('node \"' + info.fileName + '\"');\r\n}\r\nexports.default = run;\r\n","phrases":["executar arquivo atual","execute este arquivo"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"circle"}},{"v":"8","value":{"shape":"circle"}},{"v":"9","value":{"shape":"circle"}},{"v":"10","value":{"shape":"doublecircle"}},{"v":"11","value":{"shape":"circle"}},{"v":"12","value":{"shape":"circle"},"parent":"sg41"},{"v":"13","value":{"shape":"circle"}},{"v":"14","value":{"shape":"circle"}},{"v":"15","value":{"shape":"circle"}},{"v":"16","value":{"shape":"circle"}},{"v":"17","value":{"shape":"doublecircle"}},{"v":"18","value":{"shape":"circle"},"parent":"sg37"},{"v":"19","value":{"shape":"circle"}},{"v":"20","value":{"shape":"doublecircle"}},{"v":"sg37","value":{"shape":"circle"}},{"v":"sg41","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(selecione, selecionar)"}},{"v":"1","w":"2","value":{"label":"(letra, símbolo)"}},{"v":"18","w":"2","value":{"label":"(letra, símbolo)"}},{"v":"2","w":"3","value":{"label":"({char})","store":"word"}},{"v":"1","w":"4","value":{"label":"(palavra)"}},{"v":"18","w":"4","value":{"label":"(palavra)"}},{"v":"4","w":"20","value":{"label":"([multi_word_token])","store":"word","extraArgs":"{\"case\": \"camel\"}"}},{"v":"4","w":"3","value":{"label":"({term})","store":"word"}},{"v":"1","w":"5","value":{"label":"(de, da)"}},{"v":"1","w":"18","value":{"label":"({ordinalNumber})","normalizer":"ordinalNumber","store":"wordPosition"}},{"v":"5","w":"13","value":{"label":"(linha)","store":"selectLine"}},{"v":"13","w":"19","value":{"label":"(número)"}},{"v":"13","w":"14","value":{"label":"({number})","store":"from"}},{"v":"19","w":"14","value":{"label":"({number})","store":"from"}},{"v":"14","w":"15","value":{"label":"(até)"}},{"v":"15","w":"16","value":{"label":"(linha, λ)"}},{"v":"16","w":"17","value":{"label":"({number})","store":"to"}},{"v":"5","w":"11","value":{"label":"({ordinalNumber})","normalizer":"ordinalNumber","store":"fromPosition"}},{"v":"5","w":"6","value":{"label":"(letra, símbolo)"}},{"v":"11","w":"6","value":{"label":"(letra, símbolo)"}},{"v":"6","w":"7","value":{"label":"({char})","store":"from"}},{"v":"7","w":"8","value":{"label":"(até)"}},{"v":"8","w":"9","value":{"label":"(letra, símbolo, λ)"}},{"v":"12","w":"9","value":{"label":"(letra, símbolo, λ)"}},{"v":"8","w":"12","value":{"label":"({ordinalNumber})","normalizer":"ordinalNumber","store":"toPosition"}},{"v":"9","w":"10","value":{"label":"({char})","store":"to"}}],"value":{"id":"select","label":"Selecionar","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Selecionar","desc":"Seleciona um pedaço de texto na linha atual","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Select(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"select\"');\r\n command.word = Array.isArray(command.word) ? command.word.join('') : command.word;\r\n if (command.selectLine != undefined) {\r\n return await editor.select(parseInt(command.from, 10), parseInt(command.to, 10), true);\r\n }\r\n else if (command.word != undefined) {\r\n const occurences = await editor.findPositionOf(command.word);\r\n let wordPosition = parseInt(command.wordPosition, 10) || 1;\r\n if (wordPosition === -1)\r\n wordPosition = occurences.length;\r\n if (occurences.length) {\r\n return await editor.select(occurences[wordPosition - 1][0], occurences[wordPosition - 1][1] - 1, false);\r\n }\r\n throw new Error('Nothing found for string: ' + command.word);\r\n }\r\n const from = command.from || '';\r\n const to = command.to || '';\r\n let fromPos = parseInt(command.fromPosition, 10) || 1;\r\n let toPos = parseInt(command.toPosition, 10) || 1;\r\n if (from === '' || to === '') {\r\n throw new Error('Invalid arguments!');\r\n }\r\n const matchFrom = await editor.findPositionOf(from);\r\n if (fromPos === -1)\r\n fromPos = matchFrom.length;\r\n const pad = matchFrom[fromPos - 1][1] || 0;\r\n const matchTo = await editor.findPositionOf(to, undefined, pad);\r\n if (toPos === -1)\r\n toPos = matchTo.length;\r\n return await editor.select(matchFrom[fromPos - 1][0], pad + matchTo[toPos - 1][0], false);\r\n}\r\nexports.default = Select;\r\n","phrases":["selecionar símbolo A","selecionar palavra valor","selecione primeiro símbolo A","selecionar sétimo palavra numero","selecionar da letra a até a","selecionar de símbolo B até 42ª A","selecione da último símbolo a até símbolo z","selecionar da primeiro símbolo B até 42ª símbolo z","selecione de linha 1 até 1","selecione da linha número 1 até linha 42","selecionar palavra [multi_word_token]","selecione primeiro palavra [multi_word_token]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"2","value":{"label":"(string, text)"}},{"v":"2","w":"2","value":{"label":"({any})","store":"string"}},{"v":"2","w":"4","value":{"label":"(string, text)"}}],"value":{"id":"string","label":"Escreve uma string","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","disableStopWords":"true","priority":"2","title":"Escreve uma string","desc":"Escreve uma string no editor","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function WriteString(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"WriteString\"');\r\n command.string = Array.isArray(command.string) ? command.string : [command.string];\r\n const text = '\"' + command.string.join(' ') + '\"';\r\n if (command.parent)\r\n return text;\r\n return await editor.write(text);\r\n}\r\nexports.default = WriteString;\r\n","phrases":["string string"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(nova, declare, crie)","store":"isNew","normalizer":"boolean"}},{"v":"0","w":"2","value":{"label":"(variável, constante)","store":"memType"}},{"v":"1","w":"2","value":{"label":"(variável, constante)","store":"memType"}},{"v":"2","w":"3","value":{"label":"(chamada)"}},{"v":"3","w":"4","value":{"label":"([multi_word_token])","store":"varName","extraArgs":"{\"case\": \"camel\"}"}},{"v":"2","w":"7","value":{"label":"({term})","store":"varName"}},{"v":"3","w":"7","value":{"label":"({term})","store":"varName"}},{"v":"4","w":"5","value":{"label":"(igual)"}},{"v":"7","w":"5","value":{"label":"(igual)"}},{"v":"5","w":"6","value":{"label":"([expressions])","store":"expression"}}],"value":{"id":"variable_assignment","label":"Guarda um valor em uma variável","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Guarda um valor em uma variável","desc":"Guarda um valor, inteiro, texto e etc em uma variável","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function NewVariable(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"NewVariable\"');\r\n let { isNew, varName, expression, memType } = command;\r\n const value = typeof expression === 'string' ? expression : expression === null || expression === void 0 ? void 0 : expression.value;\r\n const allocate = memType === 0 ? 'let ' : 'const ';\r\n varName = Array.isArray(varName) ? varName.join('') : varName;\r\n const text = `${isNew ? allocate : ''}${varName}${value ? ` = ${value}` : ''}`;\r\n await editor.write(text);\r\n if (typeof expression !== 'string') {\r\n const pos = await editor.findPositionOf(expression.value);\r\n if (pos.length) {\r\n return await editor.select(pos[0][0], pos[0][1] - 1, false);\r\n }\r\n }\r\n return undefined;\r\n}\r\nexports.default = NewVariable;\r\n","phrases":["crie variável chamada [multi_word_token]","variável chamada [multi_word_token]","declare variável chamada [multi_word_token] igual [expressions]","declare constante chamada temp igual [expressions]","nova constante temp igual [expressions]","variável chamada [multi_word_token] igual [expressions]","variável chamada valor igual [expressions]","variável a igual [expressions]","crie variável chamada temp","crie constante lista","constante chamada valor","constante numero"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(referência, refira)"}},{"v":"0","w":"2","value":{"label":"(variável, constante)"}},{"v":"1","w":"2","value":{"label":"(variável, constante)"}},{"v":"0","w":"6","value":{"label":"(namespace)","store":"isNamespace","normalizer":"boolean"}},{"v":"1","w":"6","value":{"label":"(namespace)","store":"isNamespace","normalizer":"boolean"}},{"v":"6","w":"2","value":{"label":"(λ)"}},{"v":"2","w":"4","value":{"label":"(chamada)"}},{"v":"2","w":"3","value":{"label":"({term})","store":"varName"}},{"v":"4","w":"5","value":{"label":"([multi_word_token])","store":"varName","extraArgs":"{\"case\": \"camel\"}"}}],"value":{"id":"variable_reference","label":"Referencia a uma variável","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Referencia a uma variável","desc":"Refere a uma variável ou constante já declarada","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function VariableReference(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"VariableReference\"');\r\n let { varName, parent, isNamespace = false } = command;\r\n varName = Array.isArray(varName) ? varName : [varName];\r\n varName = isNamespace ? varName.map(a => a[0].toUpperCase() + a.substr(1)).join('') : varName.join('');\r\n if (parent)\r\n return varName;\r\n return await editor.write(varName);\r\n}\r\nexports.default = VariableReference;\r\n","phrases":["refira constante temp","referência namespace valor","variável lista","namespace temp","referência variável chamada [multi_word_token]","refira namespace chamada [multi_word_token]","variável chamada [multi_word_token]","namespace chamada [multi_word_token]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"doublecircle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(escreva)"}},{"v":"1","w":"3","value":{"label":"({any})","store":"text"}},{"v":"1","w":"2","value":{"label":"(espaço)","store":"isSpace","normalizer":"boolean"}},{"v":"3","w":"3","value":{"label":"({any})","store":"text"}}],"value":{"id":"write","label":"Escrever texto","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","disableStopWords":"true","title":"Escrever texto","desc":"Escreve um pedaço de texto no editor de texto","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function write(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"write.\"');\r\n const text = command.isSpace ? ' ' : Array.isArray(command.text) ? (_a = command.text) === null || _a === void 0 ? void 0 : _a.join(' ') : command.text;\r\n return await editor.write(text);\r\n}\r\nexports.default = write;\r\n","phrases":["escreva","escreva espaço","escreva isto é um teste quem é você"]}}]},"desc":"Collection of voice commands of the typescript language","label":"Typescript voice commands"}]} \ No newline at end of file +{"normalizers":{"ordinalNumber":"function ordinalNumber(lang) {\r\n function OrdinalNumbers(last, tenFirstNumbers) {\r\n return (word, compareStr) => {\r\n if (compareStr(word, last)) return '-1'\r\n if (!Number.isNaN(parseInt(word, 10)))\r\n return parseInt(word, 10).toString()\r\n\r\n const i = tenFirstNumbers.findIndex((a) => compareStr(a, word))\r\n\r\n return i === -1 ? undefined : (i + 1).toString()\r\n }\r\n }\r\n\r\n if (lang === 'pt-BR')\r\n return OrdinalNumbers('último', [\r\n 'primeiro',\r\n 'segundo',\r\n 'terceiro',\r\n 'quarto',\r\n 'quinto',\r\n 'sexto',\r\n 'sétimo',\r\n 'oitavo',\r\n 'nono',\r\n 'décimo',\r\n ])\r\n\r\n return OrdinalNumbers('last', [\r\n 'first',\r\n 'second',\r\n 'third',\r\n 'fourth',\r\n 'fifth',\r\n 'sixth',\r\n 'seventh',\r\n 'eighth',\r\n 'ninth',\r\n 'tenth',\r\n ])\r\n }","boolean":"function boolean(lang) {\r\n return function(word, compareStr) {\r\n return word != undefined ? true : false\r\n }\r\n }","identity":"function identity(lang) {\r\n return function(word, compareStr) {\r\n return word\r\n }\r\n }","number":"function number(lang) {\r\n return function(word, compareStr) {\r\n const numbers = {\r\n 'pt-BR': ['zero', 'um', 'dois', 'três', 'quatro', 'cinco', 'seis', 'sete', 'oito', 'nove', 'dez'],\r\n 'en-US': ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']\r\n }\r\n\r\n if (!isNaN(parseInt(word))) return parseInt(word).toString()\r\n\r\n const val = numbers[lang].indexOf(word)\r\n\r\n if (val !== -1) return val.toString()\r\n\r\n // for some reason this is valid #42\r\n if (/^(#\\d+)$/.test(word)) return word.substr(1)\r\n\r\n return undefined\r\n }\r\n }","elementarMathOperation":"function elementarMathOperation(lang) {\r\n const enUS = [['plus', '+'], ['times', '*'], ['minus', '-'], ['divided', '/']];\r\n const ptBR = [['mais', '+'], ['vezes', '*'], ['menos', '-'], ['dividido', '/']];\r\n const langs = {\r\n 'en-US': enUS,\r\n 'pt-BR': ptBR\r\n };\r\n return (word, compareStr) => {\r\n const op = langs[lang].find(([name]) => compareStr(name, word)) || [];\r\n return op[1];\r\n };\r\n }"},"templates":{"{any}":{"value":"(.*)","examples":{"pt-BR":["quem é você","isto é um teste"],"en-US":["who are you","the universe is cracked"]}},"{term}":{"value":"^(?![\\* ]$).*","examples":{"pt-BR":["valor","lista","numero","texto","temp","a"],"en-US":["value","graph","number","text","temp","a"]}},"{ordinalNumber}":{"value":"(\\S+)","examples":{"pt-BR":["1ª","42ª","último","primeiro","sétimo"],"en-US":["1ª","42ª","last","first","fourth"]}},"{numeral}":{"value":"(\\d+)","examples":{"pt-BR":["1","42"],"en-US":["1","42"]}},"{number}":{"value":"^(?![\\* ]$).*","examples":{"pt-BR":["1","42"],"en-US":["1","42"]},"defaultNormalizer":"number"},"{char}":{"value":"(.)","examples":{"pt-BR":["a","B","A","z"],"en-US":["g","K","M"]}},"@anything":{"value":"","examples":{"pt-BR":["gap"],"en-US":["gap"]}}},"stopWords":{"en-US":{"words":["a -> P1 != (letter|symbol|word)","the","with","you","can","please","from -> S != (to)","to -> S != (from)","of","it","its","it's","is","are","was","were","in"],"expressions":[]},"pt-BR":{"words":["a -> P1 != (letra|símbolo|palavra)","o -> P1 != (letra|símbolo|palavra)","você","com","pode","na","do -> S != (até)","de -> S != (até)","da -> S != (até)","dos","das","as","os","para","é","era","estava","como","uma","vá"],"expressions":["por favor"]}},"modules":[{"id":"typescript","grammar":{"en-US":[{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(conditional)"}},{"v":"1","w":"2","value":{"label":"(statement)"}},{"v":"2","w":"3","value":{"label":"(if)"}},{"v":"3","w":"4","value":{"label":"(else)","store":"otherwise","normalizer":"boolean"}},{"v":"2","w":"5","value":{"label":"([expressions])","store":"condition"}},{"v":"3","w":"5","value":{"label":"([expressions])","store":"condition"}},{"v":"4","w":"5","value":{"label":"([expressions])","store":"condition"}}],"value":{"id":"condition","label":"Condition Statement","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Creates a if/else statement","desc":"Creates a if/else statement with the provided expression as condition","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Condition(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"Condition.\"');\r\n const anything = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang][0];\r\n let { condition = anything, otherwise = false } = command;\r\n condition = typeof condition === 'string' ? condition : condition === null || condition === void 0 ? void 0 : condition.value;\r\n let text = `if(${condition}) {\\n\\n}${otherwise ? ' else {\\n\\n}' : ''}`;\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n await editor.indentSelection([line._line - 3, 0], [line._line + (otherwise ? 8 : 3), 0]);\r\n await editor.goToLine(line._line);\r\n return null;\r\n}\r\nexports.default = Condition;\r\n","phrases":["conditional statement","conditional statement if else","conditional statement if else [expressions]","conditional statement if [expressions]","conditional statement [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"circle"},"parent":"sg3"},{"v":"8","value":{"shape":"circle"}},{"v":"10","value":{"shape":"doublecircle"}},{"v":"11","value":{"shape":"circle"}},{"v":"12","value":{"shape":"doublecircle"}},{"v":"13","value":{"shape":"circle"}},{"v":"sg3","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(cursor, pointer)"}},{"v":"1","w":"2","value":{"label":"(line)"}},{"v":"2","w":"3","value":{"label":"({number})","store":"line"}},{"v":"1","w":"5","value":{"label":"(symbol, letter)"}},{"v":"7","w":"5","value":{"label":"(symbol, letter)"}},{"v":"1","w":"7","value":{"label":"({ordinalNumber})","store":"leapSize","normalizer":"ordinalNumber"}},{"v":"5","w":"6","value":{"label":"({char})","store":"symbol"}},{"v":"1","w":"8","value":{"label":"(begin, end)","store":"linePosition"}},{"v":"8","w":"10","value":{"label":"(line)"}},{"v":"1","w":"11","value":{"label":"(next)"}},{"v":"11","w":"13","value":{"label":"({number})","store":"leapSize"}},{"v":"11","w":"12","value":{"label":"(symbol)"}},{"v":"13","w":"12","value":{"label":"(symbol)"}}],"value":{"id":"cursor","label":"Move cursor","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Move cursor","desc":"Moves the cursor to a different line or token","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function cursor(args, editor, context) {\r\n console.log('[Spoken]: Executing: \"cursor.\"');\r\n if (args.linePosition != null) {\r\n const pos = args.linePosition === LinePostionEnum.BEGIN ? 'BEGIN_LINE' : 'END_LINE';\r\n return await editor.moveCursorTo(pos);\r\n }\r\n else if (args.line) {\r\n return await editor.goToLine(args.line);\r\n }\r\n else if (!args.symbol) {\r\n const nth = parseInt(args.leapSize || '1', 10);\r\n return await editor.moveCursorTo(null, undefined, nth);\r\n }\r\n else {\r\n if (args.leapSize == undefined)\r\n args.leapSize = '1';\r\n const nth = parseInt(args.leapSize || '1', 10);\r\n return await editor.moveCursorTo('SYMBOL', args.symbol, nth);\r\n }\r\n return await editor.moveCursorTo('BEGIN_LINE');\r\n}\r\nvar LinePostionEnum;\r\n(function (LinePostionEnum) {\r\n LinePostionEnum[LinePostionEnum[\"BEGIN\"] = 0] = \"BEGIN\";\r\n LinePostionEnum[LinePostionEnum[\"END\"] = 1] = \"END\";\r\n})(LinePostionEnum || (LinePostionEnum = {}));\r\nexports.default = cursor;\r\n","phrases":["cursor line 1","pointer letter K","cursor fourth symbol g","cursor end line","pointer next symbol","cursor next 42 symbol"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(expression)"}},{"v":"1","w":"2","value":{"label":"([expressions])","store":"left"}},{"v":"2","w":"3","value":{"label":"([math_operator], [logical_operator])","store":"operation"}},{"v":"4","w":"3","value":{"label":"([math_operator], [logical_operator])","store":"operation"}},{"v":"3","w":"4","value":{"label":"([expressions])","store":"right"}}],"value":{"id":"elementar_math_op","label":"Elementar Math Operation","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","disableStopWords":"true","priority":"2","title":"Writes a elementar math operation","desc":"Writes a elementar math operation (*, -, +, /)","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function WriteElementarMathOperation(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"WriteElementarMathOperation\"');\r\n let operation = toArray(command.operation);\r\n let right = toArray(command.right);\r\n let text = toValue(command.left);\r\n for (let i = 0; i < right.length; i++) {\r\n if (operation[i].isNegative) {\r\n if (operation[i].operator === '===')\r\n text += ' !== ' + toValue(right[i]);\r\n else\r\n text = '!(' + text + ' ' + operation[i].operator + ' ' + toValue(right[i]) + ')';\r\n }\r\n else {\r\n text += ' ' + operation[i].operator + ' ' + toValue(right[i]);\r\n }\r\n }\r\n if (command.parent)\r\n return text;\r\n await editor.write(text);\r\n const wildcard = [command.left, ...right].find(item => typeof item !== 'string');\r\n if (wildcard) {\r\n const pos = await editor.findPositionOf(wildcard.value);\r\n if (pos.length) {\r\n return await editor.select(pos[0][0], pos[0][1] - 1, false);\r\n }\r\n }\r\n return undefined;\r\n}\r\nconst toArray = (arg) => Array.isArray(arg) ? arg : [arg];\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nexports.default = WriteElementarMathOperation;\r\n","phrases":["expression [expressions] [logical_operator] [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"doublecircle"}},{"v":"2","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"([number], [string], [variable_reference], [elementar_math_op], [function_call])","store":"expression"}},{"v":"0","w":"2","value":{"label":"(gap)","store":"wildCard","normalizer":"identity"}}],"value":{"id":"expressions","label":"Writes a expression","lang":"en-US","langName":"English","pad":"0.2","nodesep":"1","ranksep":"2","rankdir":"LR","alias":"true","title":"Writes a expression","desc":"Writes a expression in the editor, this is meant to be used inside another automatas","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Expression(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"Expression\"');\r\n const { expression, parent, wildCard } = command;\r\n if (parent) {\r\n return expression ? expression : { value: wildCard, isWildCard: true };\r\n }\r\n return await editor.write(expression || wildCard);\r\n}\r\nexports.default = Expression;\r\n","phrases":["[function_call]","gap"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"doublecircle"}},{"v":"8","value":{"shape":"circle"}},{"v":"9","value":{"shape":"circle"}},{"v":"10","value":{"shape":"doublecircle"}},{"v":"11","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(call, execute)"}},{"v":"1","w":"2","value":{"label":"(function)"}},{"v":"2","w":"3","value":{"label":"([multi_word_token])","store":"functionName","extraArgs":"{\"case\": \"camel\"}"}},{"v":"3","w":"4","value":{"label":"(λ)"}},{"v":"2","w":"4","value":{"label":"({term})","store":"functionName"}},{"v":"4","w":"11","value":{"label":"(of, on, at)","disableSpellcheck":"true"}},{"v":"4","w":"5","value":{"label":"([expressions])","store":"caller"}},{"v":"11","w":"5","value":{"label":"([expressions])","store":"caller"}},{"v":"4","w":"6","value":{"label":"(arguments)"}},{"v":"5","w":"6","value":{"label":"(arguments)"}},{"v":"6","w":"7","value":{"label":"([expressions])","store":"args"}},{"v":"7","w":"8","value":{"label":"(and)"}},{"v":"8","w":"7","value":{"label":"([expressions])","store":"args"}},{"v":"4","w":"9","value":{"label":"({number})","store":"argsNumber"}},{"v":"5","w":"9","value":{"label":"({number})","store":"argsNumber"}},{"v":"9","w":"10","value":{"label":"(arguments)"}}],"value":{"id":"function_call","label":"Calls a function","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","priority":"2","title":"Calls a function","desc":"Calls a function with the specified arguments in the desired caller","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function FunctionCall(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"FunctionCall\"');\r\n const anything = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang];\r\n const functionName = join(command.functionName);\r\n const argsNumber = command.argsNumber ? parseInt(command.argsNumber, 10) : command.oneArg ? 1 : NaN;\r\n const args = command.args ? toArray(command.args) : [];\r\n const caller = command.caller ? toValue(command.caller) : null;\r\n let text = functionName + '(';\r\n if (argsNumber) {\r\n text += new Array(argsNumber).fill(anything).join(', ');\r\n }\r\n else if (args.length) {\r\n text += (args.map(item => typeof item === 'string' ? item : anything).join(', '));\r\n }\r\n text += ')';\r\n if (caller)\r\n text = caller + '.' + text;\r\n if (command.parent)\r\n return text;\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n return await editor.indentSelection([line._line - 1, 0], [line._line - 1, line.character]);\r\n}\r\nconst toArray = (arg) => Array.isArray(arg) ? arg : [arg];\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nconst join = (item) => typeof item === 'string' ? item : item.join('');\r\nexports.default = FunctionCall;\r\n","phrases":["call function [multi_word_token]","call function graph","call function [multi_word_token] [expressions]","execute function [multi_word_token] on [expressions]","call function temp [expressions]","execute function value on [expressions]","execute function [multi_word_token] [expressions] arguments [expressions]","call function [multi_word_token] arguments [expressions]","call function [multi_word_token] at [expressions] arguments [expressions]","execute function graph [expressions] arguments [expressions]","execute function graph arguments [expressions]","call function text at [expressions] arguments [expressions]","execute function [multi_word_token] [expressions] 42 arguments","call function [multi_word_token] 1 arguments","execute function [multi_word_token] at [expressions] 1 arguments","execute function text [expressions] 42 arguments"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(new, create, declare)"}},{"v":"1","w":"2","value":{"label":"(function)"}},{"v":"2","w":"3","value":{"label":"({term})","store":"fnName"}},{"v":"3","w":"4","value":{"label":"({number})","store":"argsNumber"}},{"v":"4","w":"5","value":{"label":"(arguments)"}},{"v":"3","w":"6","value":{"label":"(return, returning)"}},{"v":"5","w":"6","value":{"label":"(return, returning)"}},{"v":"6","w":"7","value":{"label":"([expressions])","store":"returnValue"}}],"value":{"id":"function_declaration","label":"Creates a function","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","priority":"2","title":"Creates a function","desc":"Creates a function with the desired number of args and return value","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function FunctionDeclaration(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"FunctionDeclaration\"');\r\n const anything = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang];\r\n let { fnName, argsNumber, returnValue } = command;\r\n argsNumber = argsNumber != null ? parseInt(argsNumber, 10) : 0;\r\n let text = `function ${fnName}(`;\r\n if (argsNumber > 0) {\r\n text += new Array(argsNumber).fill(anything).join(', ');\r\n }\r\n text += ') {\\n';\r\n if (returnValue != null) {\r\n text += 'return ' + toValue(returnValue);\r\n }\r\n text += '\\n}';\r\n if (command.parent)\r\n return text;\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n await editor.indentSelection([line._line - 3, 0], [line._line + 3, 0]);\r\n return await editor.goToLine(line._line);\r\n}\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nexports.default = FunctionDeclaration;\r\n","phrases":["create function text","declare function number 1 arguments","new function text 1 arguments return [expressions]","create function graph return [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(go)"}},{"v":"1","w":"2","value":{"label":"(to)"}},{"v":"0","w":"3","value":{"label":"(line)"}},{"v":"1","w":"3","value":{"label":"(line)"}},{"v":"2","w":"3","value":{"label":"(line)"}},{"v":"3","w":"5","value":{"label":"(number)"}},{"v":"3","w":"4","value":{"label":"({number})","store":"line"}},{"v":"5","w":"4","value":{"label":"({number})","store":"line"}}],"value":{"id":"go_to_line","label":"Change line","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Change line","desc":"Moves the cursor to a different line","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function goToLine(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"goToLine.\"');\r\n return await editor.goToLine(command.line);\r\n}\r\nexports.default = goToLine;\r\n","phrases":["go to line 1","go to line number 1","go line 1","go line number 42","line 42","line number 1"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"},"parent":"sg21"},{"v":"1","value":{"shape":"doublecircle"}},{"v":"2","value":{"shape":"circle"},"parent":"sg21"},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"circle"}},{"v":"7","value":{"shape":"doublecircle"}},{"v":"sg21","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(and, or, equals)","store":"logicalOperator"}},{"v":"2","w":"1","value":{"label":"(and, or, equals)","store":"logicalOperator"}},{"v":"0","w":"2","value":{"label":"(not, negative)","store":"isNegative","normalizer":"boolean"}},{"v":"0","w":"3","value":{"label":"(less, greater)","store":"inequalityOperator"}},{"v":"2","w":"3","value":{"label":"(less, greater)","store":"inequalityOperator"}},{"v":"3","w":"4","value":{"label":"(or, λ)"}},{"v":"4","w":"5","value":{"label":"(equals)","store":"orEqual","normalizer":"boolean"}},{"v":"3","w":"7","value":{"label":"(than)"}},{"v":"5","w":"7","value":{"label":"(than)"}}],"value":{"id":"logical_operator","label":"Writes a logical operator","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","alias":"true","title":"Writes a logical operator","desc":"Writes a logical operator (===, !==, &&, ||, >, <, >=, <=) meant to be used inside expressions","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function LogicalOperator(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"LogicalOperator\"');\r\n const { logicalOperator, isNegative = false, inequalityOperator, orEqual = false } = command;\r\n if (logicalOperator !== undefined) {\r\n const operator = ['&&', '||', '==='][logicalOperator];\r\n return { operator, isNegative };\r\n }\r\n else if (inequalityOperator !== undefined) {\r\n const operator = ['<', '>'][inequalityOperator] + (orEqual ? '=' : '');\r\n return { operator, isNegative };\r\n }\r\n return { operator: 'error', isNegative: false };\r\n}\r\nexports.default = LogicalOperator;\r\n","phrases":["equals","not or","not less or equals than","negative greater than","greater equals than","greater than"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(plus, times, minus, divided)","store":"mathOperator"}}],"value":{"id":"math_operator","label":"Writes a math operator","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","alias":"true","title":"Writes a math operator","desc":"Writes a math operator (*, -, +, /) meant to be used inside expressions","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function MathOperator(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"MathOperator\"');\r\n const { mathOperator } = command;\r\n const operator = ['+', '*', '-', '/'][mathOperator] || 'error';\r\n return { operator };\r\n}\r\n// @ts-ignore\r\nexports.default = MathOperator;\r\n","phrases":["minus"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"3","value":{"label":"(*)"}},{"v":"3","w":"3","value":{"label":"({any})","store":"words"}},{"v":"3","w":"4","value":{"label":"(*)"}}],"value":{"id":"multi_word_token","label":"Group multiple words together","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","disableStopWords":"true","title":"Group multiple words together","desc":"Group multiple words together in one variable meant to be used as alias in other commands","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function MultiWordTokens(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"MultiWordTokens\"');\r\n function camelCase(words) {\r\n return words.map((a, i) => i ? a.charAt(0).toUpperCase() + a.slice(1) : a);\r\n }\r\n if (((_a = command.extra) === null || _a === void 0 ? void 0 : _a.case) === 'camel') {\r\n return camelCase(command.words);\r\n }\r\n return command.words;\r\n}\r\nexports.default = MultiWordTokens;\r\n","phrases":["* *"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"},"parent":"sg26"},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"},"parent":"sg28"},{"v":"5","value":{"shape":"circle"},"parent":"sg26"},{"v":"sg26","value":{"shape":"circle"}},{"v":"sg28","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(new)"}},{"v":"5","w":"1","value":{"label":"(new)"}},{"v":"1","w":"2","value":{"label":"(line)"}},{"v":"5","w":"2","value":{"label":"(line)"}},{"v":"2","w":"3","value":{"label":"(above, below)","store":"position"}},{"v":"4","w":"3","value":{"label":"(above, below)","store":"position"}},{"v":"0","w":"4","value":{"label":"(line)"}},{"v":"0","w":"5","value":{"label":"(create)"}},{"v":"5","w":"5","value":{"label":"(a)"}}],"value":{"id":"new_line","label":"New line","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"New line","desc":"Creates a new line above or below the current line","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function newLine(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"new line.\"');\r\n return await editor.newLine(command.position);\r\n}\r\nexports.default = newLine;\r\n","phrases":["new line","create new line","create line","new line below","line below","create new line below","create line below"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"2","value":{"label":"(number)"}},{"v":"2","w":"3","value":{"label":"({number})","store":"number"}},{"v":"0","w":"3","value":{"label":"({number})","store":"number"}}],"value":{"id":"number","label":"Writes a number","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","priority":"2","title":"Writes a number","desc":"Writes a number in the editor","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function WriteNumber(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"WriteNumber\"');\r\n const { number, parent } = command;\r\n if (parent)\r\n return number;\r\n return await editor.write(number);\r\n}\r\nexports.default = WriteNumber;\r\n","phrases":["number 1","42"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"circle"}},{"v":"8","value":{"shape":"doublecircle"}},{"v":"9","value":{"shape":"circle"}},{"v":"10","value":{"shape":"circle"}},{"v":"11","value":{"shape":"circle"}},{"v":"12","value":{"shape":"circle"}},{"v":"13","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(repetition)"}},{"v":"1","w":"2","value":{"label":"(statement)"}},{"v":"2","w":"9","value":{"label":"(for)"}},{"v":"9","w":"10","value":{"label":"(every)"}},{"v":"10","w":"11","value":{"label":"({term})","store":"item"}},{"v":"11","w":"12","value":{"label":"(of, λ)"}},{"v":"12","w":"13","value":{"label":"([expressions])","store":"collection"}},{"v":"2","w":"3","value":{"label":"(from)"}},{"v":"3","w":"4","value":{"label":"([expressions])","store":"from"}},{"v":"4","w":"5","value":{"label":"(to)"}},{"v":"5","w":"6","value":{"label":"([expressions])","store":"to"}},{"v":"6","w":"7","value":{"label":"(step)"}},{"v":"7","w":"8","value":{"label":"([expressions])","store":"step"}}],"value":{"id":"repetition","label":"Repetition Statement","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Creates a for loop statement","desc":"Creates a for loop statement with the provided expressions as parameters","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Repetition(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"Repetition.\"');\r\n const gap = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang][0];\r\n let text = `for(${gap}; ${gap}; ${gap}) {\\n\\n}`;\r\n if (command.from == undefined && command.item == undefined) {\r\n text = `for(${gap}; ${gap}; ${gap}) {\\n\\n}`;\r\n }\r\n else if (command.from != null && command.to != null) {\r\n const from = toValue(command.from);\r\n const to = toValue(command.to);\r\n const step = command.step ? toValue(command.step) : 'i + 1';\r\n text = `for(let i = ${from}; i < ${to}; i = ${step}) {\\n\\n}`;\r\n }\r\n else if (command.item != null && command.collection != null) {\r\n const item = command.item;\r\n const collection = toValue(command.collection);\r\n text = `for(const ${item} of ${collection}) {\\n\\n}`;\r\n }\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n await editor.indentSelection([line._line - 3, 0], [line._line + 3, 0]);\r\n return await editor.goToLine(line._line);\r\n}\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nexports.default = Repetition;\r\n","phrases":["repetition statement","repetition statement from [expressions] to [expressions]","repetition statement from [expressions] to [expressions] step [expressions]","repetition statement for every temp [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(run)"}},{"v":"1","w":"2","value":{"label":"(current, this)"}},{"v":"2","w":"3","value":{"label":"(file)"}}],"value":{"id":"run","label":"Run file","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Run current file","desc":"Run the current file in the terminal using node","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function run(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"run.\"');\r\n const info = await editor.fileInfo();\r\n return await editor.writeOnTerminal('node \"' + info.fileName + '\"');\r\n}\r\nexports.default = run;\r\n","phrases":["run this file"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"circle"}},{"v":"8","value":{"shape":"circle"}},{"v":"9","value":{"shape":"circle"}},{"v":"10","value":{"shape":"doublecircle"}},{"v":"11","value":{"shape":"circle"}},{"v":"12","value":{"shape":"circle"},"parent":"sg36"},{"v":"13","value":{"shape":"circle"}},{"v":"14","value":{"shape":"circle"}},{"v":"15","value":{"shape":"circle"}},{"v":"16","value":{"shape":"circle"}},{"v":"17","value":{"shape":"doublecircle"}},{"v":"18","value":{"shape":"circle"},"parent":"sg32"},{"v":"19","value":{"shape":"circle"}},{"v":"20","value":{"shape":"doublecircle"}},{"v":"sg32","value":{"shape":"circle"}},{"v":"sg36","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(select)"}},{"v":"1","w":"2","value":{"label":"(letter, symbol)"}},{"v":"18","w":"2","value":{"label":"(letter, symbol)"}},{"v":"2","w":"3","value":{"label":"({char})","store":"word"}},{"v":"1","w":"4","value":{"label":"(word)"}},{"v":"18","w":"4","value":{"label":"(word)"}},{"v":"4","w":"20","value":{"label":"([multi_word_token])","store":"word","extraArgs":"{\"case\": \"camel\"}"}},{"v":"4","w":"3","value":{"label":"({term})","store":"word"}},{"v":"1","w":"5","value":{"label":"(from)"}},{"v":"1","w":"18","value":{"label":"({ordinalNumber})","normalizer":"ordinalNumber","store":"wordPosition"}},{"v":"5","w":"13","value":{"label":"(line)","store":"selectLine"}},{"v":"13","w":"19","value":{"label":"(number)"}},{"v":"13","w":"14","value":{"label":"({number})","store":"from"}},{"v":"19","w":"14","value":{"label":"({number})","store":"from"}},{"v":"14","w":"15","value":{"label":"(to)"}},{"v":"15","w":"16","value":{"label":"(line, λ)"}},{"v":"16","w":"17","value":{"label":"({number})","store":"to"}},{"v":"5","w":"11","value":{"label":"({ordinalNumber})","normalizer":"ordinalNumber","store":"fromPosition"}},{"v":"5","w":"6","value":{"label":"(letter, symbol)"}},{"v":"11","w":"6","value":{"label":"(letter, symbol)"}},{"v":"6","w":"7","value":{"label":"({char})","store":"from"}},{"v":"7","w":"8","value":{"label":"(to)"}},{"v":"8","w":"9","value":{"label":"(letter, symbol, λ)"}},{"v":"12","w":"9","value":{"label":"(letter, symbol, λ)"}},{"v":"8","w":"12","value":{"label":"({ordinalNumber})","normalizer":"ordinalNumber","store":"toPosition"}},{"v":"9","w":"10","value":{"label":"({char})","store":"to"}}],"value":{"id":"select","label":"Select","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Select","desc":"Select a piece of the text in the current line","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Select(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"select\"');\r\n command.word = Array.isArray(command.word) ? command.word.join('') : command.word;\r\n if (command.selectLine != undefined) {\r\n return await editor.select(parseInt(command.from, 10), parseInt(command.to, 10), true);\r\n }\r\n else if (command.word != undefined) {\r\n const occurences = await editor.findPositionOf(command.word);\r\n let wordPosition = parseInt(command.wordPosition, 10) || 1;\r\n if (wordPosition === -1)\r\n wordPosition = occurences.length;\r\n if (occurences.length) {\r\n return await editor.select(occurences[wordPosition - 1][0], occurences[wordPosition - 1][1] - 1, false);\r\n }\r\n throw new Error('Nothing found for string: ' + command.word);\r\n }\r\n const from = command.from || '';\r\n const to = command.to || '';\r\n let fromPos = parseInt(command.fromPosition, 10) || 1;\r\n let toPos = parseInt(command.toPosition, 10) || 1;\r\n if (from === '' || to === '') {\r\n throw new Error('Invalid arguments!');\r\n }\r\n const matchFrom = await editor.findPositionOf(from);\r\n if (fromPos === -1)\r\n fromPos = matchFrom.length;\r\n const pad = matchFrom[fromPos - 1][1] || 0;\r\n const matchTo = await editor.findPositionOf(to, undefined, pad);\r\n if (toPos === -1)\r\n toPos = matchTo.length;\r\n return await editor.select(matchFrom[fromPos - 1][0], pad + matchTo[toPos - 1][0], false);\r\n}\r\nexports.default = Select;\r\n","phrases":["select symbol M","select word text","select last letter K","select 42ª word value","select from symbol g to symbol M","select from symbol M to last letter M","select from last letter K to letter g","select from fourth letter g to 1ª symbol K","select from line 42 to 42","select from line number 1 to line 42","select word [multi_word_token]","select 1ª word [multi_word_token]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"2","value":{"label":"(string, text)"}},{"v":"2","w":"2","value":{"label":"({any})","store":"string"}},{"v":"2","w":"4","value":{"label":"(string, text)"}}],"value":{"id":"string","label":"Writes a string","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","disableStopWords":"true","priority":"2","title":"Writes a string","desc":"Writes a string in the editor","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function WriteString(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"WriteString\"');\r\n command.string = Array.isArray(command.string) ? command.string : [command.string];\r\n const text = '\"' + command.string.join(' ') + '\"';\r\n if (command.parent)\r\n return text;\r\n return await editor.write(text);\r\n}\r\nexports.default = WriteString;\r\n","phrases":["text text"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(new, declare, create)","store":"isNew","normalizer":"boolean"}},{"v":"0","w":"2","value":{"label":"(variable, constant)","store":"memType"}},{"v":"1","w":"2","value":{"label":"(variable, constant)","store":"memType"}},{"v":"2","w":"3","value":{"label":"(called, named)"}},{"v":"3","w":"4","value":{"label":"([multi_word_token])","store":"varName","extraArgs":"{\"case\": \"camel\"}"}},{"v":"2","w":"7","value":{"label":"({term})","store":"varName"}},{"v":"3","w":"7","value":{"label":"({term})","store":"varName"}},{"v":"4","w":"5","value":{"label":"(equals)"}},{"v":"7","w":"5","value":{"label":"(equals)"}},{"v":"5","w":"6","value":{"label":"([expressions])","store":"expression"}}],"value":{"id":"variable_assignment","label":"Stores a value in a variable","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"Stores a value in a variable","desc":"Stores a number, string etc in a variable","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function NewVariable(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"NewVariable\"');\r\n let { isNew, varName, expression, memType } = command;\r\n const value = typeof expression === 'string' ? expression : expression === null || expression === void 0 ? void 0 : expression.value;\r\n const allocate = memType === 0 ? 'let ' : 'const ';\r\n varName = Array.isArray(varName) ? varName.join('') : varName;\r\n const text = `${isNew ? allocate : ''}${varName}${value ? ` = ${value}` : ''}`;\r\n await editor.write(text);\r\n if (typeof expression !== 'string') {\r\n const pos = await editor.findPositionOf(expression.value);\r\n if (pos.length) {\r\n return await editor.select(pos[0][0], pos[0][1] - 1, false);\r\n }\r\n }\r\n return undefined;\r\n}\r\nexports.default = NewVariable;\r\n","phrases":["new constant called [multi_word_token]","constant named [multi_word_token]","create constant named [multi_word_token] equals [expressions]","create variable called a equals [expressions]","create variable number equals [expressions]","variable named [multi_word_token] equals [expressions]","constant named a equals [expressions]","variable number equals [expressions]","new variable named temp","new variable temp","constant called value","constant value"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(reference)"}},{"v":"0","w":"2","value":{"label":"(variable, constant)"}},{"v":"1","w":"2","value":{"label":"(variable, constant)"}},{"v":"0","w":"6","value":{"label":"(namespace)","store":"isNamespace","normalizer":"boolean"}},{"v":"1","w":"6","value":{"label":"(namespace)","store":"isNamespace","normalizer":"boolean"}},{"v":"6","w":"2","value":{"label":"(λ)"}},{"v":"2","w":"4","value":{"label":"(called)"}},{"v":"2","w":"3","value":{"label":"({term})","store":"varName"}},{"v":"4","w":"5","value":{"label":"([multi_word_token])","store":"varName","extraArgs":"{\"case\": \"camel\"}"}}],"value":{"id":"variable_reference","label":"References a variable","lang":"en-US","langName":"English","pad":"0.2","rankdir":"LR","title":"References a variable","desc":"Writes a variable or constant in the editor","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function VariableReference(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"VariableReference\"');\r\n let { varName, parent, isNamespace = false } = command;\r\n varName = Array.isArray(varName) ? varName : [varName];\r\n varName = isNamespace ? varName.map(a => a[0].toUpperCase() + a.substr(1)).join('') : varName.join('');\r\n if (parent)\r\n return varName;\r\n return await editor.write(varName);\r\n}\r\nexports.default = VariableReference;\r\n","phrases":["reference constant temp","reference namespace a","constant a","namespace graph","reference variable called [multi_word_token]","reference namespace called [multi_word_token]","constant called [multi_word_token]","namespace called [multi_word_token]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"doublecircle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(print)"}},{"v":"0","w":"2","value":{"label":"(write)"}},{"v":"2","w":"1","value":{"label":"(down, λ)"}},{"v":"2","w":"3","value":{"label":"(it)"}},{"v":"3","w":"1","value":{"label":"(down, λ)"}},{"v":"1","w":"4","value":{"label":"(space)","store":"isSpace","normalizer":"boolean"}},{"v":"1","w":"5","value":{"label":"({any})","store":"text"}},{"v":"5","w":"5","value":{"label":"({any})","store":"text"}}],"value":{"id":"write","label":"Write text","lang":"en-US","langName":"English","pad":"0.2","disableStopWords":"true","rankdir":"LR","title":"Write text","desc":"Write some text in the editor","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function write(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"write.\"');\r\n const text = command.isSpace ? ' ' : Array.isArray(command.text) ? (_a = command.text) === null || _a === void 0 ? void 0 : _a.join(' ') : command.text;\r\n return await editor.write(text);\r\n}\r\nexports.default = write;\r\n","phrases":["print","write down","write it down","print space","write space","write it down space","print the universe is cracked the universe is cracked","write who are you the universe is cracked","write it down the universe is cracked the universe is cracked"]}}],"pt-BR":[{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(estrutura)"}},{"v":"1","w":"2","value":{"label":"(condicional)"}},{"v":"2","w":"3","value":{"label":"(se)","disableSpellcheck":"true"}},{"v":"2","w":"7","value":{"label":"([expressions])","store":"condition"}},{"v":"3","w":"7","value":{"label":"([expressions])","store":"condition"}},{"v":"3","w":"6","value":{"label":"(se)","disableSpellcheck":"true"}},{"v":"6","w":"4","value":{"label":"(não)","store":"otherwise","normalizer":"boolean","disableSpellcheck":"true"}},{"v":"3","w":"4","value":{"label":"(senão, sinal)","store":"otherwise","normalizer":"boolean","disableSpellcheck":"true"}},{"v":"4","w":"5","value":{"label":"([expressions])","store":"condition"}}],"value":{"id":"condition","label":"Estrutura condicional","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Estrutura condicional","desc":"Cria uma estrutura condicional if/else","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Condition(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"Condition.\"');\r\n const anything = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang][0];\r\n let { condition = anything, otherwise = false } = command;\r\n condition = typeof condition === 'string' ? condition : condition === null || condition === void 0 ? void 0 : condition.value;\r\n let text = `if(${condition}) {\\n\\n}${otherwise ? ' else {\\n\\n}' : ''}`;\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n await editor.indentSelection([line._line - 3, 0], [line._line + (otherwise ? 8 : 3), 0]);\r\n await editor.goToLine(line._line);\r\n return null;\r\n}\r\nexports.default = Condition;\r\n","phrases":["estrutura condicional","estrutura condicional se","estrutura condicional se senão","estrutura condicional se se não","estrutura condicional se senão [expressions]","estrutura condicional se se não [expressions]","estrutura condicional se [expressions]","estrutura condicional [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"circle"},"parent":"sg5"},{"v":"8","value":{"shape":"circle"}},{"v":"10","value":{"shape":"doublecircle"}},{"v":"11","value":{"shape":"circle"}},{"v":"12","value":{"shape":"doublecircle"}},{"v":"13","value":{"shape":"circle"}},{"v":"sg5","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(cursor, ponteiro)"}},{"v":"1","w":"2","value":{"label":"(linha)"}},{"v":"2","w":"3","value":{"label":"({number})","store":"line"}},{"v":"1","w":"5","value":{"label":"(símbolo, letra)"}},{"v":"7","w":"5","value":{"label":"(símbolo, letra)"}},{"v":"1","w":"7","value":{"label":"({ordinalNumber})","store":"leapSize","normalizer":"ordinalNumber"}},{"v":"5","w":"6","value":{"label":"({char})","store":"symbol"}},{"v":"1","w":"8","value":{"label":"(começo, final)","store":"linePosition"}},{"v":"8","w":"10","value":{"label":"(linha)"}},{"v":"1","w":"11","value":{"label":"(próximo)"}},{"v":"11","w":"13","value":{"label":"({number})","store":"leapSize"}},{"v":"11","w":"12","value":{"label":"(símbolo, letra)"}},{"v":"13","w":"12","value":{"label":"(símbolo, letra)"}}],"value":{"id":"cursor","label":"Mover o cursor","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Mover o cursor","desc":"Move o cursor para uma linha ou símbolo","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function cursor(args, editor, context) {\r\n console.log('[Spoken]: Executing: \"cursor.\"');\r\n if (args.linePosition != null) {\r\n const pos = args.linePosition === LinePostionEnum.BEGIN ? 'BEGIN_LINE' : 'END_LINE';\r\n return await editor.moveCursorTo(pos);\r\n }\r\n else if (args.line) {\r\n return await editor.goToLine(args.line);\r\n }\r\n else if (!args.symbol) {\r\n const nth = parseInt(args.leapSize || '1', 10);\r\n return await editor.moveCursorTo(null, undefined, nth);\r\n }\r\n else {\r\n if (args.leapSize == undefined)\r\n args.leapSize = '1';\r\n const nth = parseInt(args.leapSize || '1', 10);\r\n return await editor.moveCursorTo('SYMBOL', args.symbol, nth);\r\n }\r\n return await editor.moveCursorTo('BEGIN_LINE');\r\n}\r\nvar LinePostionEnum;\r\n(function (LinePostionEnum) {\r\n LinePostionEnum[LinePostionEnum[\"BEGIN\"] = 0] = \"BEGIN\";\r\n LinePostionEnum[LinePostionEnum[\"END\"] = 1] = \"END\";\r\n})(LinePostionEnum || (LinePostionEnum = {}));\r\nexports.default = cursor;\r\n","phrases":["ponteiro linha 1","cursor símbolo A","ponteiro 42ª símbolo a","cursor começo linha","ponteiro próximo letra","cursor próximo 1 letra"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(expressão)"}},{"v":"1","w":"2","value":{"label":"([expressions])","store":"left"}},{"v":"2","w":"3","value":{"label":"([math_operator], [logical_operator])","store":"operation"}},{"v":"4","w":"3","value":{"label":"([math_operator], [logical_operator])","store":"operation"}},{"v":"3","w":"4","value":{"label":"([expressions])","store":"right"}}],"value":{"id":"elementar_math_op","label":"Operação Matemática Elementar","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","disableStopWords":"true","priority":"2","title":"Escreve uma operação matemática elementar","desc":"Escreve uma operação matemática elementar (*, -, +, /)","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function WriteElementarMathOperation(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"WriteElementarMathOperation\"');\r\n let operation = toArray(command.operation);\r\n let right = toArray(command.right);\r\n let text = toValue(command.left);\r\n for (let i = 0; i < right.length; i++) {\r\n if (operation[i].isNegative) {\r\n if (operation[i].operator === '===')\r\n text += ' !== ' + toValue(right[i]);\r\n else\r\n text = '!(' + text + ' ' + operation[i].operator + ' ' + toValue(right[i]) + ')';\r\n }\r\n else {\r\n text += ' ' + operation[i].operator + ' ' + toValue(right[i]);\r\n }\r\n }\r\n if (command.parent)\r\n return text;\r\n await editor.write(text);\r\n const wildcard = [command.left, ...right].find(item => typeof item !== 'string');\r\n if (wildcard) {\r\n const pos = await editor.findPositionOf(wildcard.value);\r\n if (pos.length) {\r\n return await editor.select(pos[0][0], pos[0][1] - 1, false);\r\n }\r\n }\r\n return undefined;\r\n}\r\nconst toArray = (arg) => Array.isArray(arg) ? arg : [arg];\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nexports.default = WriteElementarMathOperation;\r\n","phrases":["expressão [expressions] [logical_operator] [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"doublecircle"}},{"v":"2","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"([number], [string], [variable_reference], [elementar_math_op], [function_call])","store":"expression"}},{"v":"0","w":"2","value":{"label":"(gap)","store":"wildCard","normalizer":"identity"}}],"value":{"id":"expressions","label":"Escreve uma expressão","lang":"pt-BR","langName":"Português","pad":"0.2","nodesep":"1","ranksep":"2","rankdir":"LR","alias":"true","title":"Escreve uma expressão","desc":"Escreve uma expressão no editor de texto, esse automata foi projetado para ser usado em outros automatas","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Expression(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"Expression\"');\r\n const { expression, parent, wildCard } = command;\r\n if (parent) {\r\n return expression ? expression : { value: wildCard, isWildCard: true };\r\n }\r\n return await editor.write(expression || wildCard);\r\n}\r\nexports.default = Expression;\r\n","phrases":["[number]","gap"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"doublecircle"}},{"v":"8","value":{"shape":"circle"}},{"v":"9","value":{"shape":"circle"}},{"v":"10","value":{"shape":"doublecircle"}},{"v":"11","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(chame, chamar, execute)"}},{"v":"1","w":"2","value":{"label":"(função)"}},{"v":"2","w":"3","value":{"label":"([multi_word_token])","store":"functionName","extraArgs":"{\"case\": \"camel\"}"}},{"v":"3","w":"4","value":{"label":"(λ)"}},{"v":"2","w":"4","value":{"label":"({term})","store":"functionName"}},{"v":"4","w":"11","value":{"label":"(da, na)"}},{"v":"4","w":"5","value":{"label":"([expressions])","store":"caller"}},{"v":"11","w":"5","value":{"label":"([expressions])","store":"caller"}},{"v":"4","w":"6","value":{"label":"(argumentos)"}},{"v":"5","w":"6","value":{"label":"(argumentos)"}},{"v":"6","w":"7","value":{"label":"([expressions])","store":"args"}},{"v":"7","w":"8","value":{"label":"(e)"}},{"v":"8","w":"7","value":{"label":"([expressions])","store":"args"}},{"v":"4","w":"9","value":{"label":"({number})","store":"argsNumber"}},{"v":"5","w":"9","value":{"label":"({number})","store":"argsNumber"}},{"v":"9","w":"10","value":{"label":"(argumentos)"}}],"value":{"id":"function_call","label":"Chama uma função","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","priority":"2","title":"Chama uma função","desc":"Chama uma função com os determinados argumentos no determinado caller","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function FunctionCall(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"FunctionCall\"');\r\n const anything = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang];\r\n const functionName = join(command.functionName);\r\n const argsNumber = command.argsNumber ? parseInt(command.argsNumber, 10) : command.oneArg ? 1 : NaN;\r\n const args = command.args ? toArray(command.args) : [];\r\n const caller = command.caller ? toValue(command.caller) : null;\r\n let text = functionName + '(';\r\n if (argsNumber) {\r\n text += new Array(argsNumber).fill(anything).join(', ');\r\n }\r\n else if (args.length) {\r\n text += (args.map(item => typeof item === 'string' ? item : anything).join(', '));\r\n }\r\n text += ')';\r\n if (caller)\r\n text = caller + '.' + text;\r\n if (command.parent)\r\n return text;\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n return await editor.indentSelection([line._line - 1, 0], [line._line - 1, line.character]);\r\n}\r\nconst toArray = (arg) => Array.isArray(arg) ? arg : [arg];\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nconst join = (item) => typeof item === 'string' ? item : item.join('');\r\nexports.default = FunctionCall;\r\n","phrases":["chame função [multi_word_token]","execute função valor","chamar função [multi_word_token] [expressions]","chamar função [multi_word_token] na [expressions]","execute função temp [expressions]","chamar função valor na [expressions]","chamar função [multi_word_token] [expressions] argumentos [expressions]","chamar função [multi_word_token] argumentos [expressions]","chame função [multi_word_token] na [expressions] argumentos [expressions]","execute função lista [expressions] argumentos [expressions]","chamar função texto argumentos [expressions]","chamar função valor na [expressions] argumentos [expressions]","chame função [multi_word_token] [expressions] 42 argumentos","execute função [multi_word_token] 42 argumentos","execute função [multi_word_token] da [expressions] 42 argumentos","chamar função texto [expressions] 42 argumentos"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(nova, declare, crie)"}},{"v":"1","w":"2","value":{"label":"(função)"}},{"v":"2","w":"3","value":{"label":"({term})","store":"fnName"}},{"v":"3","w":"4","value":{"label":"({number})","store":"argsNumber"}},{"v":"4","w":"5","value":{"label":"(argumentos)"}},{"v":"3","w":"6","value":{"label":"(retorna, retornando)"}},{"v":"5","w":"6","value":{"label":"(retorna, retornando)"}},{"v":"6","w":"7","value":{"label":"([expressions])","store":"returnValue"}}],"value":{"id":"function_declaration","label":"Cria uma função","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","priority":"2","title":"Cria uma função","desc":"Cria uma função com o número de argumentos especificados e um valor de retorno","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function FunctionDeclaration(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"FunctionDeclaration\"');\r\n const anything = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang];\r\n let { fnName, argsNumber, returnValue } = command;\r\n argsNumber = argsNumber != null ? parseInt(argsNumber, 10) : 0;\r\n let text = `function ${fnName}(`;\r\n if (argsNumber > 0) {\r\n text += new Array(argsNumber).fill(anything).join(', ');\r\n }\r\n text += ') {\\n';\r\n if (returnValue != null) {\r\n text += 'return ' + toValue(returnValue);\r\n }\r\n text += '\\n}';\r\n if (command.parent)\r\n return text;\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n await editor.indentSelection([line._line - 3, 0], [line._line + 3, 0]);\r\n return await editor.goToLine(line._line);\r\n}\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nexports.default = FunctionDeclaration;\r\n","phrases":["nova função lista","crie função lista 42 argumentos","nova função temp 1 argumentos retornando [expressions]","crie função temp retornando [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(vá, vai)"}},{"v":"1","w":"2","value":{"label":"(para)"}},{"v":"2","w":"5","value":{"label":"(a)"}},{"v":"0","w":"3","value":{"label":"(linha)"}},{"v":"1","w":"3","value":{"label":"(linha)"}},{"v":"2","w":"3","value":{"label":"(linha)"}},{"v":"5","w":"3","value":{"label":"(linha)"}},{"v":"3","w":"6","value":{"label":"(número)"}},{"v":"3","w":"4","value":{"label":"({number})","store":"line"}},{"v":"6","w":"4","value":{"label":"({number})","store":"line"}}],"value":{"id":"go_to_line","label":"Trocar linha","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Trocar linha","desc":"Move or cursor para uma linha diferente","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function goToLine(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"goToLine.\"');\r\n return await editor.goToLine(command.line);\r\n}\r\nexports.default = goToLine;\r\n","phrases":["vá para linha 1","vá para linha número 1","vai para a linha 1","vá para a linha número 1","vai linha 42","vá linha número 1","linha 1","linha número 1"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"},"parent":"sg24"},{"v":"1","value":{"shape":"doublecircle"}},{"v":"2","value":{"shape":"circle"},"parent":"sg24"},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"doublecircle"}},{"v":"sg24","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(e, ou, igual)","store":"logicalOperator"}},{"v":"2","w":"1","value":{"label":"(e, ou, igual)","store":"logicalOperator"}},{"v":"0","w":"2","value":{"label":"(não, negativo)","store":"isNegative","normalizer":"boolean"}},{"v":"0","w":"3","value":{"label":"(menor, maior)","store":"inequalityOperator","disableSpellcheck":"true"}},{"v":"2","w":"3","value":{"label":"(menor, maior)","store":"inequalityOperator","disableSpellcheck":"true"}},{"v":"3","w":"4","value":{"label":"(ou)"}},{"v":"4","w":"5","value":{"label":"(igual)","store":"orEqual","normalizer":"boolean"}},{"v":"3","w":"7","value":{"label":"(que)"}},{"v":"5","w":"7","value":{"label":"(a)"}}],"value":{"id":"logical_operator","label":"Escreve um operador lógico","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","alias":"true","title":"Escreve um operador lógico","desc":"Escreve um operador lógico (===, !==, &&, ||, >, <, >=, <=) pensando para ser usado com expressões","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function LogicalOperator(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"LogicalOperator\"');\r\n const { logicalOperator, isNegative = false, inequalityOperator, orEqual = false } = command;\r\n if (logicalOperator !== undefined) {\r\n const operator = ['&&', '||', '==='][logicalOperator];\r\n return { operator, isNegative };\r\n }\r\n else if (inequalityOperator !== undefined) {\r\n const operator = ['<', '>'][inequalityOperator] + (orEqual ? '=' : '');\r\n return { operator, isNegative };\r\n }\r\n return { operator: 'error', isNegative: false };\r\n}\r\nexports.default = LogicalOperator;\r\n","phrases":["ou","não igual","não maior ou igual","menor ou igual","não menor ou igual a","negativo maior que","menor ou igual a","menor que"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(mais, vezes, menos, dividido)","store":"mathOperator","disableSpellcheck":"true"}}],"value":{"id":"math_operator","label":"Escreve um operador matemático","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","alias":"true","title":"Escreve uma operador matemático","desc":"Escreve um operador matemático (*, -, +, /) pensando para ser usado com expressões","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function MathOperator(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"MathOperator\"');\r\n const { mathOperator } = command;\r\n const operator = ['+', '*', '-', '/'][mathOperator] || 'error';\r\n return { operator };\r\n}\r\n// @ts-ignore\r\nexports.default = MathOperator;\r\n","phrases":["vezes"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"3","value":{"label":"(*)"}},{"v":"3","w":"3","value":{"label":"({any})","store":"words"}},{"v":"3","w":"4","value":{"label":"(*)"}}],"value":{"id":"multi_word_token","label":"Agrupa múltiplas palavras","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","disableStopWords":"true","title":"Agrupa múltiplas palavras","desc":"Agrupa múltiplas palavras juntas, projetado para ser usado dentro de outros automatas","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function MultiWordTokens(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"MultiWordTokens\"');\r\n function camelCase(words) {\r\n return words.map((a, i) => i ? a.charAt(0).toUpperCase() + a.slice(1) : a);\r\n }\r\n if (((_a = command.extra) === null || _a === void 0 ? void 0 : _a.case) === 'camel') {\r\n return camelCase(command.words);\r\n }\r\n return command.words;\r\n}\r\nexports.default = MultiWordTokens;\r\n","phrases":["* *"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"},"parent":"sg29"},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"},"parent":"sg31"},{"v":"5","value":{"shape":"circle"},"parent":"sg29"},{"v":"sg29","value":{"shape":"circle"}},{"v":"sg31","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(nova)"}},{"v":"5","w":"1","value":{"label":"(nova)"}},{"v":"1","w":"2","value":{"label":"(linha)"}},{"v":"5","w":"2","value":{"label":"(linha)"}},{"v":"2","w":"3","value":{"label":"(acima, abaixo)","store":"position"}},{"v":"4","w":"3","value":{"label":"(acima, abaixo)","store":"position"}},{"v":"0","w":"4","value":{"label":"(linha)"}},{"v":"0","w":"5","value":{"label":"(crie)"}},{"v":"5","w":"5","value":{"label":"(uma)"}},{"v":"4","w":"2","value":{"label":"(nova)"}}],"value":{"id":"new_line","label":"Linha nova","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Linha nova","desc":"Cria uma linha nova abaixo ou acima da linha atual","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function newLine(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"new line.\"');\r\n return await editor.newLine(command.position);\r\n}\r\nexports.default = newLine;\r\n","phrases":["nova linha","linha nova","crie nova linha","crie linha","nova linha acima","linha nova acima","linha abaixo","crie nova linha abaixo","crie linha acima"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"2","value":{"label":"(número)"}},{"v":"2","w":"3","value":{"label":"({number})","store":"number"}}],"value":{"id":"number","label":"Escreve um número","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","priority":"2","title":"Escreve um número","desc":"Escreve um número no editor","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function WriteNumber(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"WriteNumber\"');\r\n const { number, parent } = command;\r\n if (parent)\r\n return number;\r\n return await editor.write(number);\r\n}\r\nexports.default = WriteNumber;\r\n","phrases":["número 42"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"circle"}},{"v":"8","value":{"shape":"doublecircle"}},{"v":"9","value":{"shape":"circle"}},{"v":"10","value":{"shape":"circle"}},{"v":"11","value":{"shape":"circle"}},{"v":"12","value":{"shape":"circle"}},{"v":"13","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(estrutura)"}},{"v":"1","w":"1","value":{"label":"(de)"}},{"v":"1","w":"2","value":{"label":"(repetição)"}},{"v":"2","w":"9","value":{"label":"(para)"}},{"v":"9","w":"10","value":{"label":"(todo)"}},{"v":"10","w":"11","value":{"label":"({term})","store":"item"}},{"v":"11","w":"12","value":{"label":"(de, da, do, em, λ)"}},{"v":"12","w":"13","value":{"label":"([expressions])","store":"collection"}},{"v":"2","w":"3","value":{"label":"(de, da, do, λ)"}},{"v":"3","w":"4","value":{"label":"([expressions])","store":"from"}},{"v":"4","w":"5","value":{"label":"(até)"}},{"v":"5","w":"6","value":{"label":"([expressions])","store":"to"}},{"v":"6","w":"7","value":{"label":"(etapa)"}},{"v":"7","w":"8","value":{"label":"([expressions])","store":"step"}}],"value":{"id":"repetition","label":"Estrutura de repetição","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Estrutura de repetição","desc":"Cria uma estrutura de repetição for","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Repetition(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"Repetition.\"');\r\n const gap = context.templates['@anything'].examples[(_a = command === null || command === void 0 ? void 0 : command.extra) === null || _a === void 0 ? void 0 : _a.lang][0];\r\n let text = `for(${gap}; ${gap}; ${gap}) {\\n\\n}`;\r\n if (command.from == undefined && command.item == undefined) {\r\n text = `for(${gap}; ${gap}; ${gap}) {\\n\\n}`;\r\n }\r\n else if (command.from != null && command.to != null) {\r\n const from = toValue(command.from);\r\n const to = toValue(command.to);\r\n const step = command.step ? toValue(command.step) : 'i + 1';\r\n text = `for(let i = ${from}; i < ${to}; i = ${step}) {\\n\\n}`;\r\n }\r\n else if (command.item != null && command.collection != null) {\r\n const item = command.item;\r\n const collection = toValue(command.collection);\r\n text = `for(const ${item} of ${collection}) {\\n\\n}`;\r\n }\r\n const line = await editor.getLine();\r\n await editor.write(text);\r\n await editor.indentSelection([line._line - 3, 0], [line._line + 3, 0]);\r\n return await editor.goToLine(line._line);\r\n}\r\nconst toValue = (item) => typeof item === 'string' ? item : item.value;\r\nexports.default = Repetition;\r\n","phrases":["estrutura repetição","estrutura repetição da [expressions] até [expressions]","estrutura repetição do [expressions] até [expressions] etapa [expressions]","estrutura repetição para todo numero do [expressions]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(execute, executar)"}},{"v":"1","w":"4","value":{"label":"(este)"}},{"v":"4","w":"3","value":{"label":"(arquivo)"}},{"v":"1","w":"2","value":{"label":"(arquivo)"}},{"v":"2","w":"3","value":{"label":"(atual)"}}],"value":{"id":"run","label":"Executar arquivo","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Executar arquivo","desc":"Executa o arquivo atual no terminal usando node","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function run(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"run.\"');\r\n const info = await editor.fileInfo();\r\n return await editor.writeOnTerminal('node \"' + info.fileName + '\"');\r\n}\r\nexports.default = run;\r\n","phrases":["execute arquivo atual","executar este arquivo"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"circle"}},{"v":"7","value":{"shape":"circle"}},{"v":"8","value":{"shape":"circle"}},{"v":"9","value":{"shape":"circle"}},{"v":"10","value":{"shape":"doublecircle"}},{"v":"11","value":{"shape":"circle"}},{"v":"12","value":{"shape":"circle"},"parent":"sg41"},{"v":"13","value":{"shape":"circle"}},{"v":"14","value":{"shape":"circle"}},{"v":"15","value":{"shape":"circle"}},{"v":"16","value":{"shape":"circle"}},{"v":"17","value":{"shape":"doublecircle"}},{"v":"18","value":{"shape":"circle"},"parent":"sg37"},{"v":"19","value":{"shape":"circle"}},{"v":"20","value":{"shape":"doublecircle"}},{"v":"sg37","value":{"shape":"circle"}},{"v":"sg41","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(selecione, selecionar)"}},{"v":"1","w":"2","value":{"label":"(letra, símbolo)"}},{"v":"18","w":"2","value":{"label":"(letra, símbolo)"}},{"v":"2","w":"3","value":{"label":"({char})","store":"word"}},{"v":"1","w":"4","value":{"label":"(palavra)"}},{"v":"18","w":"4","value":{"label":"(palavra)"}},{"v":"4","w":"20","value":{"label":"([multi_word_token])","store":"word","extraArgs":"{\"case\": \"camel\"}"}},{"v":"4","w":"3","value":{"label":"({term})","store":"word"}},{"v":"1","w":"5","value":{"label":"(de, da)"}},{"v":"1","w":"18","value":{"label":"({ordinalNumber})","normalizer":"ordinalNumber","store":"wordPosition"}},{"v":"5","w":"13","value":{"label":"(linha)","store":"selectLine"}},{"v":"13","w":"19","value":{"label":"(número)"}},{"v":"13","w":"14","value":{"label":"({number})","store":"from"}},{"v":"19","w":"14","value":{"label":"({number})","store":"from"}},{"v":"14","w":"15","value":{"label":"(até)"}},{"v":"15","w":"16","value":{"label":"(linha, λ)"}},{"v":"16","w":"17","value":{"label":"({number})","store":"to"}},{"v":"5","w":"11","value":{"label":"({ordinalNumber})","normalizer":"ordinalNumber","store":"fromPosition"}},{"v":"5","w":"6","value":{"label":"(letra, símbolo)"}},{"v":"11","w":"6","value":{"label":"(letra, símbolo)"}},{"v":"6","w":"7","value":{"label":"({char})","store":"from"}},{"v":"7","w":"8","value":{"label":"(até)"}},{"v":"8","w":"9","value":{"label":"(letra, símbolo, λ)"}},{"v":"12","w":"9","value":{"label":"(letra, símbolo, λ)"}},{"v":"8","w":"12","value":{"label":"({ordinalNumber})","normalizer":"ordinalNumber","store":"toPosition"}},{"v":"9","w":"10","value":{"label":"({char})","store":"to"}}],"value":{"id":"select","label":"Selecionar","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Selecionar","desc":"Seleciona um pedaço de texto na linha atual","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function Select(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"select\"');\r\n command.word = Array.isArray(command.word) ? command.word.join('') : command.word;\r\n if (command.selectLine != undefined) {\r\n return await editor.select(parseInt(command.from, 10), parseInt(command.to, 10), true);\r\n }\r\n else if (command.word != undefined) {\r\n const occurences = await editor.findPositionOf(command.word);\r\n let wordPosition = parseInt(command.wordPosition, 10) || 1;\r\n if (wordPosition === -1)\r\n wordPosition = occurences.length;\r\n if (occurences.length) {\r\n return await editor.select(occurences[wordPosition - 1][0], occurences[wordPosition - 1][1] - 1, false);\r\n }\r\n throw new Error('Nothing found for string: ' + command.word);\r\n }\r\n const from = command.from || '';\r\n const to = command.to || '';\r\n let fromPos = parseInt(command.fromPosition, 10) || 1;\r\n let toPos = parseInt(command.toPosition, 10) || 1;\r\n if (from === '' || to === '') {\r\n throw new Error('Invalid arguments!');\r\n }\r\n const matchFrom = await editor.findPositionOf(from);\r\n if (fromPos === -1)\r\n fromPos = matchFrom.length;\r\n const pad = matchFrom[fromPos - 1][1] || 0;\r\n const matchTo = await editor.findPositionOf(to, undefined, pad);\r\n if (toPos === -1)\r\n toPos = matchTo.length;\r\n return await editor.select(matchFrom[fromPos - 1][0], pad + matchTo[toPos - 1][0], false);\r\n}\r\nexports.default = Select;\r\n","phrases":["selecionar letra z","selecionar palavra valor","selecione 1ª letra a","selecionar 1ª palavra texto","selecione da letra a até letra z","selecionar de letra B até 42ª a","selecionar da primeiro letra a até letra z","selecionar da 1ª letra z até 42ª letra a","selecione da linha 42 até linha 1","selecionar de linha número 1 até linha 42","selecione palavra [multi_word_token]","selecione 42ª palavra [multi_word_token]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"2","value":{"label":"(string, text)"}},{"v":"2","w":"2","value":{"label":"({any})","store":"string"}},{"v":"2","w":"4","value":{"label":"(string, text)"}}],"value":{"id":"string","label":"Escreve uma string","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","disableStopWords":"true","priority":"2","title":"Escreve uma string","desc":"Escreve uma string no editor","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function WriteString(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"WriteString\"');\r\n command.string = Array.isArray(command.string) ? command.string : [command.string];\r\n const text = '\"' + command.string.join(' ') + '\"';\r\n if (command.parent)\r\n return text;\r\n return await editor.write(text);\r\n}\r\nexports.default = WriteString;\r\n","phrases":["text string"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"circle"}},{"v":"4","value":{"shape":"doublecircle"}},{"v":"5","value":{"shape":"circle"}},{"v":"6","value":{"shape":"doublecircle"}},{"v":"7","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(nova, declare, crie)","store":"isNew","normalizer":"boolean"}},{"v":"0","w":"2","value":{"label":"(variável, constante)","store":"memType"}},{"v":"1","w":"2","value":{"label":"(variável, constante)","store":"memType"}},{"v":"2","w":"3","value":{"label":"(chamada)"}},{"v":"3","w":"4","value":{"label":"([multi_word_token])","store":"varName","extraArgs":"{\"case\": \"camel\"}"}},{"v":"2","w":"7","value":{"label":"({term})","store":"varName"}},{"v":"3","w":"7","value":{"label":"({term})","store":"varName"}},{"v":"4","w":"5","value":{"label":"(igual)"}},{"v":"7","w":"5","value":{"label":"(igual)"}},{"v":"5","w":"6","value":{"label":"([expressions])","store":"expression"}}],"value":{"id":"variable_assignment","label":"Guarda um valor em uma variável","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Guarda um valor em uma variável","desc":"Guarda um valor, inteiro, texto e etc em uma variável","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function NewVariable(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"NewVariable\"');\r\n let { isNew, varName, expression, memType } = command;\r\n const value = typeof expression === 'string' ? expression : expression === null || expression === void 0 ? void 0 : expression.value;\r\n const allocate = memType === 0 ? 'let ' : 'const ';\r\n varName = Array.isArray(varName) ? varName.join('') : varName;\r\n const text = `${isNew ? allocate : ''}${varName}${value ? ` = ${value}` : ''}`;\r\n await editor.write(text);\r\n if (typeof expression !== 'string') {\r\n const pos = await editor.findPositionOf(expression.value);\r\n if (pos.length) {\r\n return await editor.select(pos[0][0], pos[0][1] - 1, false);\r\n }\r\n }\r\n return undefined;\r\n}\r\nexports.default = NewVariable;\r\n","phrases":["nova constante chamada [multi_word_token]","variável chamada [multi_word_token]","nova constante chamada [multi_word_token] igual [expressions]","declare constante chamada lista igual [expressions]","declare constante lista igual [expressions]","variável chamada [multi_word_token] igual [expressions]","constante chamada lista igual [expressions]","variável a igual [expressions]","declare variável chamada valor","declare variável a","constante chamada valor","variável lista"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"circle"}},{"v":"2","value":{"shape":"circle"}},{"v":"3","value":{"shape":"doublecircle"}},{"v":"4","value":{"shape":"circle"}},{"v":"5","value":{"shape":"doublecircle"}},{"v":"6","value":{"shape":"circle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(referência, refira)"}},{"v":"0","w":"2","value":{"label":"(variável, constante)"}},{"v":"1","w":"2","value":{"label":"(variável, constante)"}},{"v":"0","w":"6","value":{"label":"(namespace)","store":"isNamespace","normalizer":"boolean"}},{"v":"1","w":"6","value":{"label":"(namespace)","store":"isNamespace","normalizer":"boolean"}},{"v":"6","w":"2","value":{"label":"(λ)"}},{"v":"2","w":"4","value":{"label":"(chamada)"}},{"v":"2","w":"3","value":{"label":"({term})","store":"varName"}},{"v":"4","w":"5","value":{"label":"([multi_word_token])","store":"varName","extraArgs":"{\"case\": \"camel\"}"}}],"value":{"id":"variable_reference","label":"Referencia a uma variável","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","title":"Referencia a uma variável","desc":"Refere a uma variável ou constante já declarada","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function VariableReference(command, editor, context) {\r\n console.log('[Spoken]: Executing: \"VariableReference\"');\r\n let { varName, parent, isNamespace = false } = command;\r\n varName = Array.isArray(varName) ? varName : [varName];\r\n varName = isNamespace ? varName.map(a => a[0].toUpperCase() + a.substr(1)).join('') : varName.join('');\r\n if (parent)\r\n return varName;\r\n return await editor.write(varName);\r\n}\r\nexports.default = VariableReference;\r\n","phrases":["referência constante temp","referência namespace temp","variável texto","namespace numero","referência constante chamada [multi_word_token]","refira namespace chamada [multi_word_token]","constante chamada [multi_word_token]","namespace chamada [multi_word_token]"]}},{"options":{"directed":true,"multigraph":true,"compound":true},"nodes":[{"v":"0","value":{"shape":"circle"}},{"v":"1","value":{"shape":"doublecircle"}},{"v":"2","value":{"shape":"doublecircle"}},{"v":"3","value":{"shape":"doublecircle"}}],"edges":[{"v":"0","w":"1","value":{"label":"(escreva)"}},{"v":"1","w":"3","value":{"label":"({any})","store":"text"}},{"v":"1","w":"2","value":{"label":"(espaço)","store":"isSpace","normalizer":"boolean"}},{"v":"3","w":"3","value":{"label":"({any})","store":"text"}}],"value":{"id":"write","label":"Escrever texto","lang":"pt-BR","langName":"Português","pad":"0.2","rankdir":"LR","disableStopWords":"true","title":"Escrever texto","desc":"Escreve um pedaço de texto no editor de texto","impl":"\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nasync function write(command, editor, context) {\r\n var _a;\r\n console.log('[Spoken]: Executing: \"write.\"');\r\n const text = command.isSpace ? ' ' : Array.isArray(command.text) ? (_a = command.text) === null || _a === void 0 ? void 0 : _a.join(' ') : command.text;\r\n return await editor.write(text);\r\n}\r\nexports.default = write;\r\n","phrases":["escreva","escreva espaço","escreva quem é você isto é um teste"]}}]},"desc":"Collection of voice commands of the typescript language","label":"Typescript voice commands"}]} \ No newline at end of file