finitio 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/finitio/syntax.rb +3 -3
- data/lib/finitio/syntax/type/sub_type.rb +10 -3
- data/lib/finitio/syntax/type/union_type.rb +3 -2
- data/lib/finitio/syntax/types.citrus +4 -6
- data/lib/finitio/type/hash_based_type.rb +1 -1
- data/lib/finitio/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46d8b55dce1f11c02ca0a953a8688fe6f6e66851
|
4
|
+
data.tar.gz: 9278c34a8fc3e05e89b05a9925539dabfbbc1ca5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfc507bf5246aa52b6d54743ff88aad279e2aa0c8bcef499740484e13c977ebfdc751e3d0a3ca2d1daa48fc50fe565b9e98e74b6ee28edea4b5892f2091d4f14
|
7
|
+
data.tar.gz: ac994264f34c3c161c7a1a962ce57c28be8fc18235737cd9000ba26ff3b661fcca6fe16ec0e9e382cfb228093b010f9637c25ecf886f9ac88705d3941140693f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 0.5.1 / 2017-01-08
|
2
|
+
|
3
|
+
* Disable memoization in parser because it leads to terrible performance
|
4
|
+
issues on some schemas.
|
5
|
+
* Avoid alternatives on high-level rules (Union, SubType) to prevent many
|
6
|
+
fallbacks that kill performance without memoization enabled.
|
7
|
+
|
1
8
|
# 0.5.1 / 2015-09-22
|
2
9
|
|
3
10
|
* Enabled memoization in parser to avoid very long parsing time on complex
|
data/lib/finitio/syntax.rb
CHANGED
@@ -17,18 +17,18 @@ module Finitio
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.ast(source)
|
20
|
-
parse(source, root: "system"
|
20
|
+
parse(source, root: "system").to_ast
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.compile(source, cpl = nil)
|
24
24
|
cpl = Compilation.coerce(cpl)
|
25
|
-
parse(source, root: "system"
|
25
|
+
parse(source, root: "system").compile(cpl)
|
26
26
|
cpl.resolve_proxies!.system
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.compile_type(source, cpl = nil)
|
30
30
|
cpl = Compilation.coerce(cpl)
|
31
|
-
parse(source, root: "type"
|
31
|
+
parse(source, root: "type").compile(cpl)
|
32
32
|
end
|
33
33
|
|
34
34
|
end # module Syntax
|
@@ -7,12 +7,19 @@ module Finitio
|
|
7
7
|
|
8
8
|
def compile(factory)
|
9
9
|
s = rel_type.compile(factory)
|
10
|
-
c = constraint_def
|
11
|
-
|
10
|
+
if c = constraint_def
|
11
|
+
factory.subtype(s, c.compile(factory))
|
12
|
+
else
|
13
|
+
s
|
14
|
+
end
|
12
15
|
end
|
13
16
|
|
14
17
|
def to_ast
|
15
|
-
|
18
|
+
if c = constraint_def
|
19
|
+
[:sub_type, rel_type.to_ast] + constraint_def.to_ast
|
20
|
+
else
|
21
|
+
rel_type.to_ast
|
22
|
+
end
|
16
23
|
end
|
17
24
|
|
18
25
|
end # module SubType
|
@@ -5,11 +5,12 @@ module Finitio
|
|
5
5
|
|
6
6
|
def compile(factory)
|
7
7
|
cds = captures[:sub_type].map{|x| x.compile(factory) }
|
8
|
-
factory.union(cds)
|
8
|
+
cds.size == 1 ? cds.first : factory.union(cds)
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_ast
|
12
|
-
captures[:sub_type].map(&:to_ast)
|
12
|
+
cds = captures[:sub_type].map(&:to_ast)
|
13
|
+
cds.size == 1 ? cds.first : cds.unshift(:union_type)
|
13
14
|
end
|
14
15
|
|
15
16
|
end # module UnionType
|
@@ -22,15 +22,13 @@ grammar Finitio::Syntax::Types
|
|
22
22
|
# union and sub types
|
23
23
|
|
24
24
|
rule union_type
|
25
|
-
|
26
|
-
|
27
|
-
| sub_type
|
25
|
+
(sub_type (pipe sub_type)*)
|
26
|
+
<Finitio::Syntax::UnionType>
|
28
27
|
end
|
29
28
|
|
30
29
|
rule sub_type
|
31
|
-
|
32
|
-
|
33
|
-
| rel_type
|
30
|
+
(rel_type constraint_def?)
|
31
|
+
<Finitio::Syntax::SubType>
|
34
32
|
end
|
35
33
|
|
36
34
|
rule constraint_def
|
data/lib/finitio/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finitio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: citrus
|