tuga 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/tuga/transpiler.rb +17 -3
- data/lib/tuga/version.rb +1 -1
- data/tuga.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28751c61ea79e144aaea9b7b00f0c8a7f96304e3
|
4
|
+
data.tar.gz: 5d0b096140744946c5b688755cf611cca6cfadd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fed9575dd657d225d73dd29804d4c0270439110d0529743c0adffb0a884fcd94844a95b0743ccb08c1040e83a25d575d28c3f246f4c95131b12000e2f1818042
|
7
|
+
data.tar.gz: 367dbd10929da6a1b997ba9ef090f8d829671cc1136ecf1456252977e1b791c903f3d36ef02f1c56e6b18f76e50456936202768f804381d6421a07d64697fc72
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
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
6
|
|
7
|
+
## [0.3.0] - 2020-07-05
|
8
|
+
### Added
|
9
|
+
- Added an ability to transpile Tuga code without requiring the core extensions to the standard library
|
10
|
+
|
7
11
|
## [0.2.0] - 2020-06-07
|
8
12
|
### Added
|
9
13
|
- Added the keywords `senao`, `entao`, `inicio`, `varias_opcoes`, `senao_se`, `modulo`, `ate_que` and `nao`. These
|
@@ -21,5 +25,6 @@ by updating it from `~ 10.0` to `~ 12.3`.
|
|
21
25
|
- Initial core functionality
|
22
26
|
- Codebase maintenance tools
|
23
27
|
|
28
|
+
[0.3.0]: https://github.com/wilsonsilva/tuga/compare/v0.2.0...v0.3.0
|
24
29
|
[0.2.0]: https://github.com/wilsonsilva/tuga/compare/v0.1.0...v0.2.0
|
25
30
|
[0.1.0]: https://github.com/wilsonsilva/tuga/compare/ba17557...v0.1.0
|
data/lib/tuga/transpiler.rb
CHANGED
@@ -7,18 +7,32 @@ require 'tuga/ruby_parser_patches'
|
|
7
7
|
module Tuga
|
8
8
|
# Transpiles Tuga code to Ruby
|
9
9
|
class Transpiler
|
10
|
-
|
10
|
+
# The encoding used to allow Portuguese characters
|
11
|
+
ENCODING = "# encoding: utf-8\n"
|
12
|
+
|
13
|
+
# Aliases common methods from the standard library
|
14
|
+
CORE_EXTENSIONS = "require \"tuga/core_ext\"\n"
|
15
|
+
|
16
|
+
# Every transpilled program will be encoded
|
17
|
+
INITIAL_CODE = "#{ENCODING}#{CORE_EXTENSIONS}"
|
11
18
|
|
12
19
|
def initialize
|
13
20
|
@ruby_2_ruby = Ruby2Ruby.new
|
14
21
|
@ruby_parser = RubyParser.new
|
15
22
|
end
|
16
23
|
|
17
|
-
|
24
|
+
# Converts Tuga code to Ruby
|
25
|
+
#
|
26
|
+
# @param [String] tuga_code The Tuga code to be converted
|
27
|
+
# @param [Boolean] require_core_ext Whether Tuga's core extensions should be loaded or not
|
28
|
+
#
|
29
|
+
# @return [String]
|
30
|
+
#
|
31
|
+
def to_ruby(tuga_code, require_core_ext: true)
|
18
32
|
sexp = ruby_parser.process("# encoding: utf-8\n#{tuga_code}")
|
19
33
|
ruby_code = ruby_2_ruby.process(sexp)
|
20
34
|
|
21
|
-
"#{INITIAL_CODE}#{ruby_code}"
|
35
|
+
require_core_ext ? "#{INITIAL_CODE}#{ruby_code}" : "#{ENCODING}#{ruby_code}"
|
22
36
|
end
|
23
37
|
|
24
38
|
private
|
data/lib/tuga/version.rb
CHANGED
data/tuga.gemspec
CHANGED
@@ -43,7 +43,7 @@ Gem::Specification.new do |spec|
|
|
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'
|
46
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
46
|
+
spec.add_development_dependency 'simplecov', '~> 0.17.1'
|
47
47
|
spec.add_development_dependency 'simplecov-console', '~> 0.7'
|
48
48
|
spec.add_development_dependency 'yard', '~> 0.9'
|
49
49
|
spec.add_development_dependency 'yard-junk', '~> 0.0.7'
|
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.
|
4
|
+
version: 0.3.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-
|
11
|
+
date: 2020-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby2ruby
|
@@ -226,14 +226,14 @@ dependencies:
|
|
226
226
|
requirements:
|
227
227
|
- - "~>"
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version:
|
229
|
+
version: 0.17.1
|
230
230
|
type: :development
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
234
|
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
236
|
+
version: 0.17.1
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
238
|
name: simplecov-console
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|