Arquivo de definição da sintaxe de Potigol usando o ACE
Teste em: https://ace.c9.io/tool/mode_creator.html
Cole o arquivo potigol.js
no lado esquerdo e o arquivo exemplo.poti
no lado direito.
Arquivo de definição da sintaxe de Potigol usando o ACE
Teste em: https://ace.c9.io/tool/mode_creator.html
Cole o arquivo potigol.js
no lado esquerdo e o arquivo exemplo.poti
no lado direito.
# Linguagem Potigol | |
# Programação para todos | |
# Potigol é ... | |
# Uma linguagem moderna (funcional) para aprender a programar. | |
# Download | |
# Características | |
# Projetada para ser usada por alunos iniciantes | |
# Tipagem estática com inferência de tipos | |
# Palavras-chave em português | |
# Multiparadigma | |
# Estímulo ao paradigma funcional: valores imutáveis, casamento de padrões, funções como valores | |
# Variáveis | |
x = 10 # Valor fixo | |
var y := 10 # Valor alterável | |
y := y + 2 | |
Operações Aritméticas | |
5 + 3 | |
5 - 3 | |
5 * 3 | |
5 / 3 | |
5 div 3 | |
5 mod 3 | |
5 ^ 3 | |
#Entrada | |
a = leia_inteiro | |
b = leia_numero | |
c = leia_texto | |
x, y, z = leia_inteiro | |
números = leia_inteiros(5) # lê um lista de 5 inteiros , um por linha | |
números = leia_inteiros(",") # lê uma lista de números separados por vírgula | |
# Saída | |
escreva "Olá Mundo" # Escreve e passa para a próxima linha | |
imprima "Olá " # Escreve e continua na mesma linha | |
escreva "Mundo" | |
nome = "Mundo" | |
escreva "Olá {nome}" | |
# Se | |
se x > 5 então | |
escreva "Maior do que cinco." | |
fim | |
# --- | |
se x > 5 então | |
escreva "Maior do que cinco." | |
senão | |
escreva "Menor ou igual a cinco." | |
fim | |
# --- | |
se x > 8 então | |
escreva "Maior do que oito." | |
senãose x > 6 então | |
escreva "Maior do que seis." | |
senãose x > 4 então | |
escreva "Maior do que quatro." | |
senãose x > 2 então | |
escreva "Maior do que dois." | |
senão | |
escreva "Menor ou igual a dois." | |
fim | |
# Escolha | |
escolha x | |
caso 1 => escreva "Um" | |
caso 2 => escreva "Dois" | |
caso 3 => escreva "Três" | |
caso _ => escreva "Outro valor" | |
fim | |
# Para | |
para i de 1 até 10 faça | |
escreva i | |
fim | |
# Enquanto | |
var i = 0 | |
enquanto i<=10 faca | |
escreva i | |
i := i + 1 | |
fim | |
# Funções | |
soma(x, y: Inteiro) = x + y | |
a, b = leia_inteiro | |
c = soma(a, b) | |
escreva "{a} + {b} = {c}" | |
fatorial(n: Inteiro) | |
var f = 1 | |
para i de 2 ate n faça | |
f := f * i | |
fim | |
f | |
fim | |
a = leia_inteiro | |
escreva "Fatorial de {a} é {fatorial(a)}" | |
# Tipos | |
# Número (Inteiro e Real) | |
12345.678.inteiro # 12345 | |
12345.678.arredonde # 12346 | |
12345.678.arredonde(2) # 12345.68 | |
12345.texto # "12345" | |
12345 formato "%8d" # " 12345" | |
123.45 formato "%.1f" # "123.4" | |
#Texto | |
"123".inteiro # 123 | |
"12abc3".inteiro # 12 | |
"abc".inteiro # 0 | |
"12.3".real # 12.3 | |
"12a.3".real # 12.0 | |
"abc".real # 0.0 | |
"abc".tamanho # 3 | |
"abc".posição('b') # 2 | |
"abc".posição('d') # 0 | |
"abc".contém('a') # verdadeiro | |
"abc".contém('d') # falso | |
"Abc".maiúsculo # "ABC" | |
"Abc".minúsculo # "abc" | |
"Abc".inverta # "cbA" | |
"Isto é um texto".divida # ["Isto", "é", "um", "texto"] | |
"Isto é um texto".divida("t") # ["Is", "o é um ", "ex", "o"] | |
"Isto é um texto".lista # ["I", "s", "t", "o", " ", "é", " ", "u", "m", " ", "t", "e", "x", "t", "o"] | |
"abc".cabeça # 'a' | |
"abc".cauda # "bc" | |
"abc".último # 'c' | |
"abcde".pegue(3) # "abc" | |
"abcde".descarte(3) # "de" | |
"abcb".selecione(letra => letra<>'c') # "abb" | |
"abcb".descarte_enquanto(letra => letra<>'c') # "cb" | |
"abcb".pegue_enquanto(letra => letra<'c') # "ab" | |
# Lógicos | |
verdadeiro ou falso e não falso | |
# Lista | |
[2, 4, 6, 8, 10] # lista literal | |
2 :: [4, 6, 8, 10] # [2, 4, 6, 8, 10] | |
[2, 4, 6, 8, 10].tamanho # 5 | |
[2, 4, 6, 8, 10].cabeça # 2 | |
[2, 4, 6, 8, 10].cauda # [4, 6, 8, 10] | |
[2, 4, 6, 8, 10].último # 10 | |
[2, 4, 6, 8, 10].pegue(2) # [2, 4] | |
[2, 4, 6, 8, 10].descarte(2) # [6, 8, 10] | |
[2, 4, 6, 8, 10].inverta # [10, 8, 6, 4, 2] | |
[2, 6, 8, 10, 4].ordene # [2, 4, 6, 8, 10] | |
[2, 4, 6] + [8, 10] # [2, 4, 6, 8, 10] | |
[2, 4, 6].junte # "246" | |
[2, 4, 6].junte(", ") # "2, 4, 6" | |
[2, 4, 6].junte("[", ", ", "]") # "[2, 4, 6]" | |
a = [2, 4, 6, 8, 10] | |
a[3] # 6 | |
a.posição(6) # 3 | |
a.posição(12) # 0 | |
a.contém(6) # verdadeiro | |
a.contém(12) # falso | |
a.remova(4) # [2, 4, 6, 10] | |
a.insira(3,5) # [2, 4, 5, 6, 8, 10] | |
Lista.imutável(5, 0) # [0, 0, 0, 0, 0] | |
Lista.vazia[Inteiro] # [] - Lista vazia de inteiros | |
# Matrizes e Cubos | |
a = [[1, 2], [3, 4]] # Matriz 2x2 | |
a[2] # [3, 4] | |
a[2][1] # 3 | |
b = Matriz.imutável(2, 2, 0) # b == [[0, 0], [0, 0]] | |
c = Cubo.imutável(2, 2, 2, "-") # c == [[["-", "-"],["-", "-"]],[["-", "-"],["-", "-"]]] | |
c[1][2][1] # "-" | |
# Listas mutáveis | |
a = Lista.mutável(5, 0) # [0, 0, 0, 0, 0].mutável | |
a[3] := 5 # a == [0, 0, 5, 0, 0].mutável | |
# Funções de alta-ordem | |
[2, 4, 6, 8, 10].selecione(n => n mod 4 == 0) # [4, 8] | |
[2, 4, 6, 8, 10].mapeie(n => n div 2) # [1, 2, 3, 4, 5] | |
[2, 4, 6]. injete(0)((a,b) => a + b) # 0 + 2 + 4 + 6 == 12 | |
[2, 4, 6]. injete((a,b) => a + b) # 2 + 4 + 6 == 12 | |
[2, 4, 6, 2, 4].pegue_enquanto(n => n < 6) # [2, 4] | |
[2, 4, 6, 2, 4].descarte_enquanto(n => n < 6) # [6, 2, 4] | |
# Tupla | |
t = (2015, "potigol", 1.0) # Tupla do tipo (Inteiro, Texto, Real | |
t.primeiro # 2015 | |
t.segundo # "potigol" | |
t.terceiro # 1.0 | |
# Funções Matemática | |
PI | |
sen(3.14) | |
cos(3.14) | |
tg(1) | |
arcsen(1) | |
arccos(1) | |
arctg(1) | |
abs(-2.4) # 2.4 | |
raiz(9) # 3.0 | |
log(2) | |
log10(2) | |
aleatório() # número aleatório entre 0 e 1 | |
aleatório(10) # número aleatório entre 1 e 10 | |
aleatório(1, 6) # número aleatório entre 1 e 6 | |
aleatório([2, 4, 6, 8, 10]) # número aleatório pertencente à lista [2, 4, 6, 8, 10] | |
# Programação Funcional | |
# Valores (constantes) | |
nome = "potigol" | |
# Listas | |
lista1 = [1,2,3,4] | |
lista2 = 0::lista1 | |
# Operações com listas (filter, fold, map) | |
numeros = [1, 2, 3, 4, 5, 6, 7, 8] | |
pares = numeros.selecione(n => n mod 2 == 0) # filtro | |
soma = numeros.injete(0)((a,b) => a + b) # fold | |
dobro = numeros.mapeie(n => n * 2) # map | |
# Expressões lambda | |
x = ((a: Inteiro) => a * 2) | |
escreva x(4) | |
# "list comprehension" | |
y = para i de 1 até 10, | |
j de i + 1 até 10 gere | |
i+j | |
fim | |
escreva y | |
# Funções de Alta ordem | |
f(g: Inteiro => Inteiro, a: Inteiro) = g(a) | |
sucessor(n: Inteiro) = n + 1 | |
escreva f(sucessor, 5) | |
# Currying | |
soma(a: Inteiro) = ((b: Inteiro) => a + b) | |
escreva soma(2)(3) | |
suc = soma(1) | |
escreva suc(4) | |
# Recursão em cauda otimizada | |
h(a, cont: Inteiro): Inteiro = escolha a | |
caso 0 => cont | |
caso n => h(a - 1, cont + 1) | |
fim | |
escreva h(1000,0) | |
# Casamento de Padrões | |
# QuickSort | |
quicksort(num: Lista[Inteiro]): Lista[Inteiro] = | |
escolha num | |
caso [] => [] | |
caso pivo::resto => | |
menores = resto.selecione( _ <= pivo ) | |
maiores = resto.selecione( _ > pivo ) | |
quicksort(menores) + pivo::quicksort(maiores) | |
fim | |
escreva "Digite alguns números separados por espaços" | |
números = leia_inteiros(" ") | |
escreva "Os números ordenados:" | |
escreva quicksort(números) |
define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { | |
"use strict"; | |
var oop = require("../lib/oop"); | |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | |
var DocCommentHighlightRules = function() { | |
this.$rules = { | |
"start" : [ { | |
token : "comment.doc.tag", | |
regex : "@[\\w\\d_]+" // TODO: fix email addresses | |
}, | |
DocCommentHighlightRules.getTagRule(), | |
{ | |
defaultToken : "comment.doc", | |
caseInsensitive: true | |
}] | |
}; | |
}; | |
oop.inherits(DocCommentHighlightRules, TextHighlightRules); | |
DocCommentHighlightRules.getTagRule = function(start) { | |
return { | |
token : "comment.doc.tag.storage.type", | |
regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b" | |
}; | |
} | |
DocCommentHighlightRules.getStartRule = function(start) { | |
return { | |
token : "comment.doc", // doc comment | |
regex : "\\/\\*(?=\\*)", | |
next : start | |
}; | |
}; | |
DocCommentHighlightRules.getEndRule = function (start) { | |
return { | |
token : "comment.doc", // closing comment | |
regex : "\\*\\/", | |
next : start | |
}; | |
}; | |
exports.DocCommentHighlightRules = DocCommentHighlightRules; | |
}); | |
define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) { | |
"use strict"; | |
var oop = require("../lib/oop"); | |
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; | |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | |
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*"; | |
var JavaScriptHighlightRules = function(options) { | |
var keywordMapper = this.createKeywordMapper({ | |
"variable.language": | |
"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors | |
"Namespace|QName|XML|XMLList|" + // E4X | |
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + | |
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + | |
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors | |
"SyntaxError|TypeError|URIError|" + | |
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions | |
"isNaN|parseFloat|parseInt|" + | |
"JSON|Math|" + // Other | |
"this|arguments|prototype|window|document" , // Pseudo | |
"keyword": | |
"const|yield|import|get|set|async|await|" + | |
"break|case|catch|continue|default|delete|do|else|finally|for|function|" + | |
"if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + | |
"__parent__|__count__|escape|unescape|with|__proto__|" + | |
"class|enum|extends|super|export|implements|private|public|interface|package|protected|static", | |
"storage.type": | |
"const|let|var|function", | |
"constant.language": | |
"null|Infinity|NaN|undefined", | |
"support.function": | |
"alert", | |
"constant.language.boolean": "true|false" | |
}, "identifier"); | |
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; | |
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex | |
"u[0-9a-fA-F]{4}|" + // unicode | |
"u{[0-9a-fA-F]{1,6}}|" + // es6 unicode | |
"[0-2][0-7]{0,2}|" + // oct | |
"3[0-7][0-7]?|" + // oct | |
"[4-7][0-7]?|" + //oct | |
".)"; | |
this.$rules = { | |
"no_regex" : [ | |
DocCommentHighlightRules.getStartRule("doc-start"), | |
comments("no_regex"), | |
{ | |
token : "string", | |
regex : "'(?=.)", | |
next : "qstring" | |
}, { | |
token : "string", | |
regex : '"(?=.)', | |
next : "qqstring" | |
}, { | |
token : "constant.numeric", // hex | |
regex : /0(?:[xX][0-9a-fA-F]+|[bB][01]+)\b/ | |
}, { | |
token : "constant.numeric", // float | |
regex : /[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ | |
}, { | |
token : [ | |
"storage.type", "punctuation.operator", "support.function", | |
"punctuation.operator", "entity.name.function", "text","keyword.operator" | |
], | |
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", | |
next: "function_arguments" | |
}, { | |
token : [ | |
"storage.type", "punctuation.operator", "entity.name.function", "text", | |
"keyword.operator", "text", "storage.type", "text", "paren.lparen" | |
], | |
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", | |
next: "function_arguments" | |
}, { | |
token : [ | |
"entity.name.function", "text", "keyword.operator", "text", "storage.type", | |
"text", "paren.lparen" | |
], | |
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", | |
next: "function_arguments" | |
}, { | |
token : [ | |
"storage.type", "punctuation.operator", "entity.name.function", "text", | |
"keyword.operator", "text", | |
"storage.type", "text", "entity.name.function", "text", "paren.lparen" | |
], | |
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", | |
next: "function_arguments" | |
}, { | |
token : [ | |
"storage.type", "text", "entity.name.function", "text", "paren.lparen" | |
], | |
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", | |
next: "function_arguments" | |
}, { | |
token : [ | |
"entity.name.function", "text", "punctuation.operator", | |
"text", "storage.type", "text", "paren.lparen" | |
], | |
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", | |
next: "function_arguments" | |
}, { | |
token : [ | |
"text", "text", "storage.type", "text", "paren.lparen" | |
], | |
regex : "(:)(\\s*)(function)(\\s*)(\\()", | |
next: "function_arguments" | |
}, { | |
token : "keyword", | |
regex : "(?:" + kwBeforeRe + ")\\b", | |
next : "start" | |
}, { | |
token : ["support.constant"], | |
regex : /that\b/ | |
}, { | |
token : ["storage.type", "punctuation.operator", "support.function.firebug"], | |
regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/ | |
}, { | |
token : keywordMapper, | |
regex : identifierRe | |
}, { | |
token : "punctuation.operator", | |
regex : /[.](?![.])/, | |
next : "property" | |
}, { | |
token : "keyword.operator", | |
regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/, | |
next : "start" | |
}, { | |
token : "punctuation.operator", | |
regex : /[?:,;.]/, | |
next : "start" | |
}, { | |
token : "paren.lparen", | |
regex : /[\[({]/, | |
next : "start" | |
}, { | |
token : "paren.rparen", | |
regex : /[\])}]/ | |
}, { | |
token: "comment", | |
regex: /^#!.*$/ | |
} | |
], | |
property: [{ | |
token : "text", | |
regex : "\\s+" | |
}, { | |
token : [ | |
"storage.type", "punctuation.operator", "entity.name.function", "text", | |
"keyword.operator", "text", | |
"storage.type", "text", "entity.name.function", "text", "paren.lparen" | |
], | |
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()", | |
next: "function_arguments" | |
}, { | |
token : "punctuation.operator", | |
regex : /[.](?![.])/ | |
}, { | |
token : "support.function", | |
regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ | |
}, { | |
token : "support.function.dom", | |
regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/ | |
}, { | |
token : "support.constant", | |
regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/ | |
}, { | |
token : "identifier", | |
regex : identifierRe | |
}, { | |
regex: "", | |
token: "empty", | |
next: "no_regex" | |
} | |
], | |
"start": [ | |
DocCommentHighlightRules.getStartRule("doc-start"), | |
comments("start"), | |
{ | |
token: "string.regexp", | |
regex: "\\/", | |
next: "regex" | |
}, { | |
token : "text", | |
regex : "\\s+|^$", | |
next : "start" | |
}, { | |
token: "empty", | |
regex: "", | |
next: "no_regex" | |
} | |
], | |
"regex": [ | |
{ | |
token: "regexp.keyword.operator", | |
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" | |
}, { | |
token: "string.regexp", | |
regex: "/[sxngimy]*", | |
next: "no_regex" | |
}, { | |
token : "invalid", | |
regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ | |
}, { | |
token : "constant.language.escape", | |
regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ | |
}, { | |
token : "constant.language.delimiter", | |
regex: /\|/ | |
}, { | |
token: "constant.language.escape", | |
regex: /\[\^?/, | |
next: "regex_character_class" | |
}, { | |
token: "empty", | |
regex: "$", | |
next: "no_regex" | |
}, { | |
defaultToken: "string.regexp" | |
} | |
], | |
"regex_character_class": [ | |
{ | |
token: "regexp.charclass.keyword.operator", | |
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" | |
}, { | |
token: "constant.language.escape", | |
regex: "]", | |
next: "regex" | |
}, { | |
token: "constant.language.escape", | |
regex: "-" | |
}, { | |
token: "empty", | |
regex: "$", | |
next: "no_regex" | |
}, { | |
defaultToken: "string.regexp.charachterclass" | |
} | |
], | |
"function_arguments": [ | |
{ | |
token: "variable.parameter", | |
regex: identifierRe | |
}, { | |
token: "punctuation.operator", | |
regex: "[, ]+" | |
}, { | |
token: "punctuation.operator", | |
regex: "$" | |
}, { | |
token: "empty", | |
regex: "", | |
next: "no_regex" | |
} | |
], | |
"qqstring" : [ | |
{ | |
token : "constant.language.escape", | |
regex : escapedRe | |
}, { | |
token : "string", | |
regex : "\\\\$", | |
next : "qqstring" | |
}, { | |
token : "string", | |
regex : '"|$', | |
next : "no_regex" | |
}, { | |
defaultToken: "string" | |
} | |
], | |
"qstring" : [ | |
{ | |
token : "constant.language.escape", | |
regex : escapedRe | |
}, { | |
token : "string", | |
regex : "\\\\$", | |
next : "qstring" | |
}, { | |
token : "string", | |
regex : "'|$", | |
next : "no_regex" | |
}, { | |
defaultToken: "string" | |
} | |
] | |
}; | |
if (!options || !options.noES6) { | |
this.$rules.no_regex.unshift({ | |
regex: "[{}]", onMatch: function(val, state, stack) { | |
this.next = val == "{" ? this.nextState : ""; | |
if (val == "{" && stack.length) { | |
stack.unshift("start", state); | |
} | |
else if (val == "}" && stack.length) { | |
stack.shift(); | |
this.next = stack.shift(); | |
if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1) | |
return "paren.quasi.end"; | |
} | |
return val == "{" ? "paren.lparen" : "paren.rparen"; | |
}, | |
nextState: "start" | |
}, { | |
token : "string.quasi.start", | |
regex : /`/, | |
push : [{ | |
token : "constant.language.escape", | |
regex : escapedRe | |
}, { | |
token : "paren.quasi.start", | |
regex : /\${/, | |
push : "start" | |
}, { | |
token : "string.quasi.end", | |
regex : /`/, | |
next : "pop" | |
}, { | |
defaultToken: "string.quasi" | |
}] | |
}); | |
if (!options || options.jsx != false) | |
JSX.call(this); | |
} | |
this.embedRules(DocCommentHighlightRules, "doc-", | |
[ DocCommentHighlightRules.getEndRule("no_regex") ]); | |
this.normalizeRules(); | |
}; | |
oop.inherits(JavaScriptHighlightRules, TextHighlightRules); | |
function JSX() { | |
var tagRegex = identifierRe.replace("\\d", "\\d\\-"); | |
var jsxTag = { | |
onMatch : function(val, state, stack) { | |
var offset = val.charAt(1) == "/" ? 2 : 1; | |
if (offset == 1) { | |
if (state != this.nextState) | |
stack.unshift(this.next, this.nextState, 0); | |
else | |
stack.unshift(this.next); | |
stack[2]++; | |
} else if (offset == 2) { | |
if (state == this.nextState) { | |
stack[1]--; | |
if (!stack[1] || stack[1] < 0) { | |
stack.shift(); | |
stack.shift(); | |
} | |
} | |
} | |
return [{ | |
type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml", | |
value: val.slice(0, offset) | |
}, { | |
type: "meta.tag.tag-name.xml", | |
value: val.substr(offset) | |
}]; | |
}, | |
regex : "</?" + tagRegex + "", | |
next: "jsxAttributes", | |
nextState: "jsx" | |
}; | |
this.$rules.start.unshift(jsxTag); | |
var jsxJsRule = { | |
regex: "{", | |
token: "paren.quasi.start", | |
push: "start" | |
}; | |
this.$rules.jsx = [ | |
jsxJsRule, | |
jsxTag, | |
{include : "reference"}, | |
{defaultToken: "string"} | |
]; | |
this.$rules.jsxAttributes = [{ | |
token : "meta.tag.punctuation.tag-close.xml", | |
regex : "/?>", | |
onMatch : function(value, currentState, stack) { | |
if (currentState == stack[0]) | |
stack.shift(); | |
if (value.length == 2) { | |
if (stack[0] == this.nextState) | |
stack[1]--; | |
if (!stack[1] || stack[1] < 0) { | |
stack.splice(0, 2); | |
} | |
} | |
this.next = stack[0] || "start"; | |
return [{type: this.token, value: value}]; | |
}, | |
nextState: "jsx" | |
}, | |
jsxJsRule, | |
comments("jsxAttributes"), | |
{ | |
token : "entity.other.attribute-name.xml", | |
regex : tagRegex | |
}, { | |
token : "keyword.operator.attribute-equals.xml", | |
regex : "=" | |
}, { | |
token : "text.tag-whitespace.xml", | |
regex : "\\s+" | |
}, { | |
token : "string.attribute-value.xml", | |
regex : "'", | |
stateName : "jsx_attr_q", | |
push : [ | |
{token : "string.attribute-value.xml", regex: "'", next: "pop"}, | |
{include : "reference"}, | |
{defaultToken : "string.attribute-value.xml"} | |
] | |
}, { | |
token : "string.attribute-value.xml", | |
regex : '"', | |
stateName : "jsx_attr_qq", | |
push : [ | |
{token : "string.attribute-value.xml", regex: '"', next: "pop"}, | |
{include : "reference"}, | |
{defaultToken : "string.attribute-value.xml"} | |
] | |
}, | |
jsxTag | |
]; | |
this.$rules.reference = [{ | |
token : "constant.language.escape.reference.xml", | |
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" | |
}]; | |
} | |
function comments(next) { | |
return [ | |
{ | |
token : "comment", // multi line comment | |
regex : /\/\*/, | |
next: [ | |
DocCommentHighlightRules.getTagRule(), | |
{token : "comment", regex : "\\*\\/", next : next || "pop"}, | |
{defaultToken : "comment", caseInsensitive: true} | |
] | |
}, { | |
token : "comment", | |
regex : "\\/\\/", | |
next: [ | |
DocCommentHighlightRules.getTagRule(), | |
{token : "comment", regex : "$|^", next : next || "pop"}, | |
{defaultToken : "comment", caseInsensitive: true} | |
] | |
} | |
]; | |
} | |
exports.JavaScriptHighlightRules = JavaScriptHighlightRules; | |
}); | |
define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { | |
"use strict"; | |
var Range = require("../range").Range; | |
var MatchingBraceOutdent = function() {}; | |
(function() { | |
this.checkOutdent = function(line, input) { | |
if (! /^\s+$/.test(line)) | |
return false; | |
return /^\s*\}/.test(input); | |
}; | |
this.autoOutdent = function(doc, row) { | |
var line = doc.getLine(row); | |
var match = line.match(/^(\s*\})/); | |
if (!match) return 0; | |
var column = match[1].length; | |
var openBracePos = doc.findMatchingBracket({row: row, column: column}); | |
if (!openBracePos || openBracePos.row == row) return 0; | |
var indent = this.$getIndent(doc.getLine(openBracePos.row)); | |
doc.replace(new Range(row, 0, row, column-1), indent); | |
}; | |
this.$getIndent = function(line) { | |
return line.match(/^\s*/)[0]; | |
}; | |
}).call(MatchingBraceOutdent.prototype); | |
exports.MatchingBraceOutdent = MatchingBraceOutdent; | |
}); | |
define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { | |
"use strict"; | |
var oop = require("../../lib/oop"); | |
var Range = require("../../range").Range; | |
var BaseFoldMode = require("./fold_mode").FoldMode; | |
var FoldMode = exports.FoldMode = function(commentRegex) { | |
if (commentRegex) { | |
this.foldingStartMarker = new RegExp( | |
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) | |
); | |
this.foldingStopMarker = new RegExp( | |
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) | |
); | |
} | |
}; | |
oop.inherits(FoldMode, BaseFoldMode); | |
(function() { | |
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/; | |
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/; | |
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; | |
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; | |
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; | |
this._getFoldWidgetBase = this.getFoldWidget; | |
this.getFoldWidget = function(session, foldStyle, row) { | |
var line = session.getLine(row); | |
if (this.singleLineBlockCommentRe.test(line)) { | |
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) | |
return ""; | |
} | |
var fw = this._getFoldWidgetBase(session, foldStyle, row); | |
if (!fw && this.startRegionRe.test(line)) | |
return "start"; // lineCommentRegionStart | |
return fw; | |
}; | |
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { | |
var line = session.getLine(row); | |
if (this.startRegionRe.test(line)) | |
return this.getCommentRegionBlock(session, line, row); | |
var match = line.match(this.foldingStartMarker); | |
if (match) { | |
var i = match.index; | |
if (match[1]) | |
return this.openingBracketBlock(session, match[1], row, i); | |
var range = session.getCommentFoldRange(row, i + match[0].length, 1); | |
if (range && !range.isMultiLine()) { | |
if (forceMultiline) { | |
range = this.getSectionRange(session, row); | |
} else if (foldStyle != "all") | |
range = null; | |
} | |
return range; | |
} | |
if (foldStyle === "markbegin") | |
return; | |
var match = line.match(this.foldingStopMarker); | |
if (match) { | |
var i = match.index + match[0].length; | |
if (match[1]) | |
return this.closingBracketBlock(session, match[1], row, i); | |
return session.getCommentFoldRange(row, i, -1); | |
} | |
}; | |
this.getSectionRange = function(session, row) { | |
var line = session.getLine(row); | |
var startIndent = line.search(/\S/); | |
var startRow = row; | |
var startColumn = line.length; | |
row = row + 1; | |
var endRow = row; | |
var maxRow = session.getLength(); | |
while (++row < maxRow) { | |
line = session.getLine(row); | |
var indent = line.search(/\S/); | |
if (indent === -1) | |
continue; | |
if (startIndent > indent) | |
break; | |
var subRange = this.getFoldWidgetRange(session, "all", row); | |
if (subRange) { | |
if (subRange.start.row <= startRow) { | |
break; | |
} else if (subRange.isMultiLine()) { | |
row = subRange.end.row; | |
} else if (startIndent == indent) { | |
break; | |
} | |
} | |
endRow = row; | |
} | |
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); | |
}; | |
this.getCommentRegionBlock = function(session, line, row) { | |
var startColumn = line.search(/\s*$/); | |
var maxRow = session.getLength(); | |
var startRow = row; | |
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; | |
var depth = 1; | |
while (++row < maxRow) { | |
line = session.getLine(row); | |
var m = re.exec(line); | |
if (!m) continue; | |
if (m[1]) depth--; | |
else depth++; | |
if (!depth) break; | |
} | |
var endRow = row; | |
if (endRow > startRow) { | |
return new Range(startRow, startColumn, endRow, line.length); | |
} | |
}; | |
}).call(FoldMode.prototype); | |
}); | |
define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) { | |
"use strict"; | |
var oop = require("../lib/oop"); | |
var TextMode = require("./text").Mode; | |
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; | |
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; | |
var Range = require("../range").Range; | |
var WorkerClient = require("../worker/worker_client").WorkerClient; | |
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; | |
var CStyleFoldMode = require("./folding/cstyle").FoldMode; | |
var Mode = function() { | |
this.HighlightRules = JavaScriptHighlightRules; | |
this.$outdent = new MatchingBraceOutdent(); | |
this.$behaviour = new CstyleBehaviour(); | |
this.foldingRules = new CStyleFoldMode(); | |
}; | |
oop.inherits(Mode, TextMode); | |
(function() { | |
this.lineCommentStart = "//"; | |
this.blockComment = {start: "/*", end: "*/"}; | |
this.getNextLineIndent = function(state, line, tab) { | |
var indent = this.$getIndent(line); | |
var tokenizedLine = this.getTokenizer().getLineTokens(line, state); | |
var tokens = tokenizedLine.tokens; | |
var endState = tokenizedLine.state; | |
if (tokens.length && tokens[tokens.length-1].type == "comment") { | |
return indent; | |
} | |
if (state == "start" || state == "no_regex") { | |
var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/); | |
if (match) { | |
indent += tab; | |
} | |
} else if (state == "doc-start") { | |
if (endState == "start" || endState == "no_regex") { | |
return ""; | |
} | |
var match = line.match(/^\s*(\/?)\*/); | |
if (match) { | |
if (match[1]) { | |
indent += " "; | |
} | |
indent += "* "; | |
} | |
} | |
return indent; | |
}; | |
this.checkOutdent = function(state, line, input) { | |
return this.$outdent.checkOutdent(line, input); | |
}; | |
this.autoOutdent = function(state, doc, row) { | |
this.$outdent.autoOutdent(doc, row); | |
}; | |
this.createWorker = function(session) { | |
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); | |
worker.attachToDocument(session.getDocument()); | |
worker.on("annotate", function(results) { | |
session.setAnnotations(results.data); | |
}); | |
worker.on("terminate", function() { | |
session.clearAnnotations(); | |
}); | |
return worker; | |
}; | |
this.$id = "ace/mode/javascript"; | |
}).call(Mode.prototype); | |
exports.Mode = Mode; | |
}); | |
define("ace/mode/potigol_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) { | |
"use strict"; | |
var oop = require("../lib/oop"); | |
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; | |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | |
var PotigolHighlightRules = function() { | |
var keywords = ( | |
"caso|então|entao|senao|senão|para|de|ate|até|passo|se|senãose|senaose|"+ | |
"escolha|enquanto|fim|faça|faca|gere|" + | |
"use|var|tipo|mod|div|e|ou|não|nao|formato|" + | |
"escreva|imprima|leia_texto|leia_textos|leia_inteiro|leia_inteiros|"+ | |
"leia_numero|leia_número|leia_numeros|leia_números" | |
); | |
var buildinConstants = ("verdadeiro|falso|PI|_"); | |
var langClasses = ( | |
"Lista|Matriz|Cubo|" + | |
"Unit|Inteiro|Real|Texto|Lógico|Logico|" + | |
"Tupla|"+ | |
"inteiro|arredonde|texto|real|tamanho|posição|posiçao|posicão|posicao|"+ | |
"contém|contem|maiúsculo|maiusculo|minúsculo|minusculo|inverta|divida|lista|"+ | |
"cabeça|cabeca|cauda|último|ultimo|pegue|descarte|selecione|mapeie|"+ | |
"descarte_enquanto|pegue_enquanto|ordene|junte|insira|remova|"+ | |
"mutável|mutavel|imutável|imutavel|vazia|injete|"+ | |
"primeiro|segundo|terceiro|quarto|quinto|sexto|sétimo|setimo|oitavo|"+ | |
"nono|décimo|decimo|aleatório|aleatorio|"+ | |
"sen|cos|tg|arcsen|arccos|arctg|abs|raiz|log|log10" | |
); | |
var keywordMapper = this.createKeywordMapper({ | |
"keyword": keywords, | |
"support.function": langClasses, | |
"constant.language": buildinConstants | |
}, "identifier"); | |
this.$rules = { | |
"start" : [ | |
{ | |
token : "comment", | |
regex : "#.*$" | |
}, | |
DocCommentHighlightRules.getStartRule("doc-start"), | |
{ | |
token : "string.regexp", | |
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" | |
}, { | |
token : "string", | |
regex : '"""', | |
next : "tstring" | |
}, { | |
token : "string", | |
regex : '"(?=.)', // " strings can't span multiple lines | |
next : "string" | |
}, { | |
token : "constant.charactere", // single line | |
regex : "'[\\w\\d_]'" | |
}, { | |
token : "constant.numeric", // float | |
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" | |
}, { | |
token : "constant.language.boolean", | |
regex : "(?:verdadeiro|falso)\\b" | |
}, { | |
token : keywordMapper, | |
regex : "[a-zA-ZáéÃóúà èìòùÃÉÃÓÚÀÈÌÒÙâêîôûÂÊÎÔÛãõÃÕçÇñÑ_$][a-zA-Z0-9áéÃóúà èìòùÃÉÃÓÚÀÈÌÒÙâêîôûÂÊÎÔÛãõÃÕçÇñÑ_$]*\\b" | |
}, { | |
token : "keyword.operator", | |
regex : "\\-|\\+|\\^|\\*|/|==|=|<=|>=|=>|<>|<|>|\\||\\:\\:|\\:=|\\b(?:in)" | |
}, { | |
token : "paren.lparen", | |
regex : "[[({]" | |
}, { | |
token : "paren.rparen", | |
regex : "[\\])}]" | |
}, { | |
token : "text", | |
regex : "\\s+" | |
} | |
], | |
"comment" : [ | |
{ | |
token : "comment", // comment spanning whole line | |
regex : ".+" | |
} | |
], | |
"string" : [ | |
{ | |
token : "escape", | |
regex : '\\\\"' | |
}, { | |
token : "string", | |
regex : '"', | |
next : "start" | |
}, { | |
token : "string.invalid", | |
regex : '[^"\\\\]*$', | |
next : "start" | |
}, { | |
token : "string", | |
regex : '[^"\\\\]+' | |
} | |
], | |
"tstring" : [ | |
{ | |
token : "string", | |
regex : '"{3,5}', | |
next : "start" | |
}, { | |
defaultToken : "string" | |
} | |
] | |
}; | |
this.embedRules(DocCommentHighlightRules, "doc-", | |
[ DocCommentHighlightRules.getEndRule("start") ]); | |
}; | |
oop.inherits(PotigolHighlightRules, TextHighlightRules); | |
exports.PotigolHighlightRules = PotigolHighlightRules; | |
}); | |
define("ace/mode/potigol",["require","exports","module","ace/lib/oop","ace/mode/javascript","ace/mode/potigol_highlight_rules"], function(require, exports, module) { | |
"use strict"; | |
var oop = require("../lib/oop"); | |
var JavaScriptMode = require("./javascript").Mode; | |
var PotigolHighlightRules = require("./potigol_highlight_rules").PotigolHighlightRules; | |
var Mode = function() { | |
JavaScriptMode.call(this); | |
this.HighlightRules = PotigolHighlightRules; | |
}; | |
oop.inherits(Mode, JavaScriptMode); | |
(function() { | |
this.createWorker = function(session) { | |
return null; | |
}; | |
this.$id = "ace/mode/potigol"; | |
}).call(Mode.prototype); | |
exports.Mode = Mode; | |
}); |
define(function(require, exports, module) { | |
"use strict"; | |
var oop = require("../lib/oop"); | |
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; | |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | |
var PotigolHighlightRules = function() { | |
var keywords = ( | |
"caso|então|entao|senao|senão|para|de|ate|até|passo|se|senãose|senaose|"+ | |
"escolha|enquanto|fim|faça|faca|gere|" + | |
"use|var|tipo|mod|div|e|ou|não|nao|formato|" + | |
"escreva|imprima|leia_texto|leia_textos|leia_inteiro|leia_inteiros|"+ | |
"leia_numero|leia_número|leia_numeros|leia_números" | |
); | |
var buildinConstants = ("verdadeiro|falso|PI|_"); | |
var langClasses = ( | |
"Lista|Matriz|Cubo|" + | |
"Unit|Inteiro|Real|Texto|Lógico|Logico|" + | |
"Tupla|"+ | |
"inteiro|arredonde|texto|real|tamanho|posição|posiçao|posicão|posicao|"+ | |
"contém|contem|maiúsculo|maiusculo|minúsculo|minusculo|inverta|divida|lista|"+ | |
"cabeça|cabeca|cauda|último|ultimo|pegue|descarte|selecione|mapeie|"+ | |
"descarte_enquanto|pegue_enquanto|ordene|junte|insira|remova|"+ | |
"mutável|mutavel|imutável|imutavel|vazia|injete|"+ | |
"primeiro|segundo|terceiro|quarto|quinto|sexto|sétimo|setimo|oitavo|"+ | |
"nono|décimo|decimo|aleatório|aleatorio|"+ | |
"sen|cos|tg|arcsen|arccos|arctg|abs|raiz|log|log10" | |
); | |
var keywordMapper = this.createKeywordMapper({ | |
"keyword": keywords, | |
"support.function": langClasses, | |
"constant.language": buildinConstants | |
}, "identifier"); | |
// regexp must not have capturing parentheses. Use (?:) instead. | |
// regexps are ordered -> the first match is used | |
this.$rules = { | |
"start" : [ | |
{ | |
token : "comment", | |
regex : "#.*$" | |
}, | |
DocCommentHighlightRules.getStartRule("doc-start"), | |
{ | |
token : "string.regexp", | |
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" | |
}, { | |
token : "string", | |
regex : '"""', | |
next : "tstring" | |
}, { | |
token : "string", | |
regex : '"(?=.)', // " strings can't span multiple lines | |
next : "string" | |
}, { | |
token : "constant.charactere", // single line | |
regex : "'[\\w\\d_]'" | |
}, { | |
token : "constant.numeric", // float | |
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" | |
}, { | |
token : "constant.language.boolean", | |
regex : "(?:verdadeiro|falso)\\b" | |
}, { | |
token : keywordMapper, | |
// TODO: Unicode escape sequences | |
// TODO: Unicode identifiers | |
regex : "[a-zA-ZáéíóúàèìòùÁÉÍÓÚÀÈÌÒÙâêîôûÂÊÎÔÛãõÃÕçÇñÑ_$][a-zA-Z0-9áéíóúàèìòùÁÉÍÓÚÀÈÌÒÙâêîôûÂÊÎÔÛãõÃÕçÇñÑ_$]*\\b" | |
}, { | |
token : "keyword.operator", | |
regex : "\\-|\\+|\\^|\\*|/|==|=|<=|>=|=>|<>|<|>|\\||\\:\\:|\\:=|\\b(?:in)" | |
}, { | |
token : "paren.lparen", | |
regex : "[[({]" | |
}, { | |
token : "paren.rparen", | |
regex : "[\\])}]" | |
}, { | |
token : "text", | |
regex : "\\s+" | |
} | |
], | |
"comment" : [ | |
{ | |
token : "comment", // comment spanning whole line | |
regex : ".+" | |
} | |
], | |
"string" : [ | |
{ | |
token : "escape", | |
regex : '\\\\"' | |
}, { | |
token : "string", | |
regex : '"', | |
next : "start" | |
}, { | |
token : "string.invalid", | |
regex : '[^"\\\\]*$', | |
next : "start" | |
}, { | |
token : "string", | |
regex : '[^"\\\\]+' | |
} | |
], | |
"tstring" : [ | |
{ | |
token : "string", | |
regex : '"{3,5}', | |
next : "start" | |
}, { | |
defaultToken : "string" | |
} | |
] | |
}; | |
this.embedRules(DocCommentHighlightRules, "doc-", | |
[ DocCommentHighlightRules.getEndRule("start") ]); | |
}; | |
oop.inherits(PotigolHighlightRules, TextHighlightRules); | |
exports.PotigolHighlightRules = PotigolHighlightRules; | |
}); |