goodguide-gibbon 0.2.0 → 0.2.1
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.
- data/lib/goodguide/gibbon.rb +26 -21
- data/lib/goodguide/gibbon/version.rb +1 -1
- metadata +2 -2
data/lib/goodguide/gibbon.rb
CHANGED
@@ -25,23 +25,32 @@ module GoodGuide
|
|
25
25
|
class RuntimeError < StandardError; end
|
26
26
|
|
27
27
|
class Program
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
def self.parse(context, global, source)
|
29
|
+
syntax = context.parse(source)
|
30
|
+
semantics, errors = context.analyze(syntax, global)
|
31
|
+
raise SemanticError.new(errors) if errors
|
32
|
+
|
33
|
+
Program.new(context,
|
34
|
+
:global => global,
|
35
|
+
:syntax => syntax,
|
36
|
+
:semantics => semantics,
|
37
|
+
)
|
33
38
|
end
|
34
39
|
|
35
|
-
|
36
|
-
|
40
|
+
attr_reader :syntax, :semantics
|
41
|
+
def initialize(context, info={})
|
42
|
+
@context = context
|
43
|
+
@global = info[:global]
|
44
|
+
@syntax = info[:syntax]
|
45
|
+
@semantics = info[:semantics]
|
37
46
|
end
|
38
47
|
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
semantics
|
44
|
-
|
48
|
+
def as_json
|
49
|
+
{
|
50
|
+
global: @global,
|
51
|
+
syntax: @syntax,
|
52
|
+
semantics: @semantics,
|
53
|
+
}
|
45
54
|
end
|
46
55
|
|
47
56
|
def call(entity_id)
|
@@ -55,16 +64,12 @@ module GoodGuide
|
|
55
64
|
end
|
56
65
|
|
57
66
|
class Client
|
58
|
-
def self.
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
def parse(global, source)
|
63
|
-
Program.new(global, context, source)
|
67
|
+
def self.make_context
|
68
|
+
new.make_context
|
64
69
|
end
|
65
70
|
|
66
|
-
def
|
67
|
-
|
71
|
+
def make_context
|
72
|
+
Context.new(self)
|
68
73
|
end
|
69
74
|
|
70
75
|
def lookup_type(id, name)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goodguide-gibbon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
type: :runtime
|