tuga 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4166c22839eeaca0798af2aec537756558066bb3
4
- data.tar.gz: ddf07cc668f9d34d126f0e3f1e42771f275b9ab3
3
+ metadata.gz: dfa38fdd505799cb2b39b779c384d49d786e696c
4
+ data.tar.gz: 1f887068baea0e6a71f57ce724b690054617c334
5
5
  SHA512:
6
- metadata.gz: 7a00b7d2cd44d93fcea10749e71951951bcef859be6580385777cc2daa20cf4f2fcf4b86cc289a1374bc0ad5b930c94f194d812d5900f95aab72167f40a6bc0b
7
- data.tar.gz: 7aa81d25b972c63827c8bdd65739b03b9f5460756909a78d65840f40b9f82a7181708604bf47ff6ab9ee38550352255d88854fb99d42567d59d99e0537bd4958
6
+ metadata.gz: 3d2fecbc26a1c9543fd3f65dd635b9f5b0e359f09bfc8d3975860eb914285303e01fd7e98b5d8739209b70c37c2d883251b13757b81581eb2e29c452ef4573bd
7
+ data.tar.gz: 87fb7670ed60613b5b957c28e5e0b0a085a99677919eb35913b3c5173deeb7d7a2250995fb9f6ae877bcc6a2f51c921fb5dc0b6c4091ceddff87c5c9615a94d5
@@ -3,3 +3,23 @@ All notable changes to this project will be documented in this file.
3
3
 
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.2.0] - 2020-06-07
8
+ ### Added
9
+ - Added the keywords `senao`, `entao`, `inicio`, `varias_opcoes`, `senao_se`, `modulo`, `ate_que` and `nao`. These
10
+ keywords contain only ASCII characters which makes them much easier to type and parse.
11
+
12
+ ### Changed
13
+ - Improved the usage documentation
14
+
15
+ ### Fixed
16
+ - Fixed a security vulnerability in Rake [(CVE-2020-8130)](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8130)
17
+ by updating it from `~ 10.0` to `~ 12.3`.
18
+
19
+ ## [0.1.0] - 2020-06-06
20
+ ### Added
21
+ - Initial core functionality
22
+ - Codebase maintenance tools
23
+
24
+ [0.2.0]: https://github.com/wilsonsilva/tuga/compare/v0.1.0...v0.2.0
25
+ [0.1.0]: https://github.com/wilsonsilva/tuga/compare/ba17557...v0.1.0
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/tuga.svg)](https://badge.fury.io/rb/tuga)
4
4
  [![Build Status](https://travis-ci.org/wilsonsilva/tuga.svg?branch=master)](https://travis-ci.org/wilsonsilva/tuga)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/7afec90a09db3956b7dc/maintainability)](https://codeclimate.com/github/wilsonsilva/tuga/maintainability)
6
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/7afec90a09db3956b7dc/test_coverage)](https://codeclimate.com/github/wilsonsilva/tuga/test_coverage)
5
7
  [![Security](https://hakiri.io/github/wilsonsilva/tuga/master.svg)](https://hakiri.io/github/wilsonsilva/tuga/master)
6
8
  [![Inline docs](http://inch-ci.org/github/wilsonsilva/tuga.svg?branch=master)](http://inch-ci.org/github/wilsonsilva/tuga)
7
9
 
@@ -29,10 +31,31 @@ Or install it yourself as:
29
31
 
30
32
  ## Usage
31
33
 
34
+ ### In the command line
35
+ Run the `tuga` command followed by a filename.
36
+
32
37
  ```
33
38
  tuga soure_code.pt
34
39
  ```
35
40
 
41
+ ### In an application
42
+ Require the `Tuga` transpiler and give it Tuga source code.
43
+
44
+ ```ruby
45
+ require 'tuga/transpiler'
46
+
47
+ source_code = <<~BACALHAU
48
+ lista_de_frutas = ['maçã', 'manga', 'goiaba', 'uva']
49
+
50
+ por_cada fruta na lista_de_frutas fazer
51
+ escrever fruta.com_letra_maiuscula
52
+ fim
53
+ BACALHAU
54
+
55
+ transpiler = Tuga::Transpiler.new
56
+ transpiler.to_ruby(source_code)
57
+ ```
58
+
36
59
  ## Development
37
60
 
38
61
  After checking out the repo, run `bin/setup` to install dependencies, configure git hooks and create support files.
@@ -2,10 +2,21 @@
2
2
 
3
3
  # Portuguese translations
4
4
  class Array
5
+ # Reverte os elementos da lista
5
6
  alias inverter reverse
7
+
8
+ # Retorna o ultimo elemento da lista
6
9
  alias ultimo last
10
+
11
+ # Retorna o primeiro elemento da lista
7
12
  alias primeiro first
13
+
14
+ # Itera sobre cada elemento da lista
8
15
  alias cada each
16
+
17
+ # Itera sobre cada elemento da lista com um indice
9
18
  alias cada_com_indice each_with_index
19
+
20
+ # Retorna o numero de elementos da lista
10
21
  alias comprimento length
11
22
  end
@@ -23,24 +23,31 @@ module RubyParserStuff
23
23
  ['alias', %i[kALIAS kALIAS], :expr_fname],
24
24
  ['garantir', %i[kENSURE kENSURE], :expr_beg],
25
25
  ['senão', %i[kELSE kELSE], :expr_beg],
26
+ ['senao', %i[kELSE kELSE], :expr_beg],
26
27
  ['então', %i[kTHEN kTHEN], :expr_beg],
28
+ ['entao', %i[kTHEN kTHEN], :expr_beg],
27
29
  ['fazer', %i[kDO kDO], :expr_beg],
28
- ['início', %i[kBEGIN kBEGIN], :expr_beg]
30
+ ['início', %i[kBEGIN kBEGIN], :expr_beg],
31
+ ['inicio', %i[kBEGIN kBEGIN], :expr_beg]
29
32
  ]
30
33
 
31
34
  expression_keywords = [
32
35
  ['e', %i[kAND kAND], :expr_beg],
33
36
  ['várias_opções', %i[kCASE kCASE], :expr_beg],
37
+ ['varias_opcoes', %i[kCASE kCASE], :expr_beg],
34
38
  ['senão_se', %i[kELSIF kELSIF], :expr_beg],
39
+ ['senao_se', %i[kELSIF kELSIF], :expr_beg],
35
40
  ['por_cada', %i[kFOR kFOR], :expr_beg],
36
41
  ['se', %i[kIF kIF_MOD], :expr_beg],
37
42
  ['na', %i[kIN kIN], :expr_beg],
38
43
  ['em', %i[kIN kIN], :expr_beg],
39
44
  ['módulo', %i[kMODULE kMODULE], :expr_beg],
45
+ ['modulo', %i[kMODULE kMODULE], :expr_beg],
40
46
  ['grupo', %i[kMODULE kMODULE], :expr_beg],
41
47
  ['ou', %i[kOR kOR], :expr_beg],
42
48
  ['excepto_se', %i[kUNLESS kUNLESS_MOD], :expr_beg],
43
49
  ['até_que', %i[kUNTIL kUNTIL_MOD], :expr_beg],
50
+ ['ate_que', %i[kUNTIL kUNTIL_MOD], :expr_beg],
44
51
  ['quando', %i[kWHEN kWHEN], :expr_beg],
45
52
  ['enquanto', %i[kWHILE kWHILE_MOD], :expr_beg]
46
53
  ]
@@ -55,7 +62,8 @@ module RubyParserStuff
55
62
  ]
56
63
 
57
64
  argument_keywords = [
58
- ['não', %i[kNOT kNOT], :expr_beg]
65
+ ['não', %i[kNOT kNOT], :expr_beg],
66
+ ['nao', %i[kNOT kNOT], :expr_beg]
59
67
  ]
60
68
 
61
69
  original_verbosity = $VERBOSE
@@ -1,3 +1,3 @@
1
1
  module Tuga
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency 'guard-rubocop', '~> 1.3'
40
40
  spec.add_development_dependency 'overcommit', '~> 0.53'
41
41
  spec.add_development_dependency 'pry', '~> 0.13'
42
- spec.add_development_dependency 'rake', '~> 10.0'
42
+ spec.add_development_dependency 'rake', '~> 12.3'
43
43
  spec.add_development_dependency 'rspec', '~> 3.0'
44
44
  spec.add_development_dependency 'rubocop', '~> 0.85'
45
45
  spec.add_development_dependency 'rubocop-rspec', '~> 1.39'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tuga
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wilson Silva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-06 00:00:00.000000000 Z
11
+ date: 2020-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby2ruby
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '10.0'
173
+ version: '12.3'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '10.0'
180
+ version: '12.3'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rspec
183
183
  requirement: !ruby/object:Gem::Requirement