diff options
Diffstat (limited to 'doc/docs/pt-br')
31 files changed, 435 insertions, 202 deletions
diff --git a/doc/docs/pt-br/doc/advanced/do.md b/doc/docs/pt-br/doc/advanced/do.md index f13d8aa..503c551 100644 --- a/doc/docs/pt-br/doc/advanced/do.md +++ b/doc/docs/pt-br/doc/advanced/do.md | |||
| @@ -8,6 +8,7 @@ do | |||
| 8 | print var | 8 | print var |
| 9 | print var -- nil aqui | 9 | print var -- nil aqui |
| 10 | ``` | 10 | ``` |
| 11 | |||
| 11 | <YueDisplay> | 12 | <YueDisplay> |
| 12 | 13 | ||
| 13 | ```yue | 14 | ```yue |
| @@ -31,6 +32,7 @@ counter = do | |||
| 31 | print counter! | 32 | print counter! |
| 32 | print counter! | 33 | print counter! |
| 33 | ``` | 34 | ``` |
| 35 | |||
| 34 | <YueDisplay> | 36 | <YueDisplay> |
| 35 | 37 | ||
| 36 | ```yue | 38 | ```yue |
| @@ -53,6 +55,7 @@ tbl = { | |||
| 53 | 1234 | 55 | 1234 |
| 54 | } | 56 | } |
| 55 | ``` | 57 | ``` |
| 58 | |||
| 56 | <YueDisplay> | 59 | <YueDisplay> |
| 57 | 60 | ||
| 58 | ```yue | 61 | ```yue |
diff --git a/doc/docs/pt-br/doc/advanced/line-decorators.md b/doc/docs/pt-br/doc/advanced/line-decorators.md index 94d1004..aaf34ea 100644 --- a/doc/docs/pt-br/doc/advanced/line-decorators.md +++ b/doc/docs/pt-br/doc/advanced/line-decorators.md | |||
| @@ -5,6 +5,7 @@ Por conveniência, o loop for e a instrução if podem ser aplicados a instruçà | |||
| 5 | ```yuescript | 5 | ```yuescript |
| 6 | print "hello world" if name == "Rob" | 6 | print "hello world" if name == "Rob" |
| 7 | ``` | 7 | ``` |
| 8 | |||
| 8 | <YueDisplay> | 9 | <YueDisplay> |
| 9 | 10 | ||
| 10 | ```yue | 11 | ```yue |
| @@ -18,6 +19,7 @@ E com loops básicos: | |||
| 18 | ```yuescript | 19 | ```yuescript |
| 19 | print "item: ", item for item in *items | 20 | print "item: ", item for item in *items |
| 20 | ``` | 21 | ``` |
| 22 | |||
| 21 | <YueDisplay> | 23 | <YueDisplay> |
| 22 | 24 | ||
| 23 | ```yue | 25 | ```yue |
| @@ -33,6 +35,7 @@ game\update! while game\isRunning! | |||
| 33 | 35 | ||
| 34 | reader\parse_line! until reader\eof! | 36 | reader\parse_line! until reader\eof! |
| 35 | ``` | 37 | ``` |
| 38 | |||
| 36 | <YueDisplay> | 39 | <YueDisplay> |
| 37 | 40 | ||
| 38 | ```yue | 41 | ```yue |
diff --git a/doc/docs/pt-br/doc/advanced/macro.md b/doc/docs/pt-br/doc/advanced/macro.md index 846d506..18d33e0 100644 --- a/doc/docs/pt-br/doc/advanced/macro.md +++ b/doc/docs/pt-br/doc/advanced/macro.md | |||
| @@ -32,6 +32,7 @@ macro and = (...) -> "#{ table.concat {...}, ' and ' }" | |||
| 32 | if $and f1!, f2!, f3! | 32 | if $and f1!, f2!, f3! |
| 33 | print "OK" | 33 | print "OK" |
| 34 | ``` | 34 | ``` |
| 35 | |||
| 35 | <YueDisplay> | 36 | <YueDisplay> |
| 36 | 37 | ||
| 37 | ```yue | 38 | ```yue |
| @@ -68,6 +69,7 @@ if $and f1!, f2!, f3! | |||
| 68 | ## Inserir códigos brutos | 69 | ## Inserir códigos brutos |
| 69 | 70 | ||
| 70 | Uma função macro pode retornar uma string YueScript ou uma tabela de configuração contendo códigos Lua. | 71 | Uma função macro pode retornar uma string YueScript ou uma tabela de configuração contendo códigos Lua. |
| 72 | |||
| 71 | ```yuescript | 73 | ```yuescript |
| 72 | macro yueFunc = (var) -> "local #{var} = ->" | 74 | macro yueFunc = (var) -> "local #{var} = ->" |
| 73 | $yueFunc funcA | 75 | $yueFunc funcA |
| @@ -93,6 +95,7 @@ if cond then | |||
| 93 | end | 95 | end |
| 94 | ]==] | 96 | ]==] |
| 95 | ``` | 97 | ``` |
| 98 | |||
| 96 | <YueDisplay> | 99 | <YueDisplay> |
| 97 | 100 | ||
| 98 | ```yue | 101 | ```yue |
| @@ -126,6 +129,7 @@ end | |||
| 126 | ## Exportar macro | 129 | ## Exportar macro |
| 127 | 130 | ||
| 128 | Funções macro podem ser exportadas de um módulo e importadas em outro módulo. Você deve colocar funções export macro em um único arquivo para uso, e apenas definição de macro, importação de macro e expansão de macro inline podem ser colocadas no módulo exportador de macro. | 131 | Funções macro podem ser exportadas de um módulo e importadas em outro módulo. Você deve colocar funções export macro em um único arquivo para uso, e apenas definição de macro, importação de macro e expansão de macro inline podem ser colocadas no módulo exportador de macro. |
| 132 | |||
| 129 | ```yuescript | 133 | ```yuescript |
| 130 | -- arquivo: utils.yue | 134 | -- arquivo: utils.yue |
| 131 | export macro map = (items, action) -> "[#{action} for _ in *#{items}]" | 135 | export macro map = (items, action) -> "[#{action} for _ in *#{items}]" |
| @@ -140,6 +144,7 @@ import "utils" as { | |||
| 140 | } | 144 | } |
| 141 | [1, 2, 3] |> $map(_ * 2) |> $filter(_ > 4) |> $each print _ | 145 | [1, 2, 3] |> $map(_ * 2) |> $filter(_ > 4) |> $each print _ |
| 142 | ``` | 146 | ``` |
| 147 | |||
| 143 | <YueDisplay> | 148 | <YueDisplay> |
| 144 | 149 | ||
| 145 | ```yue | 150 | ```yue |
| @@ -164,10 +169,12 @@ import "utils" as { | |||
| 164 | ## Macro embutida | 169 | ## Macro embutida |
| 165 | 170 | ||
| 166 | Existem algumas macros embutidas, mas você pode sobrescrevê-las declarando macros com os mesmos nomes. | 171 | Existem algumas macros embutidas, mas você pode sobrescrevê-las declarando macros com os mesmos nomes. |
| 172 | |||
| 167 | ```yuescript | 173 | ```yuescript |
| 168 | print $FILE -- obtém string do nome do módulo atual | 174 | print $FILE -- obtém string do nome do módulo atual |
| 169 | print $LINE -- obtém número 2 | 175 | print $LINE -- obtém número 2 |
| 170 | ``` | 176 | ``` |
| 177 | |||
| 171 | <YueDisplay> | 178 | <YueDisplay> |
| 172 | 179 | ||
| 173 | ```yue | 180 | ```yue |
| @@ -234,6 +241,7 @@ macro printNumAndStr = (num `Num, str `String) -> | | |||
| 234 | 241 | ||
| 235 | $printNumAndStr 123, "hello" | 242 | $printNumAndStr 123, "hello" |
| 236 | ``` | 243 | ``` |
| 244 | |||
| 237 | <YueDisplay> | 245 | <YueDisplay> |
| 238 | 246 | ||
| 239 | ```yue | 247 | ```yue |
| @@ -258,6 +266,7 @@ macro printNumAndStr = (num, str) -> | |||
| 258 | 266 | ||
| 259 | $printNumAndStr 123, "hello" | 267 | $printNumAndStr 123, "hello" |
| 260 | ``` | 268 | ``` |
| 269 | |||
| 261 | <YueDisplay> | 270 | <YueDisplay> |
| 262 | 271 | ||
| 263 | ```yue | 272 | ```yue |
diff --git a/doc/docs/pt-br/doc/advanced/module.md b/doc/docs/pt-br/doc/advanced/module.md index 34fd106..ed13107 100644 --- a/doc/docs/pt-br/doc/advanced/module.md +++ b/doc/docs/pt-br/doc/advanced/module.md | |||
| @@ -28,6 +28,7 @@ do | |||
| 28 | import "lpeg" as :C, :Ct, :Cmt | 28 | import "lpeg" as :C, :Ct, :Cmt |
| 29 | import "export" as {one, two, Something:{umm:{ch}}} | 29 | import "export" as {one, two, Something:{umm:{ch}}} |
| 30 | ``` | 30 | ``` |
| 31 | |||
| 31 | <YueDisplay> | 32 | <YueDisplay> |
| 32 | 33 | ||
| 33 | ```yue | 34 | ```yue |
| @@ -67,6 +68,7 @@ do | |||
| 67 | import table.concat | 68 | import table.concat |
| 68 | print concat ["a", tostring 1] | 69 | print concat ["a", tostring 1] |
| 69 | ``` | 70 | ``` |
| 71 | |||
| 70 | <YueDisplay> | 72 | <YueDisplay> |
| 71 | 73 | ||
| 72 | ```yue | 74 | ```yue |
| @@ -98,6 +100,7 @@ do | |||
| 98 | print FLAG | 100 | print FLAG |
| 99 | FLAG = 123 | 101 | FLAG = 123 |
| 100 | ``` | 102 | ``` |
| 103 | |||
| 101 | <YueDisplay> | 104 | <YueDisplay> |
| 102 | 105 | ||
| 103 | ```yue | 106 | ```yue |
| @@ -140,6 +143,7 @@ export y = -> | |||
| 140 | export class Something | 143 | export class Something |
| 141 | umm: "cool" | 144 | umm: "cool" |
| 142 | ``` | 145 | ``` |
| 146 | |||
| 143 | <YueDisplay> | 147 | <YueDisplay> |
| 144 | 148 | ||
| 145 | ```yue | 149 | ```yue |
| @@ -166,6 +170,7 @@ Fazendo export nomeado com desestruturação. | |||
| 166 | export :loadstring, to_lua: tolua = yue | 170 | export :loadstring, to_lua: tolua = yue |
| 167 | export {itemA: {:fieldA = 'default'}} = tb | 171 | export {itemA: {:fieldA = 'default'}} = tb |
| 168 | ``` | 172 | ``` |
| 173 | |||
| 169 | <YueDisplay> | 174 | <YueDisplay> |
| 170 | 175 | ||
| 171 | ```yue | 176 | ```yue |
| @@ -182,6 +187,7 @@ export.itemA = tb | |||
| 182 | export.<index> = items | 187 | export.<index> = items |
| 183 | export["a-b-c"] = 123 | 188 | export["a-b-c"] = 123 |
| 184 | ``` | 189 | ``` |
| 190 | |||
| 185 | <YueDisplay> | 191 | <YueDisplay> |
| 186 | 192 | ||
| 187 | ```yue | 193 | ```yue |
| @@ -208,6 +214,7 @@ else | |||
| 208 | export with tmp | 214 | export with tmp |
| 209 | j = 2000 | 215 | j = 2000 |
| 210 | ``` | 216 | ``` |
| 217 | |||
| 211 | <YueDisplay> | 218 | <YueDisplay> |
| 212 | 219 | ||
| 213 | ```yue | 220 | ```yue |
| @@ -234,6 +241,7 @@ export default -> | |||
| 234 | print "hello" | 241 | print "hello" |
| 235 | 123 | 242 | 123 |
| 236 | ``` | 243 | ``` |
| 244 | |||
| 237 | <YueDisplay> | 245 | <YueDisplay> |
| 238 | 246 | ||
| 239 | ```yue | 247 | ```yue |
diff --git a/doc/docs/pt-br/doc/advanced/try.md b/doc/docs/pt-br/doc/advanced/try.md index fbb4e87..0223feb 100644 --- a/doc/docs/pt-br/doc/advanced/try.md +++ b/doc/docs/pt-br/doc/advanced/try.md | |||
| @@ -29,6 +29,7 @@ catch err | |||
| 29 | print yue.traceback err | 29 | print yue.traceback err |
| 30 | print result | 30 | print result |
| 31 | ``` | 31 | ``` |
| 32 | |||
| 32 | <YueDisplay> | 33 | <YueDisplay> |
| 33 | 34 | ||
| 34 | ```yue | 35 | ```yue |
| @@ -82,6 +83,7 @@ catch e | |||
| 82 | print e | 83 | print e |
| 83 | e | 84 | e |
| 84 | ``` | 85 | ``` |
| 86 | |||
| 85 | <YueDisplay> | 87 | <YueDisplay> |
| 86 | 88 | ||
| 87 | ```yue | 89 | ```yue |
diff --git a/doc/docs/pt-br/doc/assignment/assignment.md b/doc/docs/pt-br/doc/assignment/assignment.md index 1da6bb0..ac3838f 100644 --- a/doc/docs/pt-br/doc/assignment/assignment.md +++ b/doc/docs/pt-br/doc/assignment/assignment.md | |||
| @@ -7,6 +7,7 @@ hello = "world" | |||
| 7 | a, b, c = 1, 2, 3 | 7 | a, b, c = 1, 2, 3 |
| 8 | hello = 123 -- usa a variável existente | 8 | hello = 123 -- usa a variável existente |
| 9 | ``` | 9 | ``` |
| 10 | |||
| 10 | <YueDisplay> | 11 | <YueDisplay> |
| 11 | 12 | ||
| 12 | ```yue | 13 | ```yue |
| @@ -20,6 +21,7 @@ hello = 123 -- usa a variável existente | |||
| 20 | ## Atualização | 21 | ## Atualização |
| 21 | 22 | ||
| 22 | Você pode realizar atribuição de atualização com muitos operadores binários. | 23 | Você pode realizar atribuição de atualização com muitos operadores binários. |
| 24 | |||
| 23 | ```yuescript | 25 | ```yuescript |
| 24 | x = 1 | 26 | x = 1 |
| 25 | x += 1 | 27 | x += 1 |
| @@ -30,6 +32,7 @@ x %= 10 | |||
| 30 | s ..= "world" -- adiciona um novo local se a variável local não existir | 32 | s ..= "world" -- adiciona um novo local se a variável local não existir |
| 31 | arg or= "valor padrão" | 33 | arg or= "valor padrão" |
| 32 | ``` | 34 | ``` |
| 35 | |||
| 33 | <YueDisplay> | 36 | <YueDisplay> |
| 34 | 37 | ||
| 35 | ```yue | 38 | ```yue |
| @@ -48,10 +51,12 @@ arg or= "valor padrão" | |||
| 48 | ## Atribuição encadeada | 51 | ## Atribuição encadeada |
| 49 | 52 | ||
| 50 | Você pode fazer atribuição encadeada para atribuir múltiplos itens ao mesmo valor. | 53 | Você pode fazer atribuição encadeada para atribuir múltiplos itens ao mesmo valor. |
| 54 | |||
| 51 | ```yuescript | 55 | ```yuescript |
| 52 | a = b = c = d = e = 0 | 56 | a = b = c = d = e = 0 |
| 53 | x = y = z = f! | 57 | x = y = z = f! |
| 54 | ``` | 58 | ``` |
| 59 | |||
| 55 | <YueDisplay> | 60 | <YueDisplay> |
| 56 | 61 | ||
| 57 | ```yue | 62 | ```yue |
| @@ -62,6 +67,7 @@ x = y = z = f! | |||
| 62 | </YueDisplay> | 67 | </YueDisplay> |
| 63 | 68 | ||
| 64 | ## Locais explÃcitos | 69 | ## Locais explÃcitos |
| 70 | |||
| 65 | ```yuescript | 71 | ```yuescript |
| 66 | do | 72 | do |
| 67 | local a = 1 | 73 | local a = 1 |
| @@ -78,6 +84,7 @@ do | |||
| 78 | a = 1 | 84 | a = 1 |
| 79 | B = 2 | 85 | B = 2 |
| 80 | ``` | 86 | ``` |
| 87 | |||
| 81 | <YueDisplay> | 88 | <YueDisplay> |
| 82 | 89 | ||
| 83 | ```yue | 90 | ```yue |
| @@ -100,6 +107,7 @@ do | |||
| 100 | </YueDisplay> | 107 | </YueDisplay> |
| 101 | 108 | ||
| 102 | ## Globais explÃcitos | 109 | ## Globais explÃcitos |
| 110 | |||
| 103 | ```yuescript | 111 | ```yuescript |
| 104 | do | 112 | do |
| 105 | global a = 1 | 113 | global a = 1 |
| @@ -116,6 +124,7 @@ do | |||
| 116 | B = 2 | 124 | B = 2 |
| 117 | local Temp = "um valor local" | 125 | local Temp = "um valor local" |
| 118 | ``` | 126 | ``` |
| 127 | |||
| 119 | <YueDisplay> | 128 | <YueDisplay> |
| 120 | 129 | ||
| 121 | ```yue | 130 | ```yue |
diff --git a/doc/docs/pt-br/doc/assignment/destructuring-assignment.md b/doc/docs/pt-br/doc/assignment/destructuring-assignment.md index 7692885..0c96d4a 100644 --- a/doc/docs/pt-br/doc/assignment/destructuring-assignment.md +++ b/doc/docs/pt-br/doc/assignment/destructuring-assignment.md | |||
| @@ -12,6 +12,7 @@ thing = [1, 2] | |||
| 12 | [a, b] = thing | 12 | [a, b] = thing |
| 13 | print a, b | 13 | print a, b |
| 14 | ``` | 14 | ``` |
| 15 | |||
| 15 | <YueDisplay> | 16 | <YueDisplay> |
| 16 | 17 | ||
| 17 | ```yue | 18 | ```yue |
| @@ -37,6 +38,7 @@ print hello, the_day | |||
| 37 | 38 | ||
| 38 | :day = obj -- OK fazer desestruturação simples sem chaves | 39 | :day = obj -- OK fazer desestruturação simples sem chaves |
| 39 | ``` | 40 | ``` |
| 41 | |||
| 40 | <YueDisplay> | 42 | <YueDisplay> |
| 41 | 43 | ||
| 42 | ```yue | 44 | ```yue |
| @@ -68,6 +70,7 @@ obj2 = { | |||
| 68 | {numbers: [first, second], properties: {color: color}} = obj2 | 70 | {numbers: [first, second], properties: {color: color}} = obj2 |
| 69 | print first, second, color | 71 | print first, second, color |
| 70 | ``` | 72 | ``` |
| 73 | |||
| 71 | <YueDisplay> | 74 | <YueDisplay> |
| 72 | 75 | ||
| 73 | ```yue | 76 | ```yue |
| @@ -95,6 +98,7 @@ Se a instrução de desestruturação for complicada, sinta-se à vontade para e | |||
| 95 | } | 98 | } |
| 96 | } = obj2 | 99 | } = obj2 |
| 97 | ``` | 100 | ``` |
| 101 | |||
| 98 | <YueDisplay> | 102 | <YueDisplay> |
| 99 | 103 | ||
| 100 | ```yue | 104 | ```yue |
| @@ -113,6 +117,7 @@ Se a instrução de desestruturação for complicada, sinta-se à vontade para e | |||
| 113 | ```yuescript | 117 | ```yuescript |
| 114 | {:concat, :insert} = table | 118 | {:concat, :insert} = table |
| 115 | ``` | 119 | ``` |
| 120 | |||
| 116 | <YueDisplay> | 121 | <YueDisplay> |
| 117 | 122 | ||
| 118 | ```yue | 123 | ```yue |
| @@ -126,6 +131,7 @@ Isso é efetivamente o mesmo que import, mas podemos renomear campos que queremo | |||
| 126 | ```yuescript | 131 | ```yuescript |
| 127 | {:mix, :max, random: rand} = math | 132 | {:mix, :max, random: rand} = math |
| 128 | ``` | 133 | ``` |
| 134 | |||
| 129 | <YueDisplay> | 135 | <YueDisplay> |
| 130 | 136 | ||
| 131 | ```yue | 137 | ```yue |
| @@ -139,6 +145,7 @@ Você pode escrever valores padrão ao fazer desestruturação: | |||
| 139 | ```yuescript | 145 | ```yuescript |
| 140 | {:name = "sem nome", :job = "sem emprego"} = person | 146 | {:name = "sem nome", :job = "sem emprego"} = person |
| 141 | ``` | 147 | ``` |
| 148 | |||
| 142 | <YueDisplay> | 149 | <YueDisplay> |
| 143 | 150 | ||
| 144 | ```yue | 151 | ```yue |
| @@ -152,6 +159,7 @@ Você pode usar `_` como placeholder ao fazer desestruturação de lista: | |||
| 152 | ```yuescript | 159 | ```yuescript |
| 153 | [_, two, _, four] = items | 160 | [_, two, _, four] = items |
| 154 | ``` | 161 | ``` |
| 162 | |||
| 155 | <YueDisplay> | 163 | <YueDisplay> |
| 156 | 164 | ||
| 157 | ```yue | 165 | ```yue |
| @@ -171,6 +179,7 @@ print first -- imprime: first | |||
| 171 | print bulk -- imprime: {"second", "third", "fourth"} | 179 | print bulk -- imprime: {"second", "third", "fourth"} |
| 172 | print last -- imprime: last | 180 | print last -- imprime: last |
| 173 | ``` | 181 | ``` |
| 182 | |||
| 174 | <YueDisplay> | 183 | <YueDisplay> |
| 175 | 184 | ||
| 176 | ```yue | 185 | ```yue |
| @@ -195,6 +204,7 @@ O operador spread pode ser usado em diferentes posições para capturar diferent | |||
| 195 | -- Capturar tudo exceto os elementos do meio | 204 | -- Capturar tudo exceto os elementos do meio |
| 196 | [first, ..._, last] = orders | 205 | [first, ..._, last] = orders |
| 197 | ``` | 206 | ``` |
| 207 | |||
| 198 | <YueDisplay> | 208 | <YueDisplay> |
| 199 | 209 | ||
| 200 | ```yue | 210 | ```yue |
| @@ -223,6 +233,7 @@ tuples = [ | |||
| 223 | for [left, right] in *tuples | 233 | for [left, right] in *tuples |
| 224 | print left, right | 234 | print left, right |
| 225 | ``` | 235 | ``` |
| 236 | |||
| 226 | <YueDisplay> | 237 | <YueDisplay> |
| 227 | 238 | ||
| 228 | ```yue | 239 | ```yue |
diff --git a/doc/docs/pt-br/doc/assignment/if-assignment.md b/doc/docs/pt-br/doc/assignment/if-assignment.md index 84094ed..7b1a852 100644 --- a/doc/docs/pt-br/doc/assignment/if-assignment.md +++ b/doc/docs/pt-br/doc/assignment/if-assignment.md | |||
| @@ -6,6 +6,7 @@ Os blocos `if` e `elseif` podem receber uma atribuição no lugar de uma express | |||
| 6 | if user := database.find_user "moon" | 6 | if user := database.find_user "moon" |
| 7 | print user.name | 7 | print user.name |
| 8 | ``` | 8 | ``` |
| 9 | |||
| 9 | <YueDisplay> | 10 | <YueDisplay> |
| 10 | 11 | ||
| 11 | ```yue | 12 | ```yue |
| @@ -23,6 +24,7 @@ elseif world := os.getenv "world" | |||
| 23 | else | 24 | else |
| 24 | print "nada :(" | 25 | print "nada :(" |
| 25 | ``` | 26 | ``` |
| 27 | |||
| 26 | <YueDisplay> | 28 | <YueDisplay> |
| 27 | 29 | ||
| 28 | ```yue | 30 | ```yue |
| @@ -37,11 +39,13 @@ else | |||
| 37 | </YueDisplay> | 39 | </YueDisplay> |
| 38 | 40 | ||
| 39 | Atribuição em if com múltiplos valores de retorno. Apenas o primeiro valor é verificado, os outros valores estão no escopo. | 41 | Atribuição em if com múltiplos valores de retorno. Apenas o primeiro valor é verificado, os outros valores estão no escopo. |
| 42 | |||
| 40 | ```yuescript | 43 | ```yuescript |
| 41 | if success, result := pcall -> "obter resultado sem problemas" | 44 | if success, result := pcall -> "obter resultado sem problemas" |
| 42 | print result -- variável result está no escopo | 45 | print result -- variável result está no escopo |
| 43 | print "OK" | 46 | print "OK" |
| 44 | ``` | 47 | ``` |
| 48 | |||
| 45 | <YueDisplay> | 49 | <YueDisplay> |
| 46 | 50 | ||
| 47 | ```yue | 51 | ```yue |
| @@ -61,6 +65,7 @@ while byte := stream\read_one! | |||
| 61 | -- fazer algo com o byte | 65 | -- fazer algo com o byte |
| 62 | print byte | 66 | print byte |
| 63 | ``` | 67 | ``` |
| 68 | |||
| 64 | <YueDisplay> | 69 | <YueDisplay> |
| 65 | 70 | ||
| 66 | ```yue | 71 | ```yue |
diff --git a/doc/docs/pt-br/doc/assignment/the-using-clause-controlling-destructive-assignment.md b/doc/docs/pt-br/doc/assignment/the-using-clause-controlling-destructive-assignment.md index 02d4162..c49aa15 100644 --- a/doc/docs/pt-br/doc/assignment/the-using-clause-controlling-destructive-assignment.md +++ b/doc/docs/pt-br/doc/assignment/the-using-clause-controlling-destructive-assignment.md | |||
| @@ -17,6 +17,7 @@ my_func! | |||
| 17 | 17 | ||
| 18 | print i -- vai imprimir 0 | 18 | print i -- vai imprimir 0 |
| 19 | ``` | 19 | ``` |
| 20 | |||
| 20 | <YueDisplay> | 21 | <YueDisplay> |
| 21 | 22 | ||
| 22 | ```yue | 23 | ```yue |
| @@ -52,6 +53,7 @@ my_func = (using nil) -> | |||
| 52 | my_func! | 53 | my_func! |
| 53 | print i -- imprime 100, i não é afetado | 54 | print i -- imprime 100, i não é afetado |
| 54 | ``` | 55 | ``` |
| 56 | |||
| 55 | <YueDisplay> | 57 | <YueDisplay> |
| 56 | 58 | ||
| 57 | ```yue | 59 | ```yue |
| @@ -80,6 +82,7 @@ my_func = (add using k, i) -> | |||
| 80 | my_func(22) | 82 | my_func(22) |
| 81 | print i, k -- estes foram atualizados | 83 | print i, k -- estes foram atualizados |
| 82 | ``` | 84 | ``` |
| 85 | |||
| 83 | <YueDisplay> | 86 | <YueDisplay> |
| 84 | 87 | ||
| 85 | ```yue | 88 | ```yue |
diff --git a/doc/docs/pt-br/doc/assignment/varargs-assignment.md b/doc/docs/pt-br/doc/assignment/varargs-assignment.md index 0aab540..6ac67e0 100644 --- a/doc/docs/pt-br/doc/assignment/varargs-assignment.md +++ b/doc/docs/pt-br/doc/assignment/varargs-assignment.md | |||
| @@ -10,6 +10,7 @@ count = select '#', ... | |||
| 10 | first = select 1, ... | 10 | first = select 1, ... |
| 11 | print ok, count, first | 11 | print ok, count, first |
| 12 | ``` | 12 | ``` |
| 13 | |||
| 13 | <YueDisplay> | 14 | <YueDisplay> |
| 14 | 15 | ||
| 15 | ```yue | 16 | ```yue |
diff --git a/doc/docs/pt-br/doc/control-flow/conditionals.md b/doc/docs/pt-br/doc/control-flow/conditionals.md index 94e41ec..bc12d4e 100644 --- a/doc/docs/pt-br/doc/control-flow/conditionals.md +++ b/doc/docs/pt-br/doc/control-flow/conditionals.md | |||
| @@ -7,6 +7,7 @@ if have_coins | |||
| 7 | else | 7 | else |
| 8 | print "Sem moedas" | 8 | print "Sem moedas" |
| 9 | ``` | 9 | ``` |
| 10 | |||
| 10 | <YueDisplay> | 11 | <YueDisplay> |
| 11 | 12 | ||
| 12 | ```yue | 13 | ```yue |
| @@ -25,6 +26,7 @@ Uma sintaxe curta para instruções únicas também pode ser usada: | |||
| 25 | have_coins = false | 26 | have_coins = false |
| 26 | if have_coins then print "Tem moedas" else print "Sem moedas" | 27 | if have_coins then print "Tem moedas" else print "Sem moedas" |
| 27 | ``` | 28 | ``` |
| 29 | |||
| 28 | <YueDisplay> | 30 | <YueDisplay> |
| 29 | 31 | ||
| 30 | ```yue | 32 | ```yue |
| @@ -40,6 +42,7 @@ Como instruções if podem ser usadas como expressões, isso também pode ser es | |||
| 40 | have_coins = false | 42 | have_coins = false |
| 41 | print if have_coins then "Tem moedas" else "Sem moedas" | 43 | print if have_coins then "Tem moedas" else "Sem moedas" |
| 42 | ``` | 44 | ``` |
| 45 | |||
| 43 | <YueDisplay> | 46 | <YueDisplay> |
| 44 | 47 | ||
| 45 | ```yue | 48 | ```yue |
| @@ -65,6 +68,7 @@ else | |||
| 65 | 68 | ||
| 66 | print message -- imprime: Sou muito alto | 69 | print message -- imprime: Sou muito alto |
| 67 | ``` | 70 | ``` |
| 71 | |||
| 68 | <YueDisplay> | 72 | <YueDisplay> |
| 69 | 73 | ||
| 70 | ```yue | 74 | ```yue |
| @@ -90,6 +94,7 @@ O oposto de if é unless: | |||
| 90 | unless os.date("%A") == "Monday" | 94 | unless os.date("%A") == "Monday" |
| 91 | print "não é segunda-feira!" | 95 | print "não é segunda-feira!" |
| 92 | ``` | 96 | ``` |
| 97 | |||
| 93 | <YueDisplay> | 98 | <YueDisplay> |
| 94 | 99 | ||
| 95 | ```yue | 100 | ```yue |
| @@ -102,6 +107,7 @@ unless os.date("%A") == "Monday" | |||
| 102 | ```yuescript | 107 | ```yuescript |
| 103 | print "Você tem sorte!" unless math.random! > 0.1 | 108 | print "Você tem sorte!" unless math.random! > 0.1 |
| 104 | ``` | 109 | ``` |
| 110 | |||
| 105 | <YueDisplay> | 111 | <YueDisplay> |
| 106 | 112 | ||
| 107 | ```yue | 113 | ```yue |
| @@ -123,6 +129,7 @@ if a in [1, 3, 5, 7] | |||
| 123 | if a in list | 129 | if a in list |
| 124 | print "verificando se `a` está na lista" | 130 | print "verificando se `a` está na lista" |
| 125 | ``` | 131 | ``` |
| 132 | |||
| 126 | <YueDisplay> | 133 | <YueDisplay> |
| 127 | 134 | ||
| 128 | ```yue | 135 | ```yue |
diff --git a/doc/docs/pt-br/doc/control-flow/continue.md b/doc/docs/pt-br/doc/control-flow/continue.md index 8a3cdff..645bcb4 100644 --- a/doc/docs/pt-br/doc/control-flow/continue.md +++ b/doc/docs/pt-br/doc/control-flow/continue.md | |||
| @@ -9,6 +9,7 @@ while i < 10 | |||
| 9 | continue if i % 2 == 0 | 9 | continue if i % 2 == 0 |
| 10 | print i | 10 | print i |
| 11 | ``` | 11 | ``` |
| 12 | |||
| 12 | <YueDisplay> | 13 | <YueDisplay> |
| 13 | 14 | ||
| 14 | ```yue | 15 | ```yue |
| @@ -29,6 +30,7 @@ odds = for x in *my_numbers | |||
| 29 | continue if x % 2 == 1 | 30 | continue if x % 2 == 1 |
| 30 | x | 31 | x |
| 31 | ``` | 32 | ``` |
| 33 | |||
| 32 | <YueDisplay> | 34 | <YueDisplay> |
| 33 | 35 | ||
| 34 | ```yue | 36 | ```yue |
diff --git a/doc/docs/pt-br/doc/control-flow/for-loop.md b/doc/docs/pt-br/doc/control-flow/for-loop.md index dfd8285..4c99e6d 100644 --- a/doc/docs/pt-br/doc/control-flow/for-loop.md +++ b/doc/docs/pt-br/doc/control-flow/for-loop.md | |||
| @@ -12,6 +12,7 @@ for k = 1, 15, 2 -- um passo opcional fornecido | |||
| 12 | for key, value in pairs object | 12 | for key, value in pairs object |
| 13 | print key, value | 13 | print key, value |
| 14 | ``` | 14 | ``` |
| 15 | |||
| 15 | <YueDisplay> | 16 | <YueDisplay> |
| 16 | 17 | ||
| 17 | ```yue | 18 | ```yue |
| @@ -33,6 +34,7 @@ Os operadores de slicing e **\*** podem ser usados, assim como com compreensões | |||
| 33 | for item in *items[2, 4] | 34 | for item in *items[2, 4] |
| 34 | print item | 35 | print item |
| 35 | ``` | 36 | ``` |
| 37 | |||
| 36 | <YueDisplay> | 38 | <YueDisplay> |
| 37 | 39 | ||
| 38 | ```yue | 40 | ```yue |
| @@ -49,6 +51,7 @@ for item in *items do print item | |||
| 49 | 51 | ||
| 50 | for j = 1, 10, 3 do print j | 52 | for j = 1, 10, 3 do print j |
| 51 | ``` | 53 | ``` |
| 54 | |||
| 52 | <YueDisplay> | 55 | <YueDisplay> |
| 53 | 56 | ||
| 54 | ```yue | 57 | ```yue |
| @@ -70,6 +73,7 @@ doubled_evens = for i = 1, 20 | |||
| 70 | else | 73 | else |
| 71 | i | 74 | i |
| 72 | ``` | 75 | ``` |
| 76 | |||
| 73 | <YueDisplay> | 77 | <YueDisplay> |
| 74 | 78 | ||
| 75 | ```yue | 79 | ```yue |
| @@ -90,6 +94,7 @@ Por exemplo, para encontrar o primeiro número maior que 10: | |||
| 90 | first_large = for n in *numbers | 94 | first_large = for n in *numbers |
| 91 | break n if n > 10 | 95 | break n if n > 10 |
| 92 | ``` | 96 | ``` |
| 97 | |||
| 93 | <YueDisplay> | 98 | <YueDisplay> |
| 94 | 99 | ||
| 95 | ```yue | 100 | ```yue |
| @@ -112,6 +117,7 @@ func_b = -> return for i = 1, 10 do i | |||
| 112 | print func_a! -- imprime nil | 117 | print func_a! -- imprime nil |
| 113 | print func_b! -- imprime objeto table | 118 | print func_b! -- imprime objeto table |
| 114 | ``` | 119 | ``` |
| 120 | |||
| 115 | <YueDisplay> | 121 | <YueDisplay> |
| 116 | 122 | ||
| 117 | ```yue | 123 | ```yue |
diff --git a/doc/docs/pt-br/doc/control-flow/switch.md b/doc/docs/pt-br/doc/control-flow/switch.md index 5c87327..bc41bad 100644 --- a/doc/docs/pt-br/doc/control-flow/switch.md +++ b/doc/docs/pt-br/doc/control-flow/switch.md | |||
| @@ -11,6 +11,7 @@ switch name := "Dan" | |||
| 11 | else | 11 | else |
| 12 | print "Não sei quem você é com o nome #{name}" | 12 | print "Não sei quem você é com o nome #{name}" |
| 13 | ``` | 13 | ``` |
| 14 | |||
| 14 | <YueDisplay> | 15 | <YueDisplay> |
| 15 | 16 | ||
| 16 | ```yue | 17 | ```yue |
| @@ -39,6 +40,7 @@ next_number = switch b | |||
| 39 | else | 40 | else |
| 40 | error "não consigo contar tão alto!" | 41 | error "não consigo contar tão alto!" |
| 41 | ``` | 42 | ``` |
| 43 | |||
| 42 | <YueDisplay> | 44 | <YueDisplay> |
| 43 | 45 | ||
| 44 | ```yue | 46 | ```yue |
| @@ -62,6 +64,7 @@ msg = switch math.random(1, 5) | |||
| 62 | when 2 then "você quase tem sorte" | 64 | when 2 then "você quase tem sorte" |
| 63 | else "não tão sortudo" | 65 | else "não tão sortudo" |
| 64 | ``` | 66 | ``` |
| 67 | |||
| 65 | <YueDisplay> | 68 | <YueDisplay> |
| 66 | 69 | ||
| 67 | ```yue | 70 | ```yue |
| @@ -87,6 +90,7 @@ switch math.random(1, 5) when 1 | |||
| 87 | else | 90 | else |
| 88 | print "não tão sortudo" | 91 | print "não tão sortudo" |
| 89 | ``` | 92 | ``` |
| 93 | |||
| 90 | <YueDisplay> | 94 | <YueDisplay> |
| 91 | 95 | ||
| 92 | ```yue | 96 | ```yue |
| @@ -124,6 +128,7 @@ for item in *items | |||
| 124 | when :width, :height | 128 | when :width, :height |
| 125 | print "tamanho #{width}, #{height}" | 129 | print "tamanho #{width}, #{height}" |
| 126 | ``` | 130 | ``` |
| 131 | |||
| 127 | <YueDisplay> | 132 | <YueDisplay> |
| 128 | 133 | ||
| 129 | ```yue | 134 | ```yue |
| @@ -154,6 +159,7 @@ switch item | |||
| 154 | when {pos: {:x = 50, :y = 200}} | 159 | when {pos: {:x = 50, :y = 200}} |
| 155 | print "Vec2 #{x}, #{y}" -- a desestruturação de tabela ainda passará | 160 | print "Vec2 #{x}, #{y}" -- a desestruturação de tabela ainda passará |
| 156 | ``` | 161 | ``` |
| 162 | |||
| 157 | <YueDisplay> | 163 | <YueDisplay> |
| 158 | 164 | ||
| 159 | ```yue | 165 | ```yue |
| @@ -181,6 +187,7 @@ switch tb | |||
| 181 | when [1, 2, b = 3] -- b tem valor padrão | 187 | when [1, 2, b = 3] -- b tem valor padrão |
| 182 | print "1, 2, #{b}" | 188 | print "1, 2, #{b}" |
| 183 | ``` | 189 | ``` |
| 190 | |||
| 184 | <YueDisplay> | 191 | <YueDisplay> |
| 185 | 192 | ||
| 186 | ```yue | 193 | ```yue |
| @@ -206,6 +213,7 @@ switch tb | |||
| 206 | else | 213 | else |
| 207 | print "inválido" | 214 | print "inválido" |
| 208 | ``` | 215 | ``` |
| 216 | |||
| 209 | <YueDisplay> | 217 | <YueDisplay> |
| 210 | 218 | ||
| 211 | ```yue | 219 | ```yue |
| @@ -231,6 +239,7 @@ switch tb | |||
| 231 | else | 239 | else |
| 232 | print "inválido" | 240 | print "inválido" |
| 233 | ``` | 241 | ``` |
| 242 | |||
| 234 | <YueDisplay> | 243 | <YueDisplay> |
| 235 | 244 | ||
| 236 | ```yue | 245 | ```yue |
| @@ -257,6 +266,7 @@ switch tb | |||
| 257 | ] | 266 | ] |
| 258 | print "correspondido", fourth | 267 | print "correspondido", fourth |
| 259 | ``` | 268 | ``` |
| 269 | |||
| 260 | <YueDisplay> | 270 | <YueDisplay> |
| 261 | 271 | ||
| 262 | ```yue | 272 | ```yue |
| @@ -282,6 +292,7 @@ switch segments | |||
| 282 | print "Recurso:", resource -- imprime: "logs" | 292 | print "Recurso:", resource -- imprime: "logs" |
| 283 | print "Ação:", action -- imprime: "view" | 293 | print "Ação:", action -- imprime: "view" |
| 284 | ``` | 294 | ``` |
| 295 | |||
| 285 | <YueDisplay> | 296 | <YueDisplay> |
| 286 | 297 | ||
| 287 | ```yue | 298 | ```yue |
diff --git a/doc/docs/pt-br/doc/control-flow/while-loop.md b/doc/docs/pt-br/doc/control-flow/while-loop.md index f47f00c..2deb5aa 100644 --- a/doc/docs/pt-br/doc/control-flow/while-loop.md +++ b/doc/docs/pt-br/doc/control-flow/while-loop.md | |||
| @@ -10,6 +10,7 @@ while i > 0 | |||
| 10 | 10 | ||
| 11 | while running == true do my_function! | 11 | while running == true do my_function! |
| 12 | ``` | 12 | ``` |
| 13 | |||
| 13 | <YueDisplay> | 14 | <YueDisplay> |
| 14 | 15 | ||
| 15 | ```yue | 16 | ```yue |
| @@ -31,6 +32,7 @@ until i == 0 | |||
| 31 | 32 | ||
| 32 | until running == false do my_function! | 33 | until running == false do my_function! |
| 33 | ``` | 34 | ``` |
| 35 | |||
| 34 | <YueDisplay> | 36 | <YueDisplay> |
| 35 | 37 | ||
| 36 | ```yue | 38 | ```yue |
| @@ -56,6 +58,7 @@ repeat | |||
| 56 | i -= 1 | 58 | i -= 1 |
| 57 | until i == 0 | 59 | until i == 0 |
| 58 | ``` | 60 | ``` |
| 61 | |||
| 59 | <YueDisplay> | 62 | <YueDisplay> |
| 60 | 63 | ||
| 61 | ```yue | 64 | ```yue |
diff --git a/doc/docs/pt-br/doc/data-structures/comprehensions.md b/doc/docs/pt-br/doc/data-structures/comprehensions.md index 1694813..9651352 100644 --- a/doc/docs/pt-br/doc/data-structures/comprehensions.md +++ b/doc/docs/pt-br/doc/data-structures/comprehensions.md | |||
| @@ -10,6 +10,7 @@ O seguinte cria uma cópia da tabela items mas com todos os valores dobrados. | |||
| 10 | items = [ 1, 2, 3, 4 ] | 10 | items = [ 1, 2, 3, 4 ] |
| 11 | doubled = [item * 2 for i, item in ipairs items] | 11 | doubled = [item * 2 for i, item in ipairs items] |
| 12 | ``` | 12 | ``` |
| 13 | |||
| 13 | <YueDisplay> | 14 | <YueDisplay> |
| 14 | 15 | ||
| 15 | ```yue | 16 | ```yue |
| @@ -24,6 +25,7 @@ Os itens incluÃdos na nova tabela podem ser restringidos com uma cláusula when | |||
| 24 | ```yuescript | 25 | ```yuescript |
| 25 | slice = [item for i, item in ipairs items when i > 1 and i < 3] | 26 | slice = [item for i, item in ipairs items when i > 1 and i < 3] |
| 26 | ``` | 27 | ``` |
| 28 | |||
| 27 | <YueDisplay> | 29 | <YueDisplay> |
| 28 | 30 | ||
| 29 | ```yue | 31 | ```yue |
| @@ -37,6 +39,7 @@ Como é comum iterar sobre os valores de uma tabela indexada numericamente, um o | |||
| 37 | ```yuescript | 39 | ```yuescript |
| 38 | doubled = [item * 2 for item in *items] | 40 | doubled = [item * 2 for item in *items] |
| 39 | ``` | 41 | ``` |
| 42 | |||
| 40 | <YueDisplay> | 43 | <YueDisplay> |
| 41 | 44 | ||
| 42 | ```yue | 45 | ```yue |
| @@ -55,6 +58,7 @@ data = | |||
| 55 | flat = [...v for k,v in pairs data] | 58 | flat = [...v for k,v in pairs data] |
| 56 | -- flat agora é [1, 2, 3, 4, 5, 6] | 59 | -- flat agora é [1, 2, 3, 4, 5, 6] |
| 57 | ``` | 60 | ``` |
| 61 | |||
| 58 | <YueDisplay> | 62 | <YueDisplay> |
| 59 | 63 | ||
| 60 | ```yue | 64 | ```yue |
| @@ -79,6 +83,7 @@ y_coords = [9, 2, 3] | |||
| 79 | points = [ [x, y] for x in *x_coords \ | 83 | points = [ [x, y] for x in *x_coords \ |
| 80 | for y in *y_coords] | 84 | for y in *y_coords] |
| 81 | ``` | 85 | ``` |
| 86 | |||
| 82 | <YueDisplay> | 87 | <YueDisplay> |
| 83 | 88 | ||
| 84 | ```yue | 89 | ```yue |
| @@ -96,6 +101,7 @@ Loops for numéricos também podem ser usados em compreensões: | |||
| 96 | ```yuescript | 101 | ```yuescript |
| 97 | evens = [i for i = 1, 100 when i % 2 == 0] | 102 | evens = [i for i = 1, 100 when i % 2 == 0] |
| 98 | ``` | 103 | ``` |
| 104 | |||
| 99 | <YueDisplay> | 105 | <YueDisplay> |
| 100 | 106 | ||
| 101 | ```yue | 107 | ```yue |
| @@ -119,6 +125,7 @@ thing = { | |||
| 119 | 125 | ||
| 120 | thing_copy = {k, v for k, v in pairs thing} | 126 | thing_copy = {k, v for k, v in pairs thing} |
| 121 | ``` | 127 | ``` |
| 128 | |||
| 122 | <YueDisplay> | 129 | <YueDisplay> |
| 123 | 130 | ||
| 124 | ```yue | 131 | ```yue |
| @@ -136,6 +143,7 @@ thing_copy = {k, v for k, v in pairs thing} | |||
| 136 | ```yuescript | 143 | ```yuescript |
| 137 | no_color = {k, v for k, v in pairs thing when k != "color"} | 144 | no_color = {k, v for k, v in pairs thing when k != "color"} |
| 138 | ``` | 145 | ``` |
| 146 | |||
| 139 | <YueDisplay> | 147 | <YueDisplay> |
| 140 | 148 | ||
| 141 | ```yue | 149 | ```yue |
| @@ -150,6 +158,7 @@ O operador **\*** também é suportado. Aqui criamos uma tabela de consulta de r | |||
| 150 | numbers = [1, 2, 3, 4] | 158 | numbers = [1, 2, 3, 4] |
| 151 | sqrts = {i, math.sqrt i for i in *numbers} | 159 | sqrts = {i, math.sqrt i for i in *numbers} |
| 152 | ``` | 160 | ``` |
| 161 | |||
| 153 | <YueDisplay> | 162 | <YueDisplay> |
| 154 | 163 | ||
| 155 | ```yue | 164 | ```yue |
| @@ -167,6 +176,7 @@ Neste exemplo convertemos um array de pares em uma tabela onde o primeiro item d | |||
| 167 | tuples = [ ["hello", "world"], ["foo", "bar"]] | 176 | tuples = [ ["hello", "world"], ["foo", "bar"]] |
| 168 | tbl = {unpack tuple for tuple in *tuples} | 177 | tbl = {unpack tuple for tuple in *tuples} |
| 169 | ``` | 178 | ``` |
| 179 | |||
| 170 | <YueDisplay> | 180 | <YueDisplay> |
| 171 | 181 | ||
| 172 | ```yue | 182 | ```yue |
| @@ -185,6 +195,7 @@ Aqui podemos definir os limites mÃnimo e máximo, pegando todos os itens com à | |||
| 185 | ```yuescript | 195 | ```yuescript |
| 186 | slice = [item for item in *items[1, 5]] | 196 | slice = [item for item in *items[1, 5]] |
| 187 | ``` | 197 | ``` |
| 198 | |||
| 188 | <YueDisplay> | 199 | <YueDisplay> |
| 189 | 200 | ||
| 190 | ```yue | 201 | ```yue |
| @@ -198,6 +209,7 @@ Qualquer um dos argumentos do slice pode ser omitido para usar um padrão sensat | |||
| 198 | ```yuescript | 209 | ```yuescript |
| 199 | slice = [item for item in *items[2,]] | 210 | slice = [item for item in *items[2,]] |
| 200 | ``` | 211 | ``` |
| 212 | |||
| 201 | <YueDisplay> | 213 | <YueDisplay> |
| 202 | 214 | ||
| 203 | ```yue | 215 | ```yue |
| @@ -211,6 +223,7 @@ Se o limite mÃnimo for omitido, ele usa como padrão 1. Aqui fornecemos apenas | |||
| 211 | ```yuescript | 223 | ```yuescript |
| 212 | slice = [item for item in *items[,,2]] | 224 | slice = [item for item in *items[,,2]] |
| 213 | ``` | 225 | ``` |
| 226 | |||
| 214 | <YueDisplay> | 227 | <YueDisplay> |
| 215 | 228 | ||
| 216 | ```yue | 229 | ```yue |
| @@ -225,6 +238,7 @@ Tanto o limite mÃnimo quanto o máximo podem ser negativos, o que significa que | |||
| 225 | -- pegar os últimos 4 itens | 238 | -- pegar os últimos 4 itens |
| 226 | slice = [item for item in *items[-4,-1]] | 239 | slice = [item for item in *items[-4,-1]] |
| 227 | ``` | 240 | ``` |
| 241 | |||
| 228 | <YueDisplay> | 242 | <YueDisplay> |
| 229 | 243 | ||
| 230 | ```yue | 244 | ```yue |
| @@ -239,6 +253,7 @@ O tamanho do passo também pode ser negativo, o que significa que os itens são | |||
| 239 | ```yuescript | 253 | ```yuescript |
| 240 | reverse_slice = [item for item in *items[-1,1,-1]] | 254 | reverse_slice = [item for item in *items[-1,1,-1]] |
| 241 | ``` | 255 | ``` |
| 256 | |||
| 242 | <YueDisplay> | 257 | <YueDisplay> |
| 243 | 258 | ||
| 244 | ```yue | 259 | ```yue |
| @@ -258,6 +273,7 @@ sub_list = items[2, 4] | |||
| 258 | -- pegar os últimos 4 itens | 273 | -- pegar os últimos 4 itens |
| 259 | last_four_items = items[-4, -1] | 274 | last_four_items = items[-4, -1] |
| 260 | ``` | 275 | ``` |
| 276 | |||
| 261 | <YueDisplay> | 277 | <YueDisplay> |
| 262 | 278 | ||
| 263 | ```yue | 279 | ```yue |
diff --git a/doc/docs/pt-br/doc/data-structures/table-literals.md b/doc/docs/pt-br/doc/data-structures/table-literals.md index f0fbdc5..23817ff 100644 --- a/doc/docs/pt-br/doc/data-structures/table-literals.md +++ b/doc/docs/pt-br/doc/data-structures/table-literals.md | |||
| @@ -5,6 +5,7 @@ Como no Lua, as tabelas são delimitadas por chaves. | |||
| 5 | ```yuescript | 5 | ```yuescript |
| 6 | some_values = [1, 2, 3, 4] | 6 | some_values = [1, 2, 3, 4] |
| 7 | ``` | 7 | ``` |
| 8 | |||
| 8 | <YueDisplay> | 9 | <YueDisplay> |
| 9 | 10 | ||
| 10 | ```yue | 11 | ```yue |
| @@ -22,6 +23,7 @@ some_values = { | |||
| 22 | ["favorite food"]: "rice" | 23 | ["favorite food"]: "rice" |
| 23 | } | 24 | } |
| 24 | ``` | 25 | ``` |
| 26 | |||
| 25 | <YueDisplay> | 27 | <YueDisplay> |
| 26 | 28 | ||
| 27 | ```yue | 29 | ```yue |
| @@ -42,6 +44,7 @@ profile = | |||
| 42 | shoe_size: 13, | 44 | shoe_size: 13, |
| 43 | favorite_foods: ["ice cream", "donuts"] | 45 | favorite_foods: ["ice cream", "donuts"] |
| 44 | ``` | 46 | ``` |
| 47 | |||
| 45 | <YueDisplay> | 48 | <YueDisplay> |
| 46 | 49 | ||
| 47 | ```yue | 50 | ```yue |
| @@ -63,6 +66,7 @@ values = { | |||
| 63 | occupation: "crime fighting" | 66 | occupation: "crime fighting" |
| 64 | } | 67 | } |
| 65 | ``` | 68 | ``` |
| 69 | |||
| 66 | <YueDisplay> | 70 | <YueDisplay> |
| 67 | 71 | ||
| 68 | ```yue | 72 | ```yue |
| @@ -83,6 +87,7 @@ my_function dance: "Tango", partner: "none" | |||
| 83 | 87 | ||
| 84 | y = type: "dog", legs: 4, tails: 1 | 88 | y = type: "dog", legs: 4, tails: 1 |
| 85 | ``` | 89 | ``` |
| 90 | |||
| 86 | <YueDisplay> | 91 | <YueDisplay> |
| 87 | 92 | ||
| 88 | ```yue | 93 | ```yue |
| @@ -101,6 +106,7 @@ tbl = { | |||
| 101 | end: "hunger" | 106 | end: "hunger" |
| 102 | } | 107 | } |
| 103 | ``` | 108 | ``` |
| 109 | |||
| 104 | <YueDisplay> | 110 | <YueDisplay> |
| 105 | 111 | ||
| 106 | ```yue | 112 | ```yue |
| @@ -121,6 +127,7 @@ person = { :hair, :height, shoe_size: 40 } | |||
| 121 | 127 | ||
| 122 | print_table :hair, :height | 128 | print_table :hair, :height |
| 123 | ``` | 129 | ``` |
| 130 | |||
| 124 | <YueDisplay> | 131 | <YueDisplay> |
| 125 | 132 | ||
| 126 | ```yue | 133 | ```yue |
| @@ -141,6 +148,7 @@ t = { | |||
| 141 | "hello world": true | 148 | "hello world": true |
| 142 | } | 149 | } |
| 143 | ``` | 150 | ``` |
| 151 | |||
| 144 | <YueDisplay> | 152 | <YueDisplay> |
| 145 | 153 | ||
| 146 | ```yue | 154 | ```yue |
| @@ -158,6 +166,7 @@ As tabelas Lua têm tanto uma parte array quanto uma parte hash, mas às vezes v | |||
| 158 | some_values = [1, 2, 3, 4] | 166 | some_values = [1, 2, 3, 4] |
| 159 | list_with_one_element = [1, ] | 167 | list_with_one_element = [1, ] |
| 160 | ``` | 168 | ``` |
| 169 | |||
| 161 | <YueDisplay> | 170 | <YueDisplay> |
| 162 | 171 | ||
| 163 | ```yue | 172 | ```yue |
diff --git a/doc/docs/pt-br/doc/functions/backcalls.md b/doc/docs/pt-br/doc/functions/backcalls.md index 924c10a..bc327a3 100644 --- a/doc/docs/pt-br/doc/functions/backcalls.md +++ b/doc/docs/pt-br/doc/functions/backcalls.md | |||
| @@ -6,6 +6,7 @@ Backcalls são usados para desaninhar callbacks. Eles são definidos usando seta | |||
| 6 | x <- f | 6 | x <- f |
| 7 | print "hello" .. x | 7 | print "hello" .. x |
| 8 | ``` | 8 | ``` |
| 9 | |||
| 9 | <YueDisplay> | 10 | <YueDisplay> |
| 10 | 11 | ||
| 11 | ```yue | 12 | ```yue |
| @@ -21,6 +22,7 @@ Funções seta "fat" também estão disponÃveis. | |||
| 21 | <= f | 22 | <= f |
| 22 | print @value | 23 | print @value |
| 23 | ``` | 24 | ``` |
| 25 | |||
| 24 | <YueDisplay> | 26 | <YueDisplay> |
| 25 | 27 | ||
| 26 | ```yue | 28 | ```yue |
| @@ -36,6 +38,7 @@ Você pode especificar um placeholder para onde deseja que a função backcall v | |||
| 36 | (x) <- map _, [1, 2, 3] | 38 | (x) <- map _, [1, 2, 3] |
| 37 | x * 2 | 39 | x * 2 |
| 38 | ``` | 40 | ``` |
| 41 | |||
| 39 | <YueDisplay> | 42 | <YueDisplay> |
| 40 | 43 | ||
| 41 | ```yue | 44 | ```yue |
| @@ -55,6 +58,7 @@ result, msg = do | |||
| 55 | check info | 58 | check info |
| 56 | print result, msg | 59 | print result, msg |
| 57 | ``` | 60 | ``` |
| 61 | |||
| 58 | <YueDisplay> | 62 | <YueDisplay> |
| 59 | 63 | ||
| 60 | ```yue | 64 | ```yue |
diff --git a/doc/docs/pt-br/doc/functions/function-literals.md b/doc/docs/pt-br/doc/functions/function-literals.md index e63888f..590af71 100644 --- a/doc/docs/pt-br/doc/functions/function-literals.md +++ b/doc/docs/pt-br/doc/functions/function-literals.md | |||
| @@ -6,6 +6,7 @@ Todas as funções são criadas usando uma expressão de função. Uma função | |||
| 6 | my_function = -> | 6 | my_function = -> |
| 7 | my_function() -- chama a função vazia | 7 | my_function() -- chama a função vazia |
| 8 | ``` | 8 | ``` |
| 9 | |||
| 9 | <YueDisplay> | 10 | <YueDisplay> |
| 10 | 11 | ||
| 11 | ```yue | 12 | ```yue |
| @@ -24,6 +25,7 @@ func_b = -> | |||
| 24 | value = 100 | 25 | value = 100 |
| 25 | print "The value:", value | 26 | print "The value:", value |
| 26 | ``` | 27 | ``` |
| 28 | |||
| 27 | <YueDisplay> | 29 | <YueDisplay> |
| 28 | 30 | ||
| 29 | ```yue | 31 | ```yue |
| @@ -42,6 +44,7 @@ Se uma função não tem argumentos, ela pode ser chamada usando o operador !, e | |||
| 42 | func_a! | 44 | func_a! |
| 43 | func_b() | 45 | func_b() |
| 44 | ``` | 46 | ``` |
| 47 | |||
| 45 | <YueDisplay> | 48 | <YueDisplay> |
| 46 | 49 | ||
| 47 | ```yue | 50 | ```yue |
| @@ -56,6 +59,7 @@ Funções com argumentos podem ser criadas precedendo a seta com uma lista de no | |||
| 56 | ```yuescript | 59 | ```yuescript |
| 57 | sum = (x, y) -> print "sum", x + y | 60 | sum = (x, y) -> print "sum", x + y |
| 58 | ``` | 61 | ``` |
| 62 | |||
| 59 | <YueDisplay> | 63 | <YueDisplay> |
| 60 | 64 | ||
| 61 | ```yue | 65 | ```yue |
| @@ -72,6 +76,7 @@ print sum 10, 20 | |||
| 72 | 76 | ||
| 73 | a b c "a", "b", "c" | 77 | a b c "a", "b", "c" |
| 74 | ``` | 78 | ``` |
| 79 | |||
| 75 | <YueDisplay> | 80 | <YueDisplay> |
| 76 | 81 | ||
| 77 | ```yue | 82 | ```yue |
| @@ -88,6 +93,7 @@ Para evitar ambiguidade ao chamar funções, parênteses também podem ser usado | |||
| 88 | ```yuescript | 93 | ```yuescript |
| 89 | print "x:", sum(10, 20), "y:", sum(30, 40) | 94 | print "x:", sum(10, 20), "y:", sum(30, 40) |
| 90 | ``` | 95 | ``` |
| 96 | |||
| 91 | <YueDisplay> | 97 | <YueDisplay> |
| 92 | 98 | ||
| 93 | ```yue | 99 | ```yue |
| @@ -104,6 +110,7 @@ As funções convertem a última instrução em seu corpo em uma instrução de | |||
| 104 | sum = (x, y) -> x + y | 110 | sum = (x, y) -> x + y |
| 105 | print "The sum is ", sum 10, 20 | 111 | print "The sum is ", sum 10, 20 |
| 106 | ``` | 112 | ``` |
| 113 | |||
| 107 | <YueDisplay> | 114 | <YueDisplay> |
| 108 | 115 | ||
| 109 | ```yue | 116 | ```yue |
| @@ -118,6 +125,7 @@ E se você precisar retornar explicitamente, pode usar a palavra-chave return: | |||
| 118 | ```yuescript | 125 | ```yuescript |
| 119 | sum = (x, y) -> return x + y | 126 | sum = (x, y) -> return x + y |
| 120 | ``` | 127 | ``` |
| 128 | |||
| 121 | <YueDisplay> | 129 | <YueDisplay> |
| 122 | 130 | ||
| 123 | ```yue | 131 | ```yue |
| @@ -132,6 +140,7 @@ Assim como no Lua, as funções podem retornar múltiplos valores. A última ins | |||
| 132 | mystery = (x, y) -> x + y, x - y | 140 | mystery = (x, y) -> x + y, x - y |
| 133 | a, b = mystery 10, 20 | 141 | a, b = mystery 10, 20 |
| 134 | ``` | 142 | ``` |
| 143 | |||
| 135 | <YueDisplay> | 144 | <YueDisplay> |
| 136 | 145 | ||
| 137 | ```yue | 146 | ```yue |
| @@ -148,6 +157,7 @@ Como é um idioma em Lua enviar um objeto como primeiro argumento ao chamar um m | |||
| 148 | ```yuescript | 157 | ```yuescript |
| 149 | func = (num) => @value + num | 158 | func = (num) => @value + num |
| 150 | ``` | 159 | ``` |
| 160 | |||
| 151 | <YueDisplay> | 161 | <YueDisplay> |
| 152 | 162 | ||
| 153 | ```yue | 163 | ```yue |
| @@ -165,6 +175,7 @@ my_function = (name = "something", height = 100) -> | |||
| 165 | print "Hello I am", name | 175 | print "Hello I am", name |
| 166 | print "My height is", height | 176 | print "My height is", height |
| 167 | ``` | 177 | ``` |
| 178 | |||
| 168 | <YueDisplay> | 179 | <YueDisplay> |
| 169 | 180 | ||
| 170 | ```yue | 181 | ```yue |
| @@ -181,6 +192,7 @@ Uma expressão de valor padrão de argumento é avaliada no corpo da função na | |||
| 181 | some_args = (x = 100, y = x + 1000) -> | 192 | some_args = (x = 100, y = x + 1000) -> |
| 182 | print x + y | 193 | print x + y |
| 183 | ``` | 194 | ``` |
| 195 | |||
| 184 | <YueDisplay> | 196 | <YueDisplay> |
| 185 | 197 | ||
| 186 | ```yue | 198 | ```yue |
| @@ -202,6 +214,7 @@ b = x-10 | |||
| 202 | c = x -y | 214 | c = x -y |
| 203 | d = x- z | 215 | d = x- z |
| 204 | ``` | 216 | ``` |
| 217 | |||
| 205 | <YueDisplay> | 218 | <YueDisplay> |
| 206 | 219 | ||
| 207 | ```yue | 220 | ```yue |
| @@ -223,6 +236,7 @@ Quando há um espaço após uma variável e um literal de string, a chamada de f | |||
| 223 | x = func"hello" + 100 | 236 | x = func"hello" + 100 |
| 224 | y = func "hello" + 100 | 237 | y = func "hello" + 100 |
| 225 | ``` | 238 | ``` |
| 239 | |||
| 226 | <YueDisplay> | 240 | <YueDisplay> |
| 227 | 241 | ||
| 228 | ```yue | 242 | ```yue |
| @@ -247,6 +261,7 @@ cool_func 1, 2, | |||
| 247 | 5, 6, | 261 | 5, 6, |
| 248 | 7, 8 | 262 | 7, 8 |
| 249 | ``` | 263 | ``` |
| 264 | |||
| 250 | <YueDisplay> | 265 | <YueDisplay> |
| 251 | 266 | ||
| 252 | ```yue | 267 | ```yue |
| @@ -269,6 +284,7 @@ my_func 5, 6, 7, | |||
| 269 | 9, 1, 2, | 284 | 9, 1, 2, |
| 270 | 5, 4 | 285 | 5, 4 |
| 271 | ``` | 286 | ``` |
| 287 | |||
| 272 | <YueDisplay> | 288 | <YueDisplay> |
| 273 | 289 | ||
| 274 | ```yue | 290 | ```yue |
| @@ -289,6 +305,7 @@ x = [ | |||
| 289 | 8, 9, 10 | 305 | 8, 9, 10 |
| 290 | ] | 306 | ] |
| 291 | ``` | 307 | ``` |
| 308 | |||
| 292 | <YueDisplay> | 309 | <YueDisplay> |
| 293 | 310 | ||
| 294 | ```yue | 311 | ```yue |
| @@ -309,6 +326,7 @@ y = [ my_func 1, 2, 3, | |||
| 309 | 5, 6, 7 | 326 | 5, 6, 7 |
| 310 | ] | 327 | ] |
| 311 | ``` | 328 | ``` |
| 329 | |||
| 312 | <YueDisplay> | 330 | <YueDisplay> |
| 313 | 331 | ||
| 314 | ```yue | 332 | ```yue |
| @@ -335,6 +353,7 @@ if func 1, 2, 3, | |||
| 335 | print "hello" | 353 | print "hello" |
| 336 | print "I am inside if" | 354 | print "I am inside if" |
| 337 | ``` | 355 | ``` |
| 356 | |||
| 338 | <YueDisplay> | 357 | <YueDisplay> |
| 339 | 358 | ||
| 340 | ```yue | 359 | ```yue |
| @@ -357,9 +376,9 @@ if func 1, 2, 3, | |||
| 357 | 376 | ||
| 358 | YueScript agora suporta desestruturação de parâmetros de função quando o argumento é um objeto. Duas formas de literais de tabela de desestruturação estão disponÃveis: | 377 | YueScript agora suporta desestruturação de parâmetros de função quando o argumento é um objeto. Duas formas de literais de tabela de desestruturação estão disponÃveis: |
| 359 | 378 | ||
| 360 | * **Literais/parâmetros de objeto envolvidos em chaves**, permitindo valores padrão opcionais quando os campos estão ausentes (ex.: `{:a, :b}`, `{a: a1 = 123}`). | 379 | - **Literais/parâmetros de objeto envolvidos em chaves**, permitindo valores padrão opcionais quando os campos estão ausentes (ex.: `{:a, :b}`, `{a: a1 = 123}`). |
| 361 | 380 | ||
| 362 | * **Sintaxe de tabela simples não envolvida**, começando com uma sequência de ligações chave-valor ou abreviadas e continuando até outra expressão terminá-la (ex.: `:a, b: b1, :c`). Esta forma extrai múltiplos campos do mesmo objeto. | 381 | - **Sintaxe de tabela simples não envolvida**, começando com uma sequência de ligações chave-valor ou abreviadas e continuando até outra expressão terminá-la (ex.: `:a, b: b1, :c`). Esta forma extrai múltiplos campos do mesmo objeto. |
| 363 | 382 | ||
| 364 | ```yuescript | 383 | ```yuescript |
| 365 | f1 = (:a, :b, :c) -> | 384 | f1 = (:a, :b, :c) -> |
| @@ -373,6 +392,7 @@ f2 = ({a: a1 = 123, :b = 'abc'}, c = {}) -> | |||
| 373 | arg1 = {a: 0} | 392 | arg1 = {a: 0} |
| 374 | f2 arg1, arg2 | 393 | f2 arg1, arg2 |
| 375 | ``` | 394 | ``` |
| 395 | |||
| 376 | <YueDisplay> | 396 | <YueDisplay> |
| 377 | 397 | ||
| 378 | ```yue | 398 | ```yue |
| @@ -402,6 +422,7 @@ findFirstEven = (list): nil -> | |||
| 402 | if sub % 2 == 0 | 422 | if sub % 2 == 0 |
| 403 | return sub | 423 | return sub |
| 404 | ``` | 424 | ``` |
| 425 | |||
| 405 | <YueDisplay> | 426 | <YueDisplay> |
| 406 | 427 | ||
| 407 | ```yue | 428 | ```yue |
| @@ -426,6 +447,7 @@ findFirstEven = (list) -> | |||
| 426 | return sub | 447 | return sub |
| 427 | nil | 448 | nil |
| 428 | ``` | 449 | ``` |
| 450 | |||
| 429 | <YueDisplay> | 451 | <YueDisplay> |
| 430 | 452 | ||
| 431 | ```yue | 453 | ```yue |
| @@ -467,6 +489,7 @@ process = (...args) -> | |||
| 467 | 489 | ||
| 468 | process 1, nil, 3, nil, 5 | 490 | process 1, nil, 3, nil, 5 |
| 469 | ``` | 491 | ``` |
| 492 | |||
| 470 | <YueDisplay> | 493 | <YueDisplay> |
| 471 | 494 | ||
| 472 | ```yue | 495 | ```yue |
diff --git a/doc/docs/pt-br/doc/functions/function-stubs.md b/doc/docs/pt-br/doc/functions/function-stubs.md index d13f8ed..74b7821 100644 --- a/doc/docs/pt-br/doc/functions/function-stubs.md +++ b/doc/docs/pt-br/doc/functions/function-stubs.md | |||
| @@ -24,6 +24,7 @@ run_callback my_object.write | |||
| 24 | -- nos permite empacotar o objeto em uma nova função | 24 | -- nos permite empacotar o objeto em uma nova função |
| 25 | run_callback my_object\write | 25 | run_callback my_object\write |
| 26 | ``` | 26 | ``` |
| 27 | |||
| 27 | <YueDisplay> | 28 | <YueDisplay> |
| 28 | 29 | ||
| 29 | ```yue | 30 | ```yue |
diff --git a/doc/docs/pt-br/doc/getting-started/usage.md b/doc/docs/pt-br/doc/getting-started/usage.md index 7653838..055c6c2 100644 --- a/doc/docs/pt-br/doc/getting-started/usage.md +++ b/doc/docs/pt-br/doc/getting-started/usage.md | |||
| @@ -4,49 +4,51 @@ | |||
| 4 | 4 | ||
| 5 | Use o módulo YueScript em Lua: | 5 | Use o módulo YueScript em Lua: |
| 6 | 6 | ||
| 7 | * **Caso 1** | 7 | - **Caso 1** |
| 8 | 8 | ||
| 9 | Use require em "your_yuescript_entry.yue" no Lua. | 9 | Use require em "your_yuescript_entry.yue" no Lua. |
| 10 | ```Lua | 10 | |
| 11 | require("yue")("your_yuescript_entry") | 11 | ```Lua |
| 12 | ``` | 12 | require("yue")("your_yuescript_entry") |
| 13 | E esse código continua funcionando quando você compila "your_yuescript_entry.yue" para "your_yuescript_entry.lua" no mesmo caminho. Nos demais arquivos YueScript, use normalmente o **require** ou **import**. Os números de linha nas mensagens de erro também serão tratados corretamente. | 13 | ``` |
| 14 | 14 | ||
| 15 | * **Caso 2** | 15 | E esse código continua funcionando quando você compila "your_yuescript_entry.yue" para "your_yuescript_entry.lua" no mesmo caminho. Nos demais arquivos YueScript, use normalmente o **require** ou **import**. Os números de linha nas mensagens de erro também serão tratados corretamente. |
| 16 | 16 | ||
| 17 | Requerer o módulo YueScript e reescrever a mensagem manualmente. | 17 | - **Caso 2** |
| 18 | 18 | ||
| 19 | ```lua | 19 | Requerer o módulo YueScript e reescrever a mensagem manualmente. |
| 20 | local yue = require("yue") | 20 | |
| 21 | yue.insert_loader() | 21 | ```lua |
| 22 | local success, result = xpcall(function() | 22 | local yue = require("yue") |
| 23 | return require("yuescript_module_name") | 23 | yue.insert_loader() |
| 24 | end, function(err) | 24 | local success, result = xpcall(function() |
| 25 | return yue.traceback(err) | 25 | return require("yuescript_module_name") |
| 26 | end) | 26 | end, function(err) |
| 27 | ``` | 27 | return yue.traceback(err) |
| 28 | 28 | end) | |
| 29 | * **Caso 3** | 29 | ``` |
| 30 | 30 | ||
| 31 | Usar a função compiladora do YueScript em Lua. | 31 | - **Caso 3** |
| 32 | 32 | ||
| 33 | ```lua | 33 | Usar a função compiladora do YueScript em Lua. |
| 34 | local yue = require("yue") | 34 | |
| 35 | local codes, err, globals = yue.to_lua([[ | 35 | ```lua |
| 36 | f = -> | 36 | local yue = require("yue") |
| 37 | print "hello world" | 37 | local codes, err, globals = yue.to_lua([[ |
| 38 | f! | 38 | f = -> |
| 39 | ]],{ | 39 | print "hello world" |
| 40 | implicit_return_root = true, | 40 | f! |
| 41 | reserve_line_number = true, | 41 | ]],{ |
| 42 | lint_global = true, | 42 | implicit_return_root = true, |
| 43 | space_over_tab = false, | 43 | reserve_line_number = true, |
| 44 | options = { | 44 | lint_global = true, |
| 45 | target = "5.4", | 45 | space_over_tab = false, |
| 46 | path = "/script" | 46 | options = { |
| 47 | } | 47 | target = "5.4", |
| 48 | }) | 48 | path = "/script" |
| 49 | ``` | 49 | } |
| 50 | }) | ||
| 51 | ``` | ||
| 50 | 52 | ||
| 51 | ## Ferramenta YueScript | 53 | ## Ferramenta YueScript |
| 52 | 54 | ||
diff --git a/doc/docs/pt-br/doc/language-basics/attributes.md b/doc/docs/pt-br/doc/language-basics/attributes.md index 8e27f21..18bc585 100644 --- a/doc/docs/pt-br/doc/language-basics/attributes.md +++ b/doc/docs/pt-br/doc/language-basics/attributes.md | |||
| @@ -6,6 +6,7 @@ Suporte de sintaxe para atributos do Lua 5.4. E você ainda pode usar tanto a de | |||
| 6 | const a = 123 | 6 | const a = 123 |
| 7 | close _ = <close>: -> print "Fora do escopo." | 7 | close _ = <close>: -> print "Fora do escopo." |
| 8 | ``` | 8 | ``` |
| 9 | |||
| 9 | <YueDisplay> | 10 | <YueDisplay> |
| 10 | 11 | ||
| 11 | ```yue | 12 | ```yue |
| @@ -21,6 +22,7 @@ Você pode fazer desestruturação com variáveis atribuÃdas como constante. | |||
| 21 | const {:a, :b, c, d} = tb | 22 | const {:a, :b, c, d} = tb |
| 22 | -- a = 1 | 23 | -- a = 1 |
| 23 | ``` | 24 | ``` |
| 25 | |||
| 24 | <YueDisplay> | 26 | <YueDisplay> |
| 25 | 27 | ||
| 26 | ```yue | 28 | ```yue |
| @@ -36,6 +38,7 @@ Você também pode declarar uma variável global como `const`. | |||
| 36 | global const Constant = 123 | 38 | global const Constant = 123 |
| 37 | -- Constant = 1 | 39 | -- Constant = 1 |
| 38 | ``` | 40 | ``` |
| 41 | |||
| 39 | <YueDisplay> | 42 | <YueDisplay> |
| 40 | 43 | ||
| 41 | ```yue | 44 | ```yue |
diff --git a/doc/docs/pt-br/doc/language-basics/comment.md b/doc/docs/pt-br/doc/language-basics/comment.md index ed3102d..6316084 100644 --- a/doc/docs/pt-br/doc/language-basics/comment.md +++ b/doc/docs/pt-br/doc/language-basics/comment.md | |||
| @@ -12,6 +12,7 @@ Está OK. | |||
| 12 | 12 | ||
| 13 | func --[[port]] 3000, --[[ip]] "192.168.1.1" | 13 | func --[[port]] 3000, --[[ip]] "192.168.1.1" |
| 14 | ``` | 14 | ``` |
| 15 | |||
| 15 | <YueDisplay> | 16 | <YueDisplay> |
| 16 | 17 | ||
| 17 | ```yue | 18 | ```yue |
diff --git a/doc/docs/pt-br/doc/language-basics/literals.md b/doc/docs/pt-br/doc/language-basics/literals.md index b32b73a..6db3f01 100644 --- a/doc/docs/pt-br/doc/language-basics/literals.md +++ b/doc/docs/pt-br/doc/language-basics/literals.md | |||
| @@ -12,6 +12,7 @@ some_string = "Aqui está uma string | |||
| 12 | -- Interpolação de string está disponÃvel apenas em strings com aspas duplas. | 12 | -- Interpolação de string está disponÃvel apenas em strings com aspas duplas. |
| 13 | print "Tenho #{math.random! * 100}% de certeza." | 13 | print "Tenho #{math.random! * 100}% de certeza." |
| 14 | ``` | 14 | ``` |
| 15 | |||
| 15 | <YueDisplay> | 16 | <YueDisplay> |
| 16 | 17 | ||
| 17 | ```yue | 18 | ```yue |
| @@ -34,6 +35,7 @@ integer = 1_000_000 | |||
| 34 | hex = 0xEF_BB_BF | 35 | hex = 0xEF_BB_BF |
| 35 | binary = 0B10011 | 36 | binary = 0B10011 |
| 36 | ``` | 37 | ``` |
| 38 | |||
| 37 | <YueDisplay> | 39 | <YueDisplay> |
| 38 | 40 | ||
| 39 | ```yue | 41 | ```yue |
| @@ -55,6 +57,7 @@ str = | | |||
| 55 | - item1 | 57 | - item1 |
| 56 | - #{expr} | 58 | - #{expr} |
| 57 | ``` | 59 | ``` |
| 60 | |||
| 58 | <YueDisplay> | 61 | <YueDisplay> |
| 59 | 62 | ||
| 60 | ```yue | 63 | ```yue |
| @@ -78,6 +81,7 @@ fn = -> | |||
| 78 | bar: baz | 81 | bar: baz |
| 79 | return str | 82 | return str |
| 80 | ``` | 83 | ``` |
| 84 | |||
| 81 | <YueDisplay> | 85 | <YueDisplay> |
| 82 | 86 | ||
| 83 | ```yue | 87 | ```yue |
| @@ -99,6 +103,7 @@ str = | | |||
| 99 | path: "C:\Program Files\App" | 103 | path: "C:\Program Files\App" |
| 100 | note: 'Ele disse: "#{Hello}!"' | 104 | note: 'Ele disse: "#{Hello}!"' |
| 101 | ``` | 105 | ``` |
| 106 | |||
| 102 | <YueDisplay> | 107 | <YueDisplay> |
| 103 | 108 | ||
| 104 | ```yue | 109 | ```yue |
diff --git a/doc/docs/pt-br/doc/language-basics/operator.md b/doc/docs/pt-br/doc/language-basics/operator.md index aba9c50..6371343 100644 --- a/doc/docs/pt-br/doc/language-basics/operator.md +++ b/doc/docs/pt-br/doc/language-basics/operator.md | |||
| @@ -6,6 +6,7 @@ Todos os operadores binários e unários do Lua estão disponÃveis. Além disso | |||
| 6 | tb\func! if tb ~= nil | 6 | tb\func! if tb ~= nil |
| 7 | tb::func! if tb != nil | 7 | tb::func! if tb != nil |
| 8 | ``` | 8 | ``` |
| 9 | |||
| 9 | <YueDisplay> | 10 | <YueDisplay> |
| 10 | 11 | ||
| 11 | ```yue | 12 | ```yue |
| @@ -27,6 +28,7 @@ a = 5 | |||
| 27 | print 1 <= a <= 10 | 28 | print 1 <= a <= 10 |
| 28 | -- saÃda: true | 29 | -- saÃda: true |
| 29 | ``` | 30 | ``` |
| 31 | |||
| 30 | <YueDisplay> | 32 | <YueDisplay> |
| 31 | 33 | ||
| 32 | ```yue | 34 | ```yue |
| @@ -64,6 +66,7 @@ print v(1) > v(2) <= v(3) | |||
| 64 | false | 66 | false |
| 65 | ]] | 67 | ]] |
| 66 | ``` | 68 | ``` |
| 69 | |||
| 67 | <YueDisplay> | 70 | <YueDisplay> |
| 68 | 71 | ||
| 69 | ```yue | 72 | ```yue |
| @@ -101,6 +104,7 @@ O operador **[] =** é usado para anexar valores a tabelas. | |||
| 101 | tab = [] | 104 | tab = [] |
| 102 | tab[] = "Value" | 105 | tab[] = "Value" |
| 103 | ``` | 106 | ``` |
| 107 | |||
| 104 | <YueDisplay> | 108 | <YueDisplay> |
| 105 | 109 | ||
| 106 | ```yue | 110 | ```yue |
| @@ -118,6 +122,7 @@ tbB = [4, 5, 6] | |||
| 118 | tbA[] = ...tbB | 122 | tbA[] = ...tbB |
| 119 | -- tbA agora é [1, 2, 3, 4, 5, 6] | 123 | -- tbA agora é [1, 2, 3, 4, 5, 6] |
| 120 | ``` | 124 | ``` |
| 125 | |||
| 121 | <YueDisplay> | 126 | <YueDisplay> |
| 122 | 127 | ||
| 123 | ```yue | 128 | ```yue |
| @@ -149,6 +154,7 @@ a = {1, 2, 3, x: 1} | |||
| 149 | b = {4, 5, y: 1} | 154 | b = {4, 5, y: 1} |
| 150 | merge = {...a, ...b} | 155 | merge = {...a, ...b} |
| 151 | ``` | 156 | ``` |
| 157 | |||
| 152 | <YueDisplay> | 158 | <YueDisplay> |
| 153 | 159 | ||
| 154 | ```yue | 160 | ```yue |
| @@ -179,6 +185,7 @@ last = data.items[#] | |||
| 179 | second_last = data.items[#-1] | 185 | second_last = data.items[#-1] |
| 180 | data.items[#] = 1 | 186 | data.items[#] = 1 |
| 181 | ``` | 187 | ``` |
| 188 | |||
| 182 | <YueDisplay> | 189 | <YueDisplay> |
| 183 | 190 | ||
| 184 | ```yue | 191 | ```yue |
| @@ -212,6 +219,7 @@ print d.value | |||
| 212 | 219 | ||
| 213 | close _ = <close>: -> print "fora do escopo" | 220 | close _ = <close>: -> print "fora do escopo" |
| 214 | ``` | 221 | ``` |
| 222 | |||
| 215 | <YueDisplay> | 223 | <YueDisplay> |
| 216 | 224 | ||
| 217 | ```yue | 225 | ```yue |
| @@ -245,6 +253,7 @@ print tb.value | |||
| 245 | tb.<> = __index: {item: "hello"} | 253 | tb.<> = __index: {item: "hello"} |
| 246 | print tb.item | 254 | print tb.item |
| 247 | ``` | 255 | ``` |
| 256 | |||
| 248 | <YueDisplay> | 257 | <YueDisplay> |
| 249 | 258 | ||
| 250 | ```yue | 259 | ```yue |
| @@ -266,6 +275,7 @@ Desestruture a metatable com chave de metamétodo cercada por **<>**. | |||
| 266 | {item, :new, :<close>, <index>: getter} = tb | 275 | {item, :new, :<close>, <index>: getter} = tb |
| 267 | print item, new, close, getter | 276 | print item, new, close, getter |
| 268 | ``` | 277 | ``` |
| 278 | |||
| 269 | <YueDisplay> | 279 | <YueDisplay> |
| 270 | 280 | ||
| 271 | ```yue | 281 | ```yue |
| @@ -293,6 +303,7 @@ with? io.open "test.txt", "w" | |||
| 293 | \write "hello" | 303 | \write "hello" |
| 294 | \close! | 304 | \close! |
| 295 | ``` | 305 | ``` |
| 306 | |||
| 296 | <YueDisplay> | 307 | <YueDisplay> |
| 297 | 308 | ||
| 298 | ```yue | 309 | ```yue |
| @@ -329,6 +340,7 @@ readFile "example.txt" | |||
| 329 | |> render | 340 | |> render |
| 330 | 341 | ||
| 331 | ``` | 342 | ``` |
| 343 | |||
| 332 | <YueDisplay> | 344 | <YueDisplay> |
| 333 | 345 | ||
| 334 | ```yue | 346 | ```yue |
| @@ -349,6 +361,7 @@ readFile "example.txt" | |||
| 349 | ## Coalescência de nil | 361 | ## Coalescência de nil |
| 350 | 362 | ||
| 351 | O operador de coalescência de nil **??** retorna o valor do operando esquerdo se não for **nil**; caso contrário, avalia o operando direito e retorna seu resultado. O operador **??** não avalia seu operando direito se o operando esquerdo avaliar para não-nil. | 363 | O operador de coalescência de nil **??** retorna o valor do operando esquerdo se não for **nil**; caso contrário, avalia o operando direito e retorna seu resultado. O operador **??** não avalia seu operando direito se o operando esquerdo avaliar para não-nil. |
| 364 | |||
| 352 | ```yuescript | 365 | ```yuescript |
| 353 | local a, b, c, d | 366 | local a, b, c, d |
| 354 | a = b ?? c ?? d | 367 | a = b ?? c ?? d |
| @@ -356,6 +369,7 @@ func a ?? {} | |||
| 356 | 369 | ||
| 357 | a ??= false | 370 | a ??= false |
| 358 | ``` | 371 | ``` |
| 372 | |||
| 359 | <YueDisplay> | 373 | <YueDisplay> |
| 360 | 374 | ||
| 361 | ```yue | 375 | ```yue |
| @@ -413,6 +427,7 @@ tb = | |||
| 413 | tb: { } | 427 | tb: { } |
| 414 | 428 | ||
| 415 | ``` | 429 | ``` |
| 430 | |||
| 416 | <YueDisplay> | 431 | <YueDisplay> |
| 417 | 432 | ||
| 418 | ```yue | 433 | ```yue |
diff --git a/doc/docs/pt-br/doc/language-basics/whitespace.md b/doc/docs/pt-br/doc/language-basics/whitespace.md index df844f9..bad11d1 100644 --- a/doc/docs/pt-br/doc/language-basics/whitespace.md +++ b/doc/docs/pt-br/doc/language-basics/whitespace.md | |||
| @@ -9,6 +9,7 @@ Uma instrução normalmente termina em uma quebra de linha. Você também pode u | |||
| 9 | ```yuescript | 9 | ```yuescript |
| 10 | a = 1; b = 2; print a + b | 10 | a = 1; b = 2; print a + b |
| 11 | ``` | 11 | ``` |
| 12 | |||
| 12 | <YueDisplay> | 13 | <YueDisplay> |
| 13 | 14 | ||
| 14 | ```yue | 15 | ```yue |
| @@ -29,6 +30,7 @@ Rx.Observable | |||
| 29 | \map (value) -> value .. '!' | 30 | \map (value) -> value .. '!' |
| 30 | \subscribe print | 31 | \subscribe print |
| 31 | ``` | 32 | ``` |
| 33 | |||
| 32 | <YueDisplay> | 34 | <YueDisplay> |
| 33 | 35 | ||
| 34 | ```yue | 36 | ```yue |
diff --git a/doc/docs/pt-br/doc/objects/object-oriented-programming.md b/doc/docs/pt-br/doc/objects/object-oriented-programming.md index 3d5f061..54a559a 100644 --- a/doc/docs/pt-br/doc/objects/object-oriented-programming.md +++ b/doc/docs/pt-br/doc/objects/object-oriented-programming.md | |||
| @@ -15,6 +15,7 @@ class Inventory | |||
| 15 | else | 15 | else |
| 16 | @items[name] = 1 | 16 | @items[name] = 1 |
| 17 | ``` | 17 | ``` |
| 18 | |||
| 18 | <YueDisplay> | 19 | <YueDisplay> |
| 19 | 20 | ||
| 20 | ```yue | 21 | ```yue |
| @@ -46,6 +47,7 @@ inv = Inventory! | |||
| 46 | inv\add_item "t-shirt" | 47 | inv\add_item "t-shirt" |
| 47 | inv\add_item "pants" | 48 | inv\add_item "pants" |
| 48 | ``` | 49 | ``` |
| 50 | |||
| 49 | <YueDisplay> | 51 | <YueDisplay> |
| 50 | 52 | ||
| 51 | ```yue | 53 | ```yue |
| @@ -77,6 +79,7 @@ b\give_item "shirt" | |||
| 77 | -- vai imprimir tanto pants quanto shirt | 79 | -- vai imprimir tanto pants quanto shirt |
| 78 | print item for item in *a.clothes | 80 | print item for item in *a.clothes |
| 79 | ``` | 81 | ``` |
| 82 | |||
| 80 | <YueDisplay> | 83 | <YueDisplay> |
| 81 | 84 | ||
| 82 | ```yue | 85 | ```yue |
| @@ -104,6 +107,7 @@ class Person | |||
| 104 | new: => | 107 | new: => |
| 105 | @clothes = [] | 108 | @clothes = [] |
| 106 | ``` | 109 | ``` |
| 110 | |||
| 107 | <YueDisplay> | 111 | <YueDisplay> |
| 108 | 112 | ||
| 109 | ```yue | 113 | ```yue |
| @@ -125,6 +129,7 @@ class BackPack extends Inventory | |||
| 125 | if #@items > size then error "backpack is full" | 129 | if #@items > size then error "backpack is full" |
| 126 | super name | 130 | super name |
| 127 | ``` | 131 | ``` |
| 132 | |||
| 128 | <YueDisplay> | 133 | <YueDisplay> |
| 129 | 134 | ||
| 130 | ```yue | 135 | ```yue |
| @@ -141,7 +146,7 @@ Aqui estendemos nossa classe Inventory e limitamos a quantidade de itens que ela | |||
| 141 | 146 | ||
| 142 | Neste exemplo, não definimos um construtor na subclasse, então o construtor da classe pai é chamado quando criamos uma nova instância. Se definirmos um construtor, podemos usar o método super para chamar o construtor pai. | 147 | Neste exemplo, não definimos um construtor na subclasse, então o construtor da classe pai é chamado quando criamos uma nova instância. Se definirmos um construtor, podemos usar o método super para chamar o construtor pai. |
| 143 | 148 | ||
| 144 | Sempre que uma classe herda de outra, ela envia uma mensagem à classe pai chamando o método __inherited na classe pai se ele existir. A função recebe dois argumentos: a classe que está sendo herdada e a classe filha. | 149 | Sempre que uma classe herda de outra, ela envia uma mensagem à classe pai chamando o método \_\_inherited na classe pai se ele existir. A função recebe dois argumentos: a classe que está sendo herdada e a classe filha. |
| 145 | 150 | ||
| 146 | ```yuescript | 151 | ```yuescript |
| 147 | class Shelf | 152 | class Shelf |
| @@ -151,6 +156,7 @@ class Shelf | |||
| 151 | -- vai imprimir: Shelf was inherited by Cupboard | 156 | -- vai imprimir: Shelf was inherited by Cupboard |
| 152 | class Cupboard extends Shelf | 157 | class Cupboard extends Shelf |
| 153 | ``` | 158 | ``` |
| 159 | |||
| 154 | <YueDisplay> | 160 | <YueDisplay> |
| 155 | 161 | ||
| 156 | ```yue | 162 | ```yue |
| @@ -189,6 +195,7 @@ class MyClass extends ParentClass | |||
| 189 | -- super como valor é igual à classe pai: | 195 | -- super como valor é igual à classe pai: |
| 190 | assert super == ParentClass | 196 | assert super == ParentClass |
| 191 | ``` | 197 | ``` |
| 198 | |||
| 192 | <YueDisplay> | 199 | <YueDisplay> |
| 193 | 200 | ||
| 194 | ```yue | 201 | ```yue |
| @@ -209,7 +216,7 @@ class MyClass extends ParentClass | |||
| 209 | 216 | ||
| 210 | ## Tipos | 217 | ## Tipos |
| 211 | 218 | ||
| 212 | Cada instância de uma classe carrega seu tipo consigo. Isso é armazenado na propriedade especial __class. Esta propriedade contém o objeto da classe. O objeto da classe é o que chamamos para construir uma nova instância. Também podemos indexar o objeto da classe para recuperar métodos e propriedades da classe. | 219 | Cada instância de uma classe carrega seu tipo consigo. Isso é armazenado na propriedade especial \_\_class. Esta propriedade contém o objeto da classe. O objeto da classe é o que chamamos para construir uma nova instância. Também podemos indexar o objeto da classe para recuperar métodos e propriedades da classe. |
| 213 | 220 | ||
| 214 | ```yuescript | 221 | ```yuescript |
| 215 | b = BackPack! | 222 | b = BackPack! |
| @@ -217,6 +224,7 @@ assert b.__class == BackPack | |||
| 217 | 224 | ||
| 218 | print BackPack.size -- imprime 10 | 225 | print BackPack.size -- imprime 10 |
| 219 | ``` | 226 | ``` |
| 227 | |||
| 220 | <YueDisplay> | 228 | <YueDisplay> |
| 221 | 229 | ||
| 222 | ```yue | 230 | ```yue |
| @@ -238,15 +246,16 @@ Uma classe é composta por duas tabelas. A própria tabela da classe e a tabela | |||
| 238 | 246 | ||
| 239 | A metatable do objeto da classe lê propriedades da base se não existirem no objeto da classe. Isso significa que podemos acessar funções e propriedades diretamente da classe. | 247 | A metatable do objeto da classe lê propriedades da base se não existirem no objeto da classe. Isso significa que podemos acessar funções e propriedades diretamente da classe. |
| 240 | 248 | ||
| 241 | É importante notar que atribuir ao objeto da classe não atribui à base, então não é uma forma válida de adicionar novos métodos às instâncias. Em vez disso, a base deve ser alterada explicitamente. Veja o campo __base abaixo. | 249 | É importante notar que atribuir ao objeto da classe não atribui à base, então não é uma forma válida de adicionar novos métodos às instâncias. Em vez disso, a base deve ser alterada explicitamente. Veja o campo \_\_base abaixo. |
| 242 | 250 | ||
| 243 | O objeto da classe tem algumas propriedades especiais: | 251 | O objeto da classe tem algumas propriedades especiais: |
| 244 | 252 | ||
| 245 | O nome da classe quando foi declarada é armazenado como string no campo __name do objeto da classe. | 253 | O nome da classe quando foi declarada é armazenado como string no campo \_\_name do objeto da classe. |
| 246 | 254 | ||
| 247 | ```yuescript | 255 | ```yuescript |
| 248 | print BackPack.__name -- imprime Backpack | 256 | print BackPack.__name -- imprime Backpack |
| 249 | ``` | 257 | ``` |
| 258 | |||
| 250 | <YueDisplay> | 259 | <YueDisplay> |
| 251 | 260 | ||
| 252 | ```yue | 261 | ```yue |
| @@ -255,9 +264,9 @@ print BackPack.__name -- imprime Backpack | |||
| 255 | 264 | ||
| 256 | </YueDisplay> | 265 | </YueDisplay> |
| 257 | 266 | ||
| 258 | O objeto base é armazenado em __base. Podemos modificar esta tabela para adicionar funcionalidade a instâncias que já foram criadas e às que ainda serão criadas. | 267 | O objeto base é armazenado em \_\_base. Podemos modificar esta tabela para adicionar funcionalidade a instâncias que já foram criadas e às que ainda serão criadas. |
| 259 | 268 | ||
| 260 | Se a classe estende de algo, o objeto da classe pai é armazenado em __parent. | 269 | Se a classe estende de algo, o objeto da classe pai é armazenado em \_\_parent. |
| 261 | 270 | ||
| 262 | ## Variáveis de classe | 271 | ## Variáveis de classe |
| 263 | 272 | ||
| @@ -272,6 +281,7 @@ Things\some_func! | |||
| 272 | -- variáveis de classe não visÃveis em instâncias | 281 | -- variáveis de classe não visÃveis em instâncias |
| 273 | assert Things().some_func == nil | 282 | assert Things().some_func == nil |
| 274 | ``` | 283 | ``` |
| 284 | |||
| 275 | <YueDisplay> | 285 | <YueDisplay> |
| 276 | 286 | ||
| 277 | ```yue | 287 | ```yue |
| @@ -286,7 +296,7 @@ assert Things().some_func == nil | |||
| 286 | 296 | ||
| 287 | </YueDisplay> | 297 | </YueDisplay> |
| 288 | 298 | ||
| 289 | Em expressões, podemos usar @@ para acessar um valor armazenado no __class de self. Assim, @@hello é abreviação para self.__class.hello. | 299 | Em expressões, podemos usar @@ para acessar um valor armazenado no **class de self. Assim, @@hello é abreviação para self.**class.hello. |
| 290 | 300 | ||
| 291 | ```yuescript | 301 | ```yuescript |
| 292 | class Counter | 302 | class Counter |
| @@ -300,6 +310,7 @@ Counter! | |||
| 300 | 310 | ||
| 301 | print Counter.count -- imprime 2 | 311 | print Counter.count -- imprime 2 |
| 302 | ``` | 312 | ``` |
| 313 | |||
| 303 | <YueDisplay> | 314 | <YueDisplay> |
| 304 | 315 | ||
| 305 | ```yue | 316 | ```yue |
| @@ -322,6 +333,7 @@ A semântica de chamada de @@ é semelhante a @. Chamar um nome @@ passará a cl | |||
| 322 | ```yuescript | 333 | ```yuescript |
| 323 | @@hello 1,2,3,4 | 334 | @@hello 1,2,3,4 |
| 324 | ``` | 335 | ``` |
| 336 | |||
| 325 | <YueDisplay> | 337 | <YueDisplay> |
| 326 | 338 | ||
| 327 | ```yue | 339 | ```yue |
| @@ -340,6 +352,7 @@ Aqui está uma forma alternativa de criar variável de classe comparada ao descr | |||
| 340 | class Things | 352 | class Things |
| 341 | @class_var = "hello world" | 353 | @class_var = "hello world" |
| 342 | ``` | 354 | ``` |
| 355 | |||
| 343 | <YueDisplay> | 356 | <YueDisplay> |
| 344 | 357 | ||
| 345 | ```yue | 358 | ```yue |
| @@ -361,6 +374,7 @@ class MoreThings | |||
| 361 | some_method: => | 374 | some_method: => |
| 362 | log "hello world: " .. secret | 375 | log "hello world: " .. secret |
| 363 | ``` | 376 | ``` |
| 377 | |||
| 364 | <YueDisplay> | 378 | <YueDisplay> |
| 365 | 379 | ||
| 366 | ```yue | 380 | ```yue |
| @@ -376,14 +390,15 @@ class MoreThings | |||
| 376 | 390 | ||
| 377 | ## Valores @ e @@ | 391 | ## Valores @ e @@ |
| 378 | 392 | ||
| 379 | Quando @ e @@ são prefixados na frente de um nome, eles representam, respectivamente, esse nome acessado em self e self.__class. | 393 | Quando @ e @@ são prefixados na frente de um nome, eles representam, respectivamente, esse nome acessado em self e self.\_\_class. |
| 380 | 394 | ||
| 381 | Se forem usados sozinhos, são aliases para self e self.__class. | 395 | Se forem usados sozinhos, são aliases para self e self.\_\_class. |
| 382 | 396 | ||
| 383 | ```yuescript | 397 | ```yuescript |
| 384 | assert @ == self | 398 | assert @ == self |
| 385 | assert @@ == self.__class | 399 | assert @@ == self.__class |
| 386 | ``` | 400 | ``` |
| 401 | |||
| 387 | <YueDisplay> | 402 | <YueDisplay> |
| 388 | 403 | ||
| 389 | ```yue | 404 | ```yue |
| @@ -398,6 +413,7 @@ Por exemplo, uma forma rápida de criar uma nova instância da mesma classe a pa | |||
| 398 | ```yuescript | 413 | ```yuescript |
| 399 | some_instance_method = (...) => @@ ... | 414 | some_instance_method = (...) => @@ ... |
| 400 | ``` | 415 | ``` |
| 416 | |||
| 401 | <YueDisplay> | 417 | <YueDisplay> |
| 402 | 418 | ||
| 403 | ```yue | 419 | ```yue |
| @@ -423,6 +439,7 @@ class Something | |||
| 423 | @@biz = biz | 439 | @@biz = biz |
| 424 | @@baz = baz | 440 | @@baz = baz |
| 425 | ``` | 441 | ``` |
| 442 | |||
| 426 | <YueDisplay> | 443 | <YueDisplay> |
| 427 | 444 | ||
| 428 | ```yue | 445 | ```yue |
| @@ -448,6 +465,7 @@ new = (@fieldA, @fieldB) => @ | |||
| 448 | obj = new {}, 123, "abc" | 465 | obj = new {}, 123, "abc" |
| 449 | print obj | 466 | print obj |
| 450 | ``` | 467 | ``` |
| 468 | |||
| 451 | <YueDisplay> | 469 | <YueDisplay> |
| 452 | 470 | ||
| 453 | ```yue | 471 | ```yue |
| @@ -467,6 +485,7 @@ x = class Bucket | |||
| 467 | drops: 0 | 485 | drops: 0 |
| 468 | add_drop: => @drops += 1 | 486 | add_drop: => @drops += 1 |
| 469 | ``` | 487 | ``` |
| 488 | |||
| 470 | <YueDisplay> | 489 | <YueDisplay> |
| 471 | 490 | ||
| 472 | ```yue | 491 | ```yue |
| @@ -479,7 +498,7 @@ x = class Bucket | |||
| 479 | 498 | ||
| 480 | ## Classes anônimas | 499 | ## Classes anônimas |
| 481 | 500 | ||
| 482 | O nome pode ser omitido ao declarar uma classe. O atributo __name será nil, a menos que a expressão da classe esteja em uma atribuição. O nome no lado esquerdo da atribuição é usado em vez de nil. | 501 | O nome pode ser omitido ao declarar uma classe. O atributo \_\_name será nil, a menos que a expressão da classe esteja em uma atribuição. O nome no lado esquerdo da atribuição é usado em vez de nil. |
| 483 | 502 | ||
| 484 | ```yuescript | 503 | ```yuescript |
| 485 | BigBucket = class extends Bucket | 504 | BigBucket = class extends Bucket |
| @@ -487,6 +506,7 @@ BigBucket = class extends Bucket | |||
| 487 | 506 | ||
| 488 | assert Bucket.__name == "BigBucket" | 507 | assert Bucket.__name == "BigBucket" |
| 489 | ``` | 508 | ``` |
| 509 | |||
| 490 | <YueDisplay> | 510 | <YueDisplay> |
| 491 | 511 | ||
| 492 | ```yue | 512 | ```yue |
| @@ -503,6 +523,7 @@ Você pode até omitir o corpo, significando que pode escrever uma classe anôni | |||
| 503 | ```yuescript | 523 | ```yuescript |
| 504 | x = class | 524 | x = class |
| 505 | ``` | 525 | ``` |
| 526 | |||
| 506 | <YueDisplay> | 527 | <YueDisplay> |
| 507 | 528 | ||
| 508 | ```yue | 529 | ```yue |
| @@ -532,6 +553,7 @@ y\func! | |||
| 532 | 553 | ||
| 533 | assert y.__class.__parent ~= X -- X não é pai de Y | 554 | assert y.__class.__parent ~= X -- X não é pai de Y |
| 534 | ``` | 555 | ``` |
| 556 | |||
| 535 | <YueDisplay> | 557 | <YueDisplay> |
| 536 | 558 | ||
| 537 | ```yue | 559 | ```yue |
diff --git a/doc/docs/pt-br/doc/objects/with-statement.md b/doc/docs/pt-br/doc/objects/with-statement.md index 6495d09..e5a56e5 100644 --- a/doc/docs/pt-br/doc/objects/with-statement.md +++ b/doc/docs/pt-br/doc/objects/with-statement.md | |||
| @@ -15,6 +15,7 @@ with Person! | |||
| 15 | \save! | 15 | \save! |
| 16 | print .name | 16 | print .name |
| 17 | ``` | 17 | ``` |
| 18 | |||
| 18 | <YueDisplay> | 19 | <YueDisplay> |
| 19 | 20 | ||
| 20 | ```yue | 21 | ```yue |
| @@ -33,6 +34,7 @@ A instrução with também pode ser usada como expressão que retorna o valor ao | |||
| 33 | file = with File "favorite_foods.txt" | 34 | file = with File "favorite_foods.txt" |
| 34 | \set_encoding "utf8" | 35 | \set_encoding "utf8" |
| 35 | ``` | 36 | ``` |
| 37 | |||
| 36 | <YueDisplay> | 38 | <YueDisplay> |
| 37 | 39 | ||
| 38 | ```yue | 40 | ```yue |
| @@ -52,6 +54,7 @@ create_person = (name, relatives) -> | |||
| 52 | 54 | ||
| 53 | me = create_person "Leaf", [dad, mother, sister] | 55 | me = create_person "Leaf", [dad, mother, sister] |
| 54 | ``` | 56 | ``` |
| 57 | |||
| 55 | <YueDisplay> | 58 | <YueDisplay> |
| 56 | 59 | ||
| 57 | ```yue | 60 | ```yue |
| @@ -74,6 +77,7 @@ with str := "Hello" | |||
| 74 | print "original:", str | 77 | print "original:", str |
| 75 | print "upper:", \upper! | 78 | print "upper:", \upper! |
| 76 | ``` | 79 | ``` |
| 80 | |||
| 77 | <YueDisplay> | 81 | <YueDisplay> |
| 78 | 82 | ||
| 79 | ```yue | 83 | ```yue |
| @@ -95,6 +99,7 @@ with tb | |||
| 95 | ["key-name"] = value | 99 | ["key-name"] = value |
| 96 | [] = "abc" -- anexando a "tb" | 100 | [] = "abc" -- anexando a "tb" |
| 97 | ``` | 101 | ``` |
| 102 | |||
| 98 | <YueDisplay> | 103 | <YueDisplay> |
| 99 | 104 | ||
| 100 | ```yue | 105 | ```yue |
| @@ -115,6 +120,7 @@ with tb | |||
| 115 | with? obj | 120 | with? obj |
| 116 | print obj.name | 121 | print obj.name |
| 117 | ``` | 122 | ``` |
| 123 | |||
| 118 | <YueDisplay> | 124 | <YueDisplay> |
| 119 | 125 | ||
| 120 | ```yue | 126 | ```yue |
diff --git a/doc/docs/pt-br/doc/reference/the-yuescript-library.md b/doc/docs/pt-br/doc/reference/the-yuescript-library.md index 2a65ffb..7775cd5 100644 --- a/doc/docs/pt-br/doc/reference/the-yuescript-library.md +++ b/doc/docs/pt-br/doc/reference/the-yuescript-library.md | |||
| @@ -17,6 +17,7 @@ A biblioteca da linguagem YueScript. | |||
| 17 | A versão do YueScript. | 17 | A versão do YueScript. |
| 18 | 18 | ||
| 19 | **Assinatura:** | 19 | **Assinatura:** |
| 20 | |||
| 20 | ```lua | 21 | ```lua |
| 21 | version: string | 22 | version: string |
| 22 | ``` | 23 | ``` |
| @@ -30,6 +31,7 @@ version: string | |||
| 30 | O separador de arquivos da plataforma atual. | 31 | O separador de arquivos da plataforma atual. |
| 31 | 32 | ||
| 32 | **Assinatura:** | 33 | **Assinatura:** |
| 34 | |||
| 33 | ```lua | 35 | ```lua |
| 34 | dirsep: string | 36 | dirsep: string |
| 35 | ``` | 37 | ``` |
| @@ -43,6 +45,7 @@ dirsep: string | |||
| 43 | O cache de código de módulo compilado. | 45 | O cache de código de módulo compilado. |
| 44 | 46 | ||
| 45 | **Assinatura:** | 47 | **Assinatura:** |
| 48 | |||
| 46 | ```lua | 49 | ```lua |
| 47 | yue_compiled: {string: string} | 50 | yue_compiled: {string: string} |
| 48 | ``` | 51 | ``` |
| @@ -56,6 +59,7 @@ yue_compiled: {string: string} | |||
| 56 | A função de compilação do YueScript. Compila o código YueScript para código Lua. | 59 | A função de compilação do YueScript. Compila o código YueScript para código Lua. |
| 57 | 60 | ||
| 58 | **Assinatura:** | 61 | **Assinatura:** |
| 62 | |||
| 59 | ```lua | 63 | ```lua |
| 60 | to_lua: function(code: string, config?: Config): | 64 | to_lua: function(code: string, config?: Config): |
| 61 | --[[codes]] string | nil, | 65 | --[[codes]] string | nil, |
| @@ -65,17 +69,17 @@ to_lua: function(code: string, config?: Config): | |||
| 65 | 69 | ||
| 66 | **Parâmetros:** | 70 | **Parâmetros:** |
| 67 | 71 | ||
| 68 | | Parâmetro | Tipo | Descrição | | 72 | | Parâmetro | Tipo | Descrição | |
| 69 | | --- | --- | --- | | 73 | | --------- | ------ | ----------------------------------- | |
| 70 | | code | string | O código YueScript. | | 74 | | code | string | O código YueScript. | |
| 71 | | config | Config | [Opcional] As opções do compilador. | | 75 | | config | Config | [Opcional] As opções do compilador. | |
| 72 | 76 | ||
| 73 | **Retorna:** | 77 | **Retorna:** |
| 74 | 78 | ||
| 75 | | Tipo de Retorno | Descrição | | 79 | | Tipo de Retorno | Descrição | |
| 76 | | --- | --- | | 80 | | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | |
| 77 | | string \| nil | O código Lua compilado, ou nil se a compilação falhou. | | 81 | | string \| nil | O código Lua compilado, ou nil se a compilação falhou. | |
| 78 | | string \| nil | A mensagem de erro, ou nil se a compilação foi bem-sucedida. | | 82 | | string \| nil | A mensagem de erro, ou nil se a compilação foi bem-sucedida. | |
| 79 | | {{string, integer, integer}} \| nil | As variáveis globais que aparecem no código (com nome, linha e coluna), ou nil se a opção do compilador `lint_global` for false. | | 83 | | {{string, integer, integer}} \| nil | As variáveis globais que aparecem no código (com nome, linha e coluna), ou nil se a opção do compilador `lint_global` for false. | |
| 80 | 84 | ||
| 81 | ### file_exist | 85 | ### file_exist |
| @@ -87,21 +91,22 @@ to_lua: function(code: string, config?: Config): | |||
| 87 | Função de verificação de existência do arquivo fonte. Pode ser sobrescrita para personalizar o comportamento. | 91 | Função de verificação de existência do arquivo fonte. Pode ser sobrescrita para personalizar o comportamento. |
| 88 | 92 | ||
| 89 | **Assinatura:** | 93 | **Assinatura:** |
| 94 | |||
| 90 | ```lua | 95 | ```lua |
| 91 | file_exist: function(filename: string): boolean | 96 | file_exist: function(filename: string): boolean |
| 92 | ``` | 97 | ``` |
| 93 | 98 | ||
| 94 | **Parâmetros:** | 99 | **Parâmetros:** |
| 95 | 100 | ||
| 96 | | Parâmetro | Tipo | Descrição | | 101 | | Parâmetro | Tipo | Descrição | |
| 97 | | --- | --- | --- | | 102 | | --------- | ------ | ------------------ | |
| 98 | | filename | string | O nome do arquivo. | | 103 | | filename | string | O nome do arquivo. | |
| 99 | 104 | ||
| 100 | **Retorna:** | 105 | **Retorna:** |
| 101 | 106 | ||
| 102 | | Tipo de Retorno | Descrição | | 107 | | Tipo de Retorno | Descrição | |
| 103 | | --- | --- | | 108 | | --------------- | -------------------- | |
| 104 | | boolean | Se o arquivo existe. | | 109 | | boolean | Se o arquivo existe. | |
| 105 | 110 | ||
| 106 | ### read_file | 111 | ### read_file |
| 107 | 112 | ||
| @@ -112,21 +117,22 @@ file_exist: function(filename: string): boolean | |||
| 112 | Função de leitura do arquivo fonte. Pode ser sobrescrita para personalizar o comportamento. | 117 | Função de leitura do arquivo fonte. Pode ser sobrescrita para personalizar o comportamento. |
| 113 | 118 | ||
| 114 | **Assinatura:** | 119 | **Assinatura:** |
| 120 | |||
| 115 | ```lua | 121 | ```lua |
| 116 | read_file: function(filename: string): string | 122 | read_file: function(filename: string): string |
| 117 | ``` | 123 | ``` |
| 118 | 124 | ||
| 119 | **Parâmetros:** | 125 | **Parâmetros:** |
| 120 | 126 | ||
| 121 | | Parâmetro | Tipo | Descrição | | 127 | | Parâmetro | Tipo | Descrição | |
| 122 | | --- | --- | --- | | 128 | | --------- | ------ | ------------------ | |
| 123 | | filename | string | O nome do arquivo. | | 129 | | filename | string | O nome do arquivo. | |
| 124 | 130 | ||
| 125 | **Retorna:** | 131 | **Retorna:** |
| 126 | 132 | ||
| 127 | | Tipo de Retorno | Descrição | | 133 | | Tipo de Retorno | Descrição | |
| 128 | | --- | --- | | 134 | | --------------- | ---------------------- | |
| 129 | | string | O conteúdo do arquivo. | | 135 | | string | O conteúdo do arquivo. | |
| 130 | 136 | ||
| 131 | ### insert_loader | 137 | ### insert_loader |
| 132 | 138 | ||
| @@ -137,21 +143,22 @@ read_file: function(filename: string): string | |||
| 137 | Insere o carregador YueScript nos carregadores de pacote (searchers). | 143 | Insere o carregador YueScript nos carregadores de pacote (searchers). |
| 138 | 144 | ||
| 139 | **Assinatura:** | 145 | **Assinatura:** |
| 146 | |||
| 140 | ```lua | 147 | ```lua |
| 141 | insert_loader: function(pos?: integer): boolean | 148 | insert_loader: function(pos?: integer): boolean |
| 142 | ``` | 149 | ``` |
| 143 | 150 | ||
| 144 | **Parâmetros:** | 151 | **Parâmetros:** |
| 145 | 152 | ||
| 146 | | Parâmetro | Tipo | Descrição | | 153 | | Parâmetro | Tipo | Descrição | |
| 147 | | --- | --- | --- | | 154 | | --------- | ------- | ----------------------------------------------------------- | |
| 148 | | pos | integer | [Opcional] A posição para inserir o carregador. Padrão é 3. | | 155 | | pos | integer | [Opcional] A posição para inserir o carregador. Padrão é 3. | |
| 149 | 156 | ||
| 150 | **Retorna:** | 157 | **Retorna:** |
| 151 | 158 | ||
| 152 | | Tipo de Retorno | Descrição | | 159 | | Tipo de Retorno | Descrição | |
| 153 | | --- | --- | | 160 | | --------------- | -------------------------------------------------------------------------------------- | |
| 154 | | boolean | Se o carregador foi inserido com sucesso. Falhará se o carregador já estiver inserido. | | 161 | | boolean | Se o carregador foi inserido com sucesso. Falhará se o carregador já estiver inserido. | |
| 155 | 162 | ||
| 156 | ### remove_loader | 163 | ### remove_loader |
| 157 | 164 | ||
| @@ -162,15 +169,16 @@ insert_loader: function(pos?: integer): boolean | |||
| 162 | Remove o carregador YueScript dos carregadores de pacote (searchers). | 169 | Remove o carregador YueScript dos carregadores de pacote (searchers). |
| 163 | 170 | ||
| 164 | **Assinatura:** | 171 | **Assinatura:** |
| 172 | |||
| 165 | ```lua | 173 | ```lua |
| 166 | remove_loader: function(): boolean | 174 | remove_loader: function(): boolean |
| 167 | ``` | 175 | ``` |
| 168 | 176 | ||
| 169 | **Retorna:** | 177 | **Retorna:** |
| 170 | 178 | ||
| 171 | | Tipo de Retorno | Descrição | | 179 | | Tipo de Retorno | Descrição | |
| 172 | | --- | --- | | 180 | | --------------- | --------------------------------------------------------------------------------------- | |
| 173 | | boolean | Se o carregador foi removido com sucesso. Falhará se o carregador não estiver inserido. | | 181 | | boolean | Se o carregador foi removido com sucesso. Falhará se o carregador não estiver inserido. | |
| 174 | 182 | ||
| 175 | ### loadstring | 183 | ### loadstring |
| 176 | 184 | ||
| @@ -181,6 +189,7 @@ remove_loader: function(): boolean | |||
| 181 | Carrega código YueScript de uma string em uma função. | 189 | Carrega código YueScript de uma string em uma função. |
| 182 | 190 | ||
| 183 | **Assinatura:** | 191 | **Assinatura:** |
| 192 | |||
| 184 | ```lua | 193 | ```lua |
| 185 | loadstring: function(input: string, chunkname: string, env: table, config?: Config): | 194 | loadstring: function(input: string, chunkname: string, env: table, config?: Config): |
| 186 | --[[loaded function]] nil | function(...: any): (any...), | 195 | --[[loaded function]] nil | function(...: any): (any...), |
| @@ -189,19 +198,19 @@ loadstring: function(input: string, chunkname: string, env: table, config?: Conf | |||
| 189 | 198 | ||
| 190 | **Parâmetros:** | 199 | **Parâmetros:** |
| 191 | 200 | ||
| 192 | | Parâmetro | Tipo | Descrição | | 201 | | Parâmetro | Tipo | Descrição | |
| 193 | | --- | --- | --- | | 202 | | --------- | ------ | ----------------------------------- | |
| 194 | | input | string | O código YueScript. | | 203 | | input | string | O código YueScript. | |
| 195 | | chunkname | string | O nome do chunk de código. | | 204 | | chunkname | string | O nome do chunk de código. | |
| 196 | | env | table | A tabela de ambiente. | | 205 | | env | table | A tabela de ambiente. | |
| 197 | | config | Config | [Opcional] As opções do compilador. | | 206 | | config | Config | [Opcional] As opções do compilador. | |
| 198 | 207 | ||
| 199 | **Retorna:** | 208 | **Retorna:** |
| 200 | 209 | ||
| 201 | | Tipo de Retorno | Descrição | | 210 | | Tipo de Retorno | Descrição | |
| 202 | | --- | --- | | 211 | | --------------- | -------------------------------------------------------------- | |
| 203 | | function \| nil | A função carregada, ou nil se o carregamento falhou. | | 212 | | function \| nil | A função carregada, ou nil se o carregamento falhou. | |
| 204 | | string \| nil | A mensagem de erro, ou nil se o carregamento foi bem-sucedido. | | 213 | | string \| nil | A mensagem de erro, ou nil se o carregamento foi bem-sucedido. | |
| 205 | 214 | ||
| 206 | ### loadstring | 215 | ### loadstring |
| 207 | 216 | ||
| @@ -212,6 +221,7 @@ loadstring: function(input: string, chunkname: string, env: table, config?: Conf | |||
| 212 | Carrega código YueScript de uma string em uma função. | 221 | Carrega código YueScript de uma string em uma função. |
| 213 | 222 | ||
| 214 | **Assinatura:** | 223 | **Assinatura:** |
| 224 | |||
| 215 | ```lua | 225 | ```lua |
| 216 | loadstring: function(input: string, chunkname: string, config?: Config): | 226 | loadstring: function(input: string, chunkname: string, config?: Config): |
| 217 | --[[loaded function]] nil | function(...: any): (any...), | 227 | --[[loaded function]] nil | function(...: any): (any...), |
| @@ -220,18 +230,18 @@ loadstring: function(input: string, chunkname: string, config?: Config): | |||
| 220 | 230 | ||
| 221 | **Parâmetros:** | 231 | **Parâmetros:** |
| 222 | 232 | ||
| 223 | | Parâmetro | Tipo | Descrição | | 233 | | Parâmetro | Tipo | Descrição | |
| 224 | | --- | --- | --- | | 234 | | --------- | ------ | ----------------------------------- | |
| 225 | | input | string | O código YueScript. | | 235 | | input | string | O código YueScript. | |
| 226 | | chunkname | string | O nome do chunk de código. | | 236 | | chunkname | string | O nome do chunk de código. | |
| 227 | | config | Config | [Opcional] As opções do compilador. | | 237 | | config | Config | [Opcional] As opções do compilador. | |
| 228 | 238 | ||
| 229 | **Retorna:** | 239 | **Retorna:** |
| 230 | 240 | ||
| 231 | | Tipo de Retorno | Descrição | | 241 | | Tipo de Retorno | Descrição | |
| 232 | | --- | --- | | 242 | | --------------- | -------------------------------------------------------------- | |
| 233 | | function \| nil | A função carregada, ou nil se o carregamento falhou. | | 243 | | function \| nil | A função carregada, ou nil se o carregamento falhou. | |
| 234 | | string \| nil | A mensagem de erro, ou nil se o carregamento foi bem-sucedido. | | 244 | | string \| nil | A mensagem de erro, ou nil se o carregamento foi bem-sucedido. | |
| 235 | 245 | ||
| 236 | ### loadstring | 246 | ### loadstring |
| 237 | 247 | ||
| @@ -242,6 +252,7 @@ loadstring: function(input: string, chunkname: string, config?: Config): | |||
| 242 | Carrega código YueScript de uma string em uma função. | 252 | Carrega código YueScript de uma string em uma função. |
| 243 | 253 | ||
| 244 | **Assinatura:** | 254 | **Assinatura:** |
| 255 | |||
| 245 | ```lua | 256 | ```lua |
| 246 | loadstring: function(input: string, config?: Config): | 257 | loadstring: function(input: string, config?: Config): |
| 247 | --[[loaded function]] nil | function(...: any): (any...), | 258 | --[[loaded function]] nil | function(...: any): (any...), |
| @@ -250,17 +261,17 @@ loadstring: function(input: string, config?: Config): | |||
| 250 | 261 | ||
| 251 | **Parâmetros:** | 262 | **Parâmetros:** |
| 252 | 263 | ||
| 253 | | Parâmetro | Tipo | Descrição | | 264 | | Parâmetro | Tipo | Descrição | |
| 254 | | --- | --- | --- | | 265 | | --------- | ------ | ----------------------------------- | |
| 255 | | input | string | O código YueScript. | | 266 | | input | string | O código YueScript. | |
| 256 | | config | Config | [Opcional] As opções do compilador. | | 267 | | config | Config | [Opcional] As opções do compilador. | |
| 257 | 268 | ||
| 258 | **Retorna:** | 269 | **Retorna:** |
| 259 | 270 | ||
| 260 | | Tipo de Retorno | Descrição | | 271 | | Tipo de Retorno | Descrição | |
| 261 | | --- | --- | | 272 | | --------------- | -------------------------------------------------------------- | |
| 262 | | function \| nil | A função carregada, ou nil se o carregamento falhou. | | 273 | | function \| nil | A função carregada, ou nil se o carregamento falhou. | |
| 263 | | string \| nil | A mensagem de erro, ou nil se o carregamento foi bem-sucedido. | | 274 | | string \| nil | A mensagem de erro, ou nil se o carregamento foi bem-sucedido. | |
| 264 | 275 | ||
| 265 | ### loadfile | 276 | ### loadfile |
| 266 | 277 | ||
| @@ -271,6 +282,7 @@ loadstring: function(input: string, config?: Config): | |||
| 271 | Carrega código YueScript de um arquivo em uma função. | 282 | Carrega código YueScript de um arquivo em uma função. |
| 272 | 283 | ||
| 273 | **Assinatura:** | 284 | **Assinatura:** |
| 285 | |||
| 274 | ```lua | 286 | ```lua |
| 275 | loadfile: function(filename: string, env: table, config?: Config): | 287 | loadfile: function(filename: string, env: table, config?: Config): |
| 276 | nil | function(...: any): (any...), | 288 | nil | function(...: any): (any...), |
| @@ -279,18 +291,18 @@ loadfile: function(filename: string, env: table, config?: Config): | |||
| 279 | 291 | ||
| 280 | **Parâmetros:** | 292 | **Parâmetros:** |
| 281 | 293 | ||
| 282 | | Parâmetro | Tipo | Descrição | | 294 | | Parâmetro | Tipo | Descrição | |
| 283 | | --- | --- | --- | | 295 | | --------- | ------ | ----------------------------------- | |
| 284 | | filename | string | O nome do arquivo. | | 296 | | filename | string | O nome do arquivo. | |
| 285 | | env | table | A tabela de ambiente. | | 297 | | env | table | A tabela de ambiente. | |
| 286 | | config | Config | [Opcional] As opções do compilador. | | 298 | | config | Config | [Opcional] As opções do compilador. | |
| 287 | 299 | ||
| 288 | **Retorna:** | 300 | **Retorna:** |
| 289 | 301 | ||
| 290 | | Tipo de Retorno | Descrição | | 302 | | Tipo de Retorno | Descrição | |
| 291 | | --- | --- | | 303 | | --------------- | -------------------------------------------------------------- | |
| 292 | | function \| nil | A função carregada, ou nil se o carregamento falhou. | | 304 | | function \| nil | A função carregada, ou nil se o carregamento falhou. | |
| 293 | | string \| nil | A mensagem de erro, ou nil se o carregamento foi bem-sucedido. | | 305 | | string \| nil | A mensagem de erro, ou nil se o carregamento foi bem-sucedido. | |
| 294 | 306 | ||
| 295 | ### loadfile | 307 | ### loadfile |
| 296 | 308 | ||
| @@ -301,6 +313,7 @@ loadfile: function(filename: string, env: table, config?: Config): | |||
| 301 | Carrega código YueScript de um arquivo em uma função. | 313 | Carrega código YueScript de um arquivo em uma função. |
| 302 | 314 | ||
| 303 | **Assinatura:** | 315 | **Assinatura:** |
| 316 | |||
| 304 | ```lua | 317 | ```lua |
| 305 | loadfile: function(filename: string, config?: Config): | 318 | loadfile: function(filename: string, config?: Config): |
| 306 | nil | function(...: any): (any...), | 319 | nil | function(...: any): (any...), |
| @@ -309,17 +322,17 @@ loadfile: function(filename: string, config?: Config): | |||
| 309 | 322 | ||
| 310 | **Parâmetros:** | 323 | **Parâmetros:** |
| 311 | 324 | ||
| 312 | | Parâmetro | Tipo | Descrição | | 325 | | Parâmetro | Tipo | Descrição | |
| 313 | | --- | --- | --- | | 326 | | --------- | ------ | ----------------------------------- | |
| 314 | | filename | string | O nome do arquivo. | | 327 | | filename | string | O nome do arquivo. | |
| 315 | | config | Config | [Opcional] As opções do compilador. | | 328 | | config | Config | [Opcional] As opções do compilador. | |
| 316 | 329 | ||
| 317 | **Retorna:** | 330 | **Retorna:** |
| 318 | 331 | ||
| 319 | | Tipo de Retorno | Descrição | | 332 | | Tipo de Retorno | Descrição | |
| 320 | | --- | --- | | 333 | | --------------- | -------------------------------------------------------------- | |
| 321 | | function \| nil | A função carregada, ou nil se o carregamento falhou. | | 334 | | function \| nil | A função carregada, ou nil se o carregamento falhou. | |
| 322 | | string \| nil | A mensagem de erro, ou nil se o carregamento foi bem-sucedido. | | 335 | | string \| nil | A mensagem de erro, ou nil se o carregamento foi bem-sucedido. | |
| 323 | 336 | ||
| 324 | ### dofile | 337 | ### dofile |
| 325 | 338 | ||
| @@ -330,23 +343,24 @@ loadfile: function(filename: string, config?: Config): | |||
| 330 | Carrega código YueScript de um arquivo em uma função e o executa. | 343 | Carrega código YueScript de um arquivo em uma função e o executa. |
| 331 | 344 | ||
| 332 | **Assinatura:** | 345 | **Assinatura:** |
| 346 | |||
| 333 | ```lua | 347 | ```lua |
| 334 | dofile: function(filename: string, env: table, config?: Config): any... | 348 | dofile: function(filename: string, env: table, config?: Config): any... |
| 335 | ``` | 349 | ``` |
| 336 | 350 | ||
| 337 | **Parâmetros:** | 351 | **Parâmetros:** |
| 338 | 352 | ||
| 339 | | Parâmetro | Tipo | Descrição | | 353 | | Parâmetro | Tipo | Descrição | |
| 340 | | --- | --- | --- | | 354 | | --------- | ------ | ----------------------------------- | |
| 341 | | filename | string | O nome do arquivo. | | 355 | | filename | string | O nome do arquivo. | |
| 342 | | env | table | A tabela de ambiente. | | 356 | | env | table | A tabela de ambiente. | |
| 343 | | config | Config | [Opcional] As opções do compilador. | | 357 | | config | Config | [Opcional] As opções do compilador. | |
| 344 | 358 | ||
| 345 | **Retorna:** | 359 | **Retorna:** |
| 346 | 360 | ||
| 347 | | Tipo de Retorno | Descrição | | 361 | | Tipo de Retorno | Descrição | |
| 348 | | --- | --- | | 362 | | --------------- | ------------------------------------------ | |
| 349 | | any... | Os valores de retorno da função carregada. | | 363 | | any... | Os valores de retorno da função carregada. | |
| 350 | 364 | ||
| 351 | ### dofile | 365 | ### dofile |
| 352 | 366 | ||
| @@ -357,22 +371,23 @@ dofile: function(filename: string, env: table, config?: Config): any... | |||
| 357 | Carrega código YueScript de um arquivo em uma função e o executa. | 371 | Carrega código YueScript de um arquivo em uma função e o executa. |
| 358 | 372 | ||
| 359 | **Assinatura:** | 373 | **Assinatura:** |
| 374 | |||
| 360 | ```lua | 375 | ```lua |
| 361 | dofile: function(filename: string, config?: Config): any... | 376 | dofile: function(filename: string, config?: Config): any... |
| 362 | ``` | 377 | ``` |
| 363 | 378 | ||
| 364 | **Parâmetros:** | 379 | **Parâmetros:** |
| 365 | 380 | ||
| 366 | | Parâmetro | Tipo | Descrição | | 381 | | Parâmetro | Tipo | Descrição | |
| 367 | | --- | --- | --- | | 382 | | --------- | ------ | ----------------------------------- | |
| 368 | | filename | string | O nome do arquivo. | | 383 | | filename | string | O nome do arquivo. | |
| 369 | | config | Config | [Opcional] As opções do compilador. | | 384 | | config | Config | [Opcional] As opções do compilador. | |
| 370 | 385 | ||
| 371 | **Retorna:** | 386 | **Retorna:** |
| 372 | 387 | ||
| 373 | | Tipo de Retorno | Descrição | | 388 | | Tipo de Retorno | Descrição | |
| 374 | | --- | --- | | 389 | | --------------- | ------------------------------------------ | |
| 375 | | any... | Os valores de retorno da função carregada. | | 390 | | any... | Os valores de retorno da função carregada. | |
| 376 | 391 | ||
| 377 | ### find_modulepath | 392 | ### find_modulepath |
| 378 | 393 | ||
| @@ -383,21 +398,22 @@ dofile: function(filename: string, config?: Config): any... | |||
| 383 | Resolve o nome do módulo YueScript para o caminho do arquivo. | 398 | Resolve o nome do módulo YueScript para o caminho do arquivo. |
| 384 | 399 | ||
| 385 | **Assinatura:** | 400 | **Assinatura:** |
| 401 | |||
| 386 | ```lua | 402 | ```lua |
| 387 | find_modulepath: function(name: string): string | 403 | find_modulepath: function(name: string): string |
| 388 | ``` | 404 | ``` |
| 389 | 405 | ||
| 390 | **Parâmetros:** | 406 | **Parâmetros:** |
| 391 | 407 | ||
| 392 | | Parâmetro | Tipo | Descrição | | 408 | | Parâmetro | Tipo | Descrição | |
| 393 | | --- | --- | --- | | 409 | | --------- | ------ | ----------------- | |
| 394 | | name | string | O nome do módulo. | | 410 | | name | string | O nome do módulo. | |
| 395 | 411 | ||
| 396 | **Retorna:** | 412 | **Retorna:** |
| 397 | 413 | ||
| 398 | | Tipo de Retorno | Descrição | | 414 | | Tipo de Retorno | Descrição | |
| 399 | | --- | --- | | 415 | | --------------- | --------------------- | |
| 400 | | string | O caminho do arquivo. | | 416 | | string | O caminho do arquivo. | |
| 401 | 417 | ||
| 402 | ### pcall | 418 | ### pcall |
| 403 | 419 | ||
| @@ -410,22 +426,23 @@ Captura quaisquer erros e retorna um código de status e resultados ou objeto de | |||
| 410 | Reescreve o número da linha do erro para o número da linha original no código YueScript quando ocorrem erros. | 426 | Reescreve o número da linha do erro para o número da linha original no código YueScript quando ocorrem erros. |
| 411 | 427 | ||
| 412 | **Assinatura:** | 428 | **Assinatura:** |
| 429 | |||
| 413 | ```lua | 430 | ```lua |
| 414 | pcall: function(f: function, ...: any): boolean, any... | 431 | pcall: function(f: function, ...: any): boolean, any... |
| 415 | ``` | 432 | ``` |
| 416 | 433 | ||
| 417 | **Parâmetros:** | 434 | **Parâmetros:** |
| 418 | 435 | ||
| 419 | | Parâmetro | Tipo | Descrição | | 436 | | Parâmetro | Tipo | Descrição | |
| 420 | | --- | --- | --- | | 437 | | --------- | -------- | ---------------------------------- | |
| 421 | | f | function | A função a chamar. | | 438 | | f | function | A função a chamar. | |
| 422 | | ... | any | Argumentos a passar para a função. | | 439 | | ... | any | Argumentos a passar para a função. | |
| 423 | 440 | ||
| 424 | **Retorna:** | 441 | **Retorna:** |
| 425 | 442 | ||
| 426 | | Tipo de Retorno | Descrição | | 443 | | Tipo de Retorno | Descrição | |
| 427 | | --- | --- | | 444 | | --------------- | ---------------------------------------------------------- | |
| 428 | | boolean, ... | Código de status e resultados da função ou objeto de erro. | | 445 | | boolean, ... | Código de status e resultados da função ou objeto de erro. | |
| 429 | 446 | ||
| 430 | ### require | 447 | ### require |
| 431 | 448 | ||
| @@ -437,21 +454,22 @@ Carrega um módulo dado. Pode ser um módulo Lua ou um módulo YueScript. | |||
| 437 | Reescreve o número da linha do erro para o número da linha original no código YueScript se o módulo for um módulo YueScript e o carregamento falhar. | 454 | Reescreve o número da linha do erro para o número da linha original no código YueScript se o módulo for um módulo YueScript e o carregamento falhar. |
| 438 | 455 | ||
| 439 | **Assinatura:** | 456 | **Assinatura:** |
| 457 | |||
| 440 | ```lua | 458 | ```lua |
| 441 | require: function(name: string): any... | 459 | require: function(name: string): any... |
| 442 | ``` | 460 | ``` |
| 443 | 461 | ||
| 444 | **Parâmetros:** | 462 | **Parâmetros:** |
| 445 | 463 | ||
| 446 | | Parâmetro | Tipo | Descrição | | 464 | | Parâmetro | Tipo | Descrição | |
| 447 | | --- | --- | --- | | 465 | | --------- | ------ | ---------------------------- | |
| 448 | | modname | string | O nome do módulo a carregar. | | 466 | | modname | string | O nome do módulo a carregar. | |
| 449 | 467 | ||
| 450 | **Retorna:** | 468 | **Retorna:** |
| 451 | 469 | ||
| 452 | | Tipo de Retorno | Descrição | | 470 | | Tipo de Retorno | Descrição | |
| 453 | | --- | --- | | 471 | | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 454 | | any | O valor armazenado em package.loaded[modname] se o módulo já estiver carregado. Caso contrário, tenta encontrar um carregador e retorna o valor final de package.loaded[modname] e os dados do carregador como segundo resultado. | | 472 | | any | O valor armazenado em package.loaded[modname] se o módulo já estiver carregado. Caso contrário, tenta encontrar um carregador e retorna o valor final de package.loaded[modname] e os dados do carregador como segundo resultado. | |
| 455 | 473 | ||
| 456 | ### p | 474 | ### p |
| 457 | 475 | ||
| @@ -462,15 +480,16 @@ require: function(name: string): any... | |||
| 462 | Inspeciona as estruturas dos valores passados e imprime representações em string. | 480 | Inspeciona as estruturas dos valores passados e imprime representações em string. |
| 463 | 481 | ||
| 464 | **Assinatura:** | 482 | **Assinatura:** |
| 483 | |||
| 465 | ```lua | 484 | ```lua |
| 466 | p: function(...: any) | 485 | p: function(...: any) |
| 467 | ``` | 486 | ``` |
| 468 | 487 | ||
| 469 | **Parâmetros:** | 488 | **Parâmetros:** |
| 470 | 489 | ||
| 471 | | Parâmetro | Tipo | Descrição | | 490 | | Parâmetro | Tipo | Descrição | |
| 472 | | --- | --- | --- | | 491 | | --------- | ---- | ------------------------- | |
| 473 | | ... | any | Os valores a inspecionar. | | 492 | | ... | any | Os valores a inspecionar. | |
| 474 | 493 | ||
| 475 | ### options | 494 | ### options |
| 476 | 495 | ||
| @@ -481,6 +500,7 @@ p: function(...: any) | |||
| 481 | As opções atuais do compilador. | 500 | As opções atuais do compilador. |
| 482 | 501 | ||
| 483 | **Assinatura:** | 502 | **Assinatura:** |
| 503 | |||
| 484 | ```lua | 504 | ```lua |
| 485 | options: Config.Options | 505 | options: Config.Options |
| 486 | ``` | 506 | ``` |
| @@ -494,21 +514,22 @@ options: Config.Options | |||
| 494 | A função traceback que reescreve os números das linhas do stack trace para os números das linhas originais no código YueScript. | 514 | A função traceback que reescreve os números das linhas do stack trace para os números das linhas originais no código YueScript. |
| 495 | 515 | ||
| 496 | **Assinatura:** | 516 | **Assinatura:** |
| 517 | |||
| 497 | ```lua | 518 | ```lua |
| 498 | traceback: function(message: string): string | 519 | traceback: function(message: string): string |
| 499 | ``` | 520 | ``` |
| 500 | 521 | ||
| 501 | **Parâmetros:** | 522 | **Parâmetros:** |
| 502 | 523 | ||
| 503 | | Parâmetro | Tipo | Descrição | | 524 | | Parâmetro | Tipo | Descrição | |
| 504 | | --- | --- | --- | | 525 | | --------- | ------ | ------------------------ | |
| 505 | | message | string | A mensagem de traceback. | | 526 | | message | string | A mensagem de traceback. | |
| 506 | 527 | ||
| 507 | **Retorna:** | 528 | **Retorna:** |
| 508 | 529 | ||
| 509 | | Tipo de Retorno | Descrição | | 530 | | Tipo de Retorno | Descrição | |
| 510 | | --- | --- | | 531 | | --------------- | ---------------------------------- | |
| 511 | | string | A mensagem de traceback reescrita. | | 532 | | string | A mensagem de traceback reescrita. | |
| 512 | 533 | ||
| 513 | ### is_ast | 534 | ### is_ast |
| 514 | 535 | ||
| @@ -519,22 +540,23 @@ traceback: function(message: string): string | |||
| 519 | Verifica se o código corresponde ao AST especificado. | 540 | Verifica se o código corresponde ao AST especificado. |
| 520 | 541 | ||
| 521 | **Assinatura:** | 542 | **Assinatura:** |
| 543 | |||
| 522 | ```lua | 544 | ```lua |
| 523 | is_ast: function(astName: string, code: string): boolean | 545 | is_ast: function(astName: string, code: string): boolean |
| 524 | ``` | 546 | ``` |
| 525 | 547 | ||
| 526 | **Parâmetros:** | 548 | **Parâmetros:** |
| 527 | 549 | ||
| 528 | | Parâmetro | Tipo | Descrição | | 550 | | Parâmetro | Tipo | Descrição | |
| 529 | | --- | --- | --- | | 551 | | --------- | ------ | -------------- | |
| 530 | | astName | string | O nome do AST. | | 552 | | astName | string | O nome do AST. | |
| 531 | | code | string | O código. | | 553 | | code | string | O código. | |
| 532 | 554 | ||
| 533 | **Retorna:** | 555 | **Retorna:** |
| 534 | 556 | ||
| 535 | | Tipo de Retorno | Descrição | | 557 | | Tipo de Retorno | Descrição | |
| 536 | | --- | --- | | 558 | | --------------- | ------------------------------- | |
| 537 | | boolean | Se o código corresponde ao AST. | | 559 | | boolean | Se o código corresponde ao AST. | |
| 538 | 560 | ||
| 539 | ### AST | 561 | ### AST |
| 540 | 562 | ||
| @@ -545,6 +567,7 @@ is_ast: function(astName: string, code: string): boolean | |||
| 545 | A definição do tipo AST com nome, linha, coluna e subnós. | 567 | A definição do tipo AST com nome, linha, coluna e subnós. |
| 546 | 568 | ||
| 547 | **Assinatura:** | 569 | **Assinatura:** |
| 570 | |||
| 548 | ```lua | 571 | ```lua |
| 549 | type AST = {string, integer, integer, any} | 572 | type AST = {string, integer, integer, any} |
| 550 | ``` | 573 | ``` |
| @@ -558,6 +581,7 @@ type AST = {string, integer, integer, any} | |||
| 558 | Converte o código para o AST. | 581 | Converte o código para o AST. |
| 559 | 582 | ||
| 560 | **Assinatura:** | 583 | **Assinatura:** |
| 584 | |||
| 561 | ```lua | 585 | ```lua |
| 562 | to_ast: function(code: string, flattenLevel?: number, astName?: string, reserveComment?: boolean): | 586 | to_ast: function(code: string, flattenLevel?: number, astName?: string, reserveComment?: boolean): |
| 563 | --[[AST]] AST | nil, | 587 | --[[AST]] AST | nil, |
| @@ -566,19 +590,19 @@ to_ast: function(code: string, flattenLevel?: number, astName?: string, reserveC | |||
| 566 | 590 | ||
| 567 | **Parâmetros:** | 591 | **Parâmetros:** |
| 568 | 592 | ||
| 569 | | Parâmetro | Tipo | Descrição | | 593 | | Parâmetro | Tipo | Descrição | |
| 570 | | --- | --- | --- | | 594 | | -------------- | ------- | ------------------------------------------------------------------------------------------------------ | |
| 571 | | code | string | O código. | | 595 | | code | string | O código. | |
| 572 | | flattenLevel | integer | [Opcional] O nÃvel de achatamento. NÃvel mais alto significa mais achatamento. Padrão é 0. Máximo é 2. | | 596 | | flattenLevel | integer | [Opcional] O nÃvel de achatamento. NÃvel mais alto significa mais achatamento. Padrão é 0. Máximo é 2. | |
| 573 | | astName | string | [Opcional] O nome do AST. Padrão é "File". | | 597 | | astName | string | [Opcional] O nome do AST. Padrão é "File". | |
| 574 | | reserveComment | boolean | [Opcional] Se deve preservar os comentários originais. Padrão é false. | | 598 | | reserveComment | boolean | [Opcional] Se deve preservar os comentários originais. Padrão é false. | |
| 575 | 599 | ||
| 576 | **Retorna:** | 600 | **Retorna:** |
| 577 | 601 | ||
| 578 | | Tipo de Retorno | Descrição | | 602 | | Tipo de Retorno | Descrição | |
| 579 | | --- | --- | | 603 | | --------------- | ----------------------------------------------------------- | |
| 580 | | AST \| nil | O AST, ou nil se a conversão falhou. | | 604 | | AST \| nil | O AST, ou nil se a conversão falhou. | |
| 581 | | string \| nil | A mensagem de erro, ou nil se a conversão foi bem-sucedida. | | 605 | | string \| nil | A mensagem de erro, ou nil se a conversão foi bem-sucedida. | |
| 582 | 606 | ||
| 583 | ### format | 607 | ### format |
| 584 | 608 | ||
| @@ -589,25 +613,26 @@ to_ast: function(code: string, flattenLevel?: number, astName?: string, reserveC | |||
| 589 | Formata o código YueScript. | 613 | Formata o código YueScript. |
| 590 | 614 | ||
| 591 | **Assinatura:** | 615 | **Assinatura:** |
| 616 | |||
| 592 | ```lua | 617 | ```lua |
| 593 | format: function(code: string, tabSize?: number, reserveComment?: boolean): string | 618 | format: function(code: string, tabSize?: number, reserveComment?: boolean): string |
| 594 | ``` | 619 | ``` |
| 595 | 620 | ||
| 596 | **Parâmetros:** | 621 | **Parâmetros:** |
| 597 | 622 | ||
| 598 | | Parâmetro | Tipo | Descrição | | 623 | | Parâmetro | Tipo | Descrição | |
| 599 | | --- | --- | --- | | 624 | | -------------- | ------- | --------------------------------------------------------------------- | |
| 600 | | code | string | O código. | | 625 | | code | string | O código. | |
| 601 | | tabSize | integer | [Opcional] O tamanho da tabulação. Padrão é 4. | | 626 | | tabSize | integer | [Opcional] O tamanho da tabulação. Padrão é 4. | |
| 602 | | reserveComment | boolean | [Opcional] Se deve preservar os comentários originais. Padrão é true. | | 627 | | reserveComment | boolean | [Opcional] Se deve preservar os comentários originais. Padrão é true. | |
| 603 | 628 | ||
| 604 | **Retorna:** | 629 | **Retorna:** |
| 605 | 630 | ||
| 606 | | Tipo de Retorno | Descrição | | 631 | | Tipo de Retorno | Descrição | |
| 607 | | --- | --- | | 632 | | --------------- | ------------------- | |
| 608 | | string | O código formatado. | | 633 | | string | O código formatado. | |
| 609 | 634 | ||
| 610 | ### __call | 635 | ### \_\_call |
| 611 | 636 | ||
| 612 | **Tipo:** Metamétodo. | 637 | **Tipo:** Metamétodo. |
| 613 | 638 | ||
| @@ -617,21 +642,22 @@ Requer o módulo YueScript. | |||
| 617 | Reescreve o número da linha do erro para o número da linha original no código YueScript quando o carregamento falha. | 642 | Reescreve o número da linha do erro para o número da linha original no código YueScript quando o carregamento falha. |
| 618 | 643 | ||
| 619 | **Assinatura:** | 644 | **Assinatura:** |
| 645 | |||
| 620 | ```lua | 646 | ```lua |
| 621 | metamethod __call: function(self: yue, module: string): any... | 647 | metamethod __call: function(self: yue, module: string): any... |
| 622 | ``` | 648 | ``` |
| 623 | 649 | ||
| 624 | **Parâmetros:** | 650 | **Parâmetros:** |
| 625 | 651 | ||
| 626 | | Parâmetro | Tipo | Descrição | | 652 | | Parâmetro | Tipo | Descrição | |
| 627 | | --- | --- | --- | | 653 | | --------- | ------ | ----------------- | |
| 628 | | module | string | O nome do módulo. | | 654 | | module | string | O nome do módulo. | |
| 629 | 655 | ||
| 630 | **Retorna:** | 656 | **Retorna:** |
| 631 | 657 | ||
| 632 | | Tipo de Retorno | Descrição | | 658 | | Tipo de Retorno | Descrição | |
| 633 | | --- | --- | | 659 | | --------------- | ------------------ | |
| 634 | | any | O valor do módulo. | | 660 | | any | O valor do módulo. | |
| 635 | 661 | ||
| 636 | ## Config | 662 | ## Config |
| 637 | 663 | ||
| @@ -648,6 +674,7 @@ As opções de compilação do compilador. | |||
| 648 | Se o compilador deve coletar as variáveis globais que aparecem no código. | 674 | Se o compilador deve coletar as variáveis globais que aparecem no código. |
| 649 | 675 | ||
| 650 | **Assinatura:** | 676 | **Assinatura:** |
| 677 | |||
| 651 | ```lua | 678 | ```lua |
| 652 | lint_global: boolean | 679 | lint_global: boolean |
| 653 | ``` | 680 | ``` |
| @@ -661,6 +688,7 @@ lint_global: boolean | |||
| 661 | Se o compilador deve fazer retorno implÃcito para o bloco de código raiz. | 688 | Se o compilador deve fazer retorno implÃcito para o bloco de código raiz. |
| 662 | 689 | ||
| 663 | **Assinatura:** | 690 | **Assinatura:** |
| 691 | |||
| 664 | ```lua | 692 | ```lua |
| 665 | implicit_return_root: boolean | 693 | implicit_return_root: boolean |
| 666 | ``` | 694 | ``` |
| @@ -674,6 +702,7 @@ implicit_return_root: boolean | |||
| 674 | Se o compilador deve preservar o número da linha original no código compilado. | 702 | Se o compilador deve preservar o número da linha original no código compilado. |
| 675 | 703 | ||
| 676 | **Assinatura:** | 704 | **Assinatura:** |
| 705 | |||
| 677 | ```lua | 706 | ```lua |
| 678 | reserve_line_number: boolean | 707 | reserve_line_number: boolean |
| 679 | ``` | 708 | ``` |
| @@ -687,6 +716,7 @@ reserve_line_number: boolean | |||
| 687 | Se o compilador deve preservar os comentários originais no código compilado. | 716 | Se o compilador deve preservar os comentários originais no código compilado. |
| 688 | 717 | ||
| 689 | **Assinatura:** | 718 | **Assinatura:** |
| 719 | |||
| 690 | ```lua | 720 | ```lua |
| 691 | reserve_comment: boolean | 721 | reserve_comment: boolean |
| 692 | ``` | 722 | ``` |
| @@ -700,6 +730,7 @@ reserve_comment: boolean | |||
| 700 | Se o compilador deve usar o caractere de espaço em vez do caractere de tabulação no código compilado. | 730 | Se o compilador deve usar o caractere de espaço em vez do caractere de tabulação no código compilado. |
| 701 | 731 | ||
| 702 | **Assinatura:** | 732 | **Assinatura:** |
| 733 | |||
| 703 | ```lua | 734 | ```lua |
| 704 | space_over_tab: boolean | 735 | space_over_tab: boolean |
| 705 | ``` | 736 | ``` |
| @@ -713,6 +744,7 @@ space_over_tab: boolean | |||
| 713 | Se o compilador deve tratar o código a ser compilado como o mesmo módulo que está sendo compilado atualmente. Apenas para uso interno. | 744 | Se o compilador deve tratar o código a ser compilado como o mesmo módulo que está sendo compilado atualmente. Apenas para uso interno. |
| 714 | 745 | ||
| 715 | **Assinatura:** | 746 | **Assinatura:** |
| 747 | |||
| 716 | ```lua | 748 | ```lua |
| 717 | same_module: boolean | 749 | same_module: boolean |
| 718 | ``` | 750 | ``` |
| @@ -726,6 +758,7 @@ same_module: boolean | |||
| 726 | Se a mensagem de erro do compilador deve incluir o deslocamento do número da linha. Apenas para uso interno. | 758 | Se a mensagem de erro do compilador deve incluir o deslocamento do número da linha. Apenas para uso interno. |
| 727 | 759 | ||
| 728 | **Assinatura:** | 760 | **Assinatura:** |
| 761 | |||
| 729 | ```lua | 762 | ```lua |
| 730 | line_offset: integer | 763 | line_offset: integer |
| 731 | ``` | 764 | ``` |
| @@ -739,6 +772,7 @@ line_offset: integer | |||
| 739 | A enumeração da versão alvo do Lua. | 772 | A enumeração da versão alvo do Lua. |
| 740 | 773 | ||
| 741 | **Assinatura:** | 774 | **Assinatura:** |
| 775 | |||
| 742 | ```lua | 776 | ```lua |
| 743 | enum LuaTarget | 777 | enum LuaTarget |
| 744 | "5.1" | 778 | "5.1" |
| @@ -758,6 +792,7 @@ end | |||
| 758 | As opções extras a serem passadas para a função de compilação. | 792 | As opções extras a serem passadas para a função de compilação. |
| 759 | 793 | ||
| 760 | **Assinatura:** | 794 | **Assinatura:** |
| 795 | |||
| 761 | ```lua | 796 | ```lua |
| 762 | options: Options | 797 | options: Options |
| 763 | ``` | 798 | ``` |
| @@ -777,6 +812,7 @@ A definição das opções extras do compilador. | |||
| 777 | A versão alvo do Lua para a compilação. | 812 | A versão alvo do Lua para a compilação. |
| 778 | 813 | ||
| 779 | **Assinatura:** | 814 | **Assinatura:** |
| 815 | |||
| 780 | ```lua | 816 | ```lua |
| 781 | target: LuaTarget | 817 | target: LuaTarget |
| 782 | ``` | 818 | ``` |
| @@ -790,6 +826,7 @@ target: LuaTarget | |||
| 790 | O caminho de busca de módulo extra. | 826 | O caminho de busca de módulo extra. |
| 791 | 827 | ||
| 792 | **Assinatura:** | 828 | **Assinatura:** |
| 829 | |||
| 793 | ```lua | 830 | ```lua |
| 794 | path: string | 831 | path: string |
| 795 | ``` | 832 | ``` |
| @@ -803,6 +840,7 @@ path: string | |||
| 803 | Se deve incluir as variáveis locais na mensagem de erro do traceback. Padrão é false. | 840 | Se deve incluir as variáveis locais na mensagem de erro do traceback. Padrão é false. |
| 804 | 841 | ||
| 805 | **Assinatura:** | 842 | **Assinatura:** |
| 843 | |||
| 806 | ```lua | 844 | ```lua |
| 807 | dump_locals: boolean | 845 | dump_locals: boolean |
| 808 | ``` | 846 | ``` |
| @@ -816,6 +854,7 @@ dump_locals: boolean | |||
| 816 | Se deve simplificar a mensagem de erro. Padrão é true. | 854 | Se deve simplificar a mensagem de erro. Padrão é true. |
| 817 | 855 | ||
| 818 | **Assinatura:** | 856 | **Assinatura:** |
| 857 | |||
| 819 | ```lua | 858 | ```lua |
| 820 | simplified: boolean | 859 | simplified: boolean |
| 821 | ``` | 860 | ``` |
diff --git a/doc/docs/pt-br/index.md b/doc/docs/pt-br/index.md index 818bb58..e62095f 100644 --- a/doc/docs/pt-br/index.md +++ b/doc/docs/pt-br/index.md | |||
| @@ -21,4 +21,5 @@ footer: | |||
| 21 | message: Licença MIT. | 21 | message: Licença MIT. |
| 22 | copyright: Copyright © 2017-2026 Li Jin. Todos os direitos reservados. | 22 | copyright: Copyright © 2017-2026 Li Jin. Todos os direitos reservados. |
| 23 | --- | 23 | --- |
| 24 | |||
| 24 | --- | 25 | --- |
diff --git a/doc/docs/pt-br/try/index.md b/doc/docs/pt-br/try/index.md index 624b3bf..918162d 100755 --- a/doc/docs/pt-br/try/index.md +++ b/doc/docs/pt-br/try/index.md | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | # Compilador online do YueScript | 1 | # Compilador online do YueScript |
| 2 | |||
| 2 | --- | 3 | --- |
| 3 | 4 | ||
| 4 | Experimente YueScript no navegador com WASM. | 5 | Experimente YueScript no navegador com WASM. |
