jievro-parser 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/Gemfile.lock +3 -1
- data/Rakefile +1 -1
- data/jievro-parser.gemspec +1 -0
- data/lib/jievro/parser/grammar/declaration/constant_declaration.treetop +1 -1
- data/lib/jievro/parser/grammar/declaration/function_declaration.treetop +2 -1
- data/lib/jievro/parser/grammar/declaration/variable_declaration.treetop +1 -1
- data/lib/jievro/parser/grammar/expression/closure_expression.treetop +3 -1
- data/lib/jievro/parser/grammar/expression/function_call_expression.treetop +1 -1
- data/lib/jievro/parser/grammar/expression/parenthesized_expression.treetop +1 -1
- data/lib/jievro/parser/grammar/expression/prefix_expression.treetop +1 -1
- data/lib/jievro/parser/grammar/expression/range_expression.treetop +1 -1
- data/lib/jievro/parser/grammar/expression/self_expression.treetop +1 -1
- data/lib/jievro/parser/grammar/expression/super_expression.treetop +1 -1
- data/lib/jievro/parser/grammar/grammar.treetop +1 -1
- data/lib/jievro/parser/grammar/identifier.treetop +2 -2
- data/lib/jievro/parser/grammar/implicit_parameter_name.treetop +1 -1
- data/lib/jievro/parser/grammar/literal/literal_array.treetop +1 -1
- data/lib/jievro/parser/grammar/literal/literal_boolean.treetop +2 -2
- data/lib/jievro/parser/grammar/literal/literal_decimal_floating_point.treetop +1 -1
- data/lib/jievro/parser/grammar/literal/literal_dictionary.treetop +3 -2
- data/lib/jievro/parser/grammar/literal/literal_hexadecimal_floating_point.treetop +1 -1
- data/lib/jievro/parser/grammar/literal/literal_integer_binary.treetop +1 -1
- data/lib/jievro/parser/grammar/literal/literal_integer_decimal.treetop +1 -1
- data/lib/jievro/parser/grammar/literal/literal_integer_hexadecimal.treetop +1 -1
- data/lib/jievro/parser/grammar/literal/literal_integer_octal.treetop +1 -1
- data/lib/jievro/parser/grammar/literal/literal_nil.treetop +1 -1
- data/lib/jievro/parser/grammar/literal/literal_string.treetop +3 -3
- data/lib/jievro/parser/grammar/statement/branch/if.treetop +1 -1
- data/lib/jievro/parser/grammar/statement/loop/do_while.treetop +1 -1
- data/lib/jievro/parser/grammar/statement/loop/for.treetop +1 -1
- data/lib/jievro/parser/grammar/statement/loop/for_in.treetop +1 -1
- data/lib/jievro/parser/grammar/statement/loop/while.treetop +1 -1
- data/lib/jievro/parser/grammar/type/type_array.treetop +1 -1
- data/lib/jievro/parser/grammar/type/type_dictionary.treetop +1 -1
- data/lib/jievro/parser/grammar/wildcard.treetop +1 -1
- data/lib/jievro/parser/parse_result.rb +3 -9
- data/lib/jievro/parser/string_parser.rb +3 -2
- data/lib/jievro/parser/tools/shunting_yard.rb +1 -1
- data/lib/jievro/parser/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d56703e726b140d5f670a4612faebbfbf231ec1f
|
4
|
+
data.tar.gz: 83a92536b8ee7c04845ba217a70f464258328da6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13370ace3ab61ee7218449f6a74e1529cda2b89a00b0c1374f4c23c215a53c4062d4c42fbed6f9006a52d9e6b24f110aca5381dba9ae45f3cd483cbdbcf143b8
|
7
|
+
data.tar.gz: b990775579e54f24dac0144200f23d92b682ec0778e819a65463d8456eb88008a7644c30c51f41d13e24884e713995b8653142d44317f0177fc85499408f0f0e
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jievro-parser (0.
|
4
|
+
jievro-parser (0.8.0)
|
5
|
+
jievro-ast (~> 0.5)
|
5
6
|
treetop (~> 1.6)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
11
|
diff-lcs (1.2.5)
|
12
|
+
jievro-ast (0.5.0)
|
11
13
|
polyglot (0.3.5)
|
12
14
|
rake (10.4.2)
|
13
15
|
rspec (3.2.0)
|
data/Rakefile
CHANGED
data/jievro-parser.gemspec
CHANGED
@@ -40,7 +40,7 @@ module Kauri
|
|
40
40
|
|
41
41
|
[
|
42
42
|
{
|
43
|
-
|
43
|
+
__type: 'function-declaration',
|
44
44
|
name: name,
|
45
45
|
parameters: parameters,
|
46
46
|
return_type: return_type,
|
@@ -253,6 +253,7 @@ module Kauri
|
|
253
253
|
end
|
254
254
|
|
255
255
|
{
|
256
|
+
__type: 'function-declaration-parameter',
|
256
257
|
type: type,
|
257
258
|
local: local,
|
258
259
|
external: external,
|
@@ -40,7 +40,7 @@ module Kauri
|
|
40
40
|
def ast
|
41
41
|
|
42
42
|
ast = {
|
43
|
-
|
43
|
+
__type: 'closure-expression',
|
44
44
|
body: statement_list.ast
|
45
45
|
}
|
46
46
|
|
@@ -111,7 +111,9 @@ module Kauri
|
|
111
111
|
|
112
112
|
def ast
|
113
113
|
{
|
114
|
+
__type: 'closure-expression-signature',
|
114
115
|
capture: {
|
116
|
+
__type: 'closure-expression-capture-specifier',
|
115
117
|
specifier: capture_specifier.ast,
|
116
118
|
expression: expression.ast.first
|
117
119
|
}
|
@@ -23,7 +23,7 @@ module Kauri
|
|
23
23
|
def ast
|
24
24
|
[
|
25
25
|
{
|
26
|
-
|
26
|
+
__type: 'identifier',
|
27
27
|
value: text_value
|
28
28
|
}
|
29
29
|
]
|
@@ -45,7 +45,7 @@ module Kauri
|
|
45
45
|
def ast
|
46
46
|
[
|
47
47
|
{
|
48
|
-
|
48
|
+
__type: 'identifier',
|
49
49
|
value: regular_identifier.text_value
|
50
50
|
}
|
51
51
|
]
|
@@ -18,7 +18,7 @@ module Kauri
|
|
18
18
|
def ast
|
19
19
|
[
|
20
20
|
{
|
21
|
-
|
21
|
+
__type: 'literal-boolean',
|
22
22
|
value: true
|
23
23
|
}
|
24
24
|
]
|
@@ -39,7 +39,7 @@ module Kauri
|
|
39
39
|
def ast
|
40
40
|
[
|
41
41
|
{
|
42
|
-
|
42
|
+
__type: 'literal-boolean',
|
43
43
|
value: false
|
44
44
|
}
|
45
45
|
]
|
@@ -57,7 +57,7 @@ module Kauri
|
|
57
57
|
ast = items.ast
|
58
58
|
else
|
59
59
|
ast = [{
|
60
|
-
|
60
|
+
__type: 'literal-dictionary',
|
61
61
|
pairs: []
|
62
62
|
}]
|
63
63
|
end
|
@@ -95,6 +95,7 @@ module Kauri
|
|
95
95
|
def ast
|
96
96
|
[
|
97
97
|
{
|
98
|
+
__type: 'literal-dictionary-pair',
|
98
99
|
key: key.ast.first,
|
99
100
|
value: value.ast.first
|
100
101
|
}
|
@@ -146,7 +147,7 @@ module Kauri
|
|
146
147
|
|
147
148
|
[
|
148
149
|
{
|
149
|
-
|
150
|
+
__type: 'literal-dictionary',
|
150
151
|
pairs: pairs
|
151
152
|
}
|
152
153
|
]
|
@@ -29,7 +29,7 @@ module Kauri
|
|
29
29
|
if quoted_text.text_value.empty?
|
30
30
|
ast = [
|
31
31
|
{
|
32
|
-
|
32
|
+
__type: 'literal-string',
|
33
33
|
value: ''
|
34
34
|
}
|
35
35
|
]
|
@@ -75,7 +75,7 @@ module Kauri
|
|
75
75
|
ast[-1][:value] += value
|
76
76
|
else
|
77
77
|
ast.push({
|
78
|
-
|
78
|
+
__type: 'literal-string',
|
79
79
|
value: value
|
80
80
|
})
|
81
81
|
end
|
@@ -86,7 +86,7 @@ module Kauri
|
|
86
86
|
if is_interpolated_string
|
87
87
|
ast = [
|
88
88
|
{
|
89
|
-
|
89
|
+
__type: 'interpolated-string',
|
90
90
|
value: ast
|
91
91
|
}
|
92
92
|
]
|
@@ -1,18 +1,12 @@
|
|
1
1
|
module Jievro
|
2
2
|
module Parser
|
3
|
-
|
3
|
+
class ParseResult
|
4
|
+
attr_reader :tokens, :ast
|
5
|
+
|
4
6
|
def initialize(tokens, ast)
|
5
7
|
@tokens = tokens
|
6
8
|
@ast = ast
|
7
9
|
end
|
8
|
-
|
9
|
-
def tokens
|
10
|
-
@tokens
|
11
|
-
end
|
12
|
-
|
13
|
-
def ast
|
14
|
-
@ast
|
15
|
-
end
|
16
10
|
end
|
17
11
|
end
|
18
12
|
end
|
@@ -2,6 +2,7 @@ require 'treetop'
|
|
2
2
|
require 'polyglot'
|
3
3
|
require 'jievro/parser/grammar/grammar'
|
4
4
|
require 'jievro/parser/parse_result'
|
5
|
+
require 'jievro/ast/node'
|
5
6
|
|
6
7
|
module Jievro
|
7
8
|
module Parser
|
@@ -12,7 +13,7 @@ module Jievro
|
|
12
13
|
|
13
14
|
tokens = []
|
14
15
|
ast = {
|
15
|
-
|
16
|
+
__type: 'program',
|
16
17
|
body: []
|
17
18
|
}
|
18
19
|
|
@@ -28,7 +29,7 @@ module Jievro
|
|
28
29
|
ast = parsed.ast
|
29
30
|
end
|
30
31
|
|
31
|
-
Jievro::Parser::ParseResult.new(tokens, ast)
|
32
|
+
Jievro::Parser::ParseResult.new(tokens, Jievro::Ast::Node.new(ast))
|
32
33
|
end
|
33
34
|
end
|
34
35
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jievro-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Azzalini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jievro-ast
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.5'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: treetop
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|