jievro-parser 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -4
- data/Gemfile.lock +14 -8
- data/README.md +5 -1
- data/lib/parser/parser.rb +18 -17
- data/lib/parser/version.rb +1 -1
- data/parser.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b82db236ed40ea039b1c0bd30f0ac134ae2465ba
|
4
|
+
data.tar.gz: f1f43a531b64ffdddcb356d0b44f469da7c8801b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07a6a4cd021b6f64ebf6122a1456615ced2b76bf016aa3f5516a2f33713df8bc34cd01659f0ec9deb16b4b6b27e2e552a46f6b1070a947bdbc8709e4ec2a69dd
|
7
|
+
data.tar.gz: 0f50db01513965bf9df975a06a7dac9d4b373007ae8bc8f6bb279b539efa535b583701ccc72040f94fe141359475634bbafb8f0ac90224e9eda8b2e7811fb7ee
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,30 +1,36 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
jievro-parser (0.5.0)
|
5
|
+
treetop (~> 1.6)
|
6
|
+
|
1
7
|
GEM
|
2
8
|
remote: https://rubygems.org/
|
3
9
|
specs:
|
4
10
|
diff-lcs (1.2.5)
|
5
11
|
polyglot (0.3.5)
|
6
|
-
rake (10.
|
12
|
+
rake (10.4.2)
|
7
13
|
rspec (3.2.0)
|
8
14
|
rspec-core (~> 3.2.0)
|
9
15
|
rspec-expectations (~> 3.2.0)
|
10
16
|
rspec-mocks (~> 3.2.0)
|
11
|
-
rspec-core (3.2.
|
17
|
+
rspec-core (3.2.3)
|
12
18
|
rspec-support (~> 3.2.0)
|
13
|
-
rspec-expectations (3.2.
|
19
|
+
rspec-expectations (3.2.1)
|
14
20
|
diff-lcs (>= 1.2.0, < 2.0)
|
15
21
|
rspec-support (~> 3.2.0)
|
16
22
|
rspec-mocks (3.2.1)
|
17
23
|
diff-lcs (>= 1.2.0, < 2.0)
|
18
24
|
rspec-support (~> 3.2.0)
|
19
25
|
rspec-support (3.2.2)
|
20
|
-
treetop (1.
|
26
|
+
treetop (1.6.2)
|
21
27
|
polyglot (~> 0.3)
|
22
28
|
|
23
29
|
PLATFORMS
|
24
30
|
ruby
|
25
31
|
|
26
32
|
DEPENDENCIES
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
33
|
+
bundler (~> 1.9)
|
34
|
+
jievro-parser!
|
35
|
+
rake (~> 10.0)
|
36
|
+
rspec (~> 3.2)
|
data/README.md
CHANGED
@@ -1 +1,5 @@
|
|
1
|
-
#
|
1
|
+
#parser
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/jievro/parser.svg?branch=develop)](https://travis-ci.org/jievro/parser)
|
4
|
+
[![GitHub Version](https://badge.fury.io/gh/jievro%2Fparser.svg)](http://badge.fury.io/gh/jievro%2Fparser)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/jievro-parser.svg)](http://badge.fury.io/rb/jievro-parser)
|
data/lib/parser/parser.rb
CHANGED
@@ -4,31 +4,32 @@ require 'parser/grammar/grammar'
|
|
4
4
|
require 'parser/parse_result'
|
5
5
|
|
6
6
|
module Jievro
|
7
|
-
|
7
|
+
module Parser
|
8
|
+
class Parser
|
9
|
+
def parse(source)
|
8
10
|
|
9
|
-
|
11
|
+
parser = Jievro::SwiftParser.new
|
10
12
|
|
11
|
-
|
13
|
+
tokens = []
|
14
|
+
ast = {
|
15
|
+
block_type: 'program',
|
16
|
+
body: []
|
17
|
+
}
|
12
18
|
|
13
|
-
|
14
|
-
ast = {
|
15
|
-
block_type: 'program',
|
16
|
-
body: []
|
17
|
-
}
|
19
|
+
unless source.empty?
|
18
20
|
|
19
|
-
|
21
|
+
parsed = parser.parse(source)
|
20
22
|
|
21
|
-
|
23
|
+
if parsed.nil?
|
24
|
+
raise Exception, parser.failure_reason
|
25
|
+
end
|
22
26
|
|
23
|
-
|
24
|
-
|
27
|
+
tokens = parsed.tokens
|
28
|
+
ast = parsed.ast
|
25
29
|
end
|
26
30
|
|
27
|
-
tokens
|
28
|
-
ast = parsed.ast
|
31
|
+
Jievro::ParseResult.new(tokens, ast)
|
29
32
|
end
|
30
|
-
|
31
|
-
Jievro::ParseResult.new(tokens, ast)
|
32
33
|
end
|
33
34
|
end
|
34
|
-
end
|
35
|
+
end
|
data/lib/parser/version.rb
CHANGED
data/parser.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jievro-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Azzalini
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.2'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.2'
|
55
69
|
description:
|
56
70
|
email: hi@jievro.io
|
57
71
|
executables: []
|