liquidscript 0.4.1 → 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/lib/liquidscript/buffer.rb +2 -2
- data/lib/liquidscript/compiler/icr.rb +1 -0
- data/lib/liquidscript/compiler/icr/classes.rb +11 -3
- data/lib/liquidscript/compiler/icr/expressions.rb +56 -10
- data/lib/liquidscript/compiler/icr/functions.rb +7 -6
- data/lib/liquidscript/compiler/icr/heredoc.rb +28 -0
- data/lib/liquidscript/compiler/icr/literals.rb +102 -9
- data/lib/liquidscript/errors.rb +6 -0
- data/lib/liquidscript/generator/base.rb +1 -1
- data/lib/liquidscript/generator/base/replacements.rb +2 -2
- data/lib/liquidscript/generator/javascript.rb +21 -0
- data/lib/liquidscript/generator/javascript/exceptions.rb +42 -0
- data/lib/liquidscript/generator/javascript/literals.rb +71 -9
- data/lib/liquidscript/generator/javascript/metas.rb +14 -13
- data/lib/liquidscript/generator/javascript/objects.rb +21 -16
- data/lib/liquidscript/icr/set.rb +8 -0
- data/lib/liquidscript/scanner/base/lexer.rb +13 -10
- data/lib/liquidscript/scanner/liquidscript.rb +95 -17
- data/lib/liquidscript/template.rb +1 -2
- data/lib/liquidscript/version.rb +1 -1
- data/liquidscript.gemspec +1 -0
- data/spec/fixtures/class.compile.yml +12 -1
- data/spec/fixtures/class.generate.yml +4 -4
- data/spec/fixtures/combination.generate.yml +4 -4
- data/spec/fixtures/complex.generate.yml +5 -5
- data/spec/fixtures/expression.generate.yml +1 -1
- data/spec/fixtures/heredoc.generate.yml +9 -0
- data/spec/fixtures/literals.generate.yml +9 -1
- data/spec/fixtures/loop.generate.yml +16 -0
- data/spec/fixtures/main.compile.yml +19 -15
- data/spec/fixtures/operator.generate.yml +10 -2
- data/spec/fixtures/string.compile.yml +20 -1
- data/spec/fixtures/string.generate.yml +1 -1
- data/spec/fixtures/underscore.js +28 -0
- data/spec/fixtures/underscore.ls +2 -1
- data/spec/liquidscript/compiler/icr_spec.rb +2 -0
- data/spec/liquidscript/node_spec.rb +21 -0
- data/spec/liquidscript/scanner/lexer_spec.rb +23 -2
- data/spec/support/matchers/compile.rb +1 -1
- data/spec/support/matchers/generate.rb +6 -3
- data/spec/support/matchers/run.rb +12 -0
- metadata +28 -2
@@ -11,13 +11,15 @@ RSpec::Matchers.define :generate do |v|
|
|
11
11
|
end
|
12
12
|
|
13
13
|
failure_message_for_should do |data|
|
14
|
-
sprintf "expected %{
|
14
|
+
sprintf "expected: %{dest}\n got: %{actual}",
|
15
15
|
:source => data.inspect,
|
16
16
|
:dest => for_match(v).inspect,
|
17
17
|
:actual => actual.inspect,
|
18
18
|
:tree => tree(data)
|
19
19
|
end
|
20
20
|
|
21
|
+
diffable
|
22
|
+
|
21
23
|
def actual
|
22
24
|
@_out
|
23
25
|
end
|
@@ -26,12 +28,13 @@ RSpec::Matchers.define :generate do |v|
|
|
26
28
|
@_expected
|
27
29
|
end
|
28
30
|
|
29
|
-
diffable
|
30
|
-
|
31
31
|
def generator(data)
|
32
32
|
compiler = Compiler::ICR.new(s = Scanner::Liquidscript.new(data))
|
33
33
|
compiler.compile
|
34
34
|
Generator::Javascript.new(compiler.top)
|
35
|
+
rescue Liquidscript::UnexpectedError
|
36
|
+
puts ICR::Sexp.new(s.each.to_a).output
|
37
|
+
raise
|
35
38
|
end
|
36
39
|
|
37
40
|
def tree(data)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
RSpec::Matchers.define :run do
|
2
|
+
command = Command::Runner.new("node", "")
|
3
|
+
match do |data|
|
4
|
+
@output = Liquidscript::Template.new(data).render
|
5
|
+
@message = command.run({}, :input => @output)
|
6
|
+
@message.successful?
|
7
|
+
end
|
8
|
+
|
9
|
+
failure_message_for_should do
|
10
|
+
"Expected to run, got:\n#{@message.stderr}"
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: liquidscript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Rodi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: command-runner
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: hashie
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,6 +125,7 @@ files:
|
|
111
125
|
- lib/liquidscript/compiler/icr/expressions.rb
|
112
126
|
- lib/liquidscript/compiler/icr/functions.rb
|
113
127
|
- lib/liquidscript/compiler/icr/helpers.rb
|
128
|
+
- lib/liquidscript/compiler/icr/heredoc.rb
|
114
129
|
- lib/liquidscript/compiler/icr/literals.rb
|
115
130
|
- lib/liquidscript/errors.rb
|
116
131
|
- lib/liquidscript/generator.rb
|
@@ -119,6 +134,7 @@ files:
|
|
119
134
|
- lib/liquidscript/generator/base/replacements.rb
|
120
135
|
- lib/liquidscript/generator/context.rb
|
121
136
|
- lib/liquidscript/generator/javascript.rb
|
137
|
+
- lib/liquidscript/generator/javascript/exceptions.rb
|
122
138
|
- lib/liquidscript/generator/javascript/literals.rb
|
123
139
|
- lib/liquidscript/generator/javascript/metas.rb
|
124
140
|
- lib/liquidscript/generator/javascript/objects.rb
|
@@ -148,12 +164,15 @@ files:
|
|
148
164
|
- spec/fixtures/expression.generate.yml
|
149
165
|
- spec/fixtures/function.generate.yml
|
150
166
|
- spec/fixtures/get.generate.yml
|
167
|
+
- spec/fixtures/heredoc.generate.yml
|
151
168
|
- spec/fixtures/literals.generate.yml
|
169
|
+
- spec/fixtures/loop.generate.yml
|
152
170
|
- spec/fixtures/main.compile.yml
|
153
171
|
- spec/fixtures/operator.generate.yml
|
154
172
|
- spec/fixtures/set.generate.yml
|
155
173
|
- spec/fixtures/string.compile.yml
|
156
174
|
- spec/fixtures/string.generate.yml
|
175
|
+
- spec/fixtures/underscore.js
|
157
176
|
- spec/fixtures/underscore.ls
|
158
177
|
- spec/liquidscript/buffer_spec.rb
|
159
178
|
- spec/liquidscript/compiler/icr_spec.rb
|
@@ -161,6 +180,7 @@ files:
|
|
161
180
|
- spec/liquidscript/icr/code_spec.rb
|
162
181
|
- spec/liquidscript/icr/context_spec.rb
|
163
182
|
- spec/liquidscript/icr/set_spec.rb
|
183
|
+
- spec/liquidscript/node_spec.rb
|
164
184
|
- spec/liquidscript/scanner/lexer_spec.rb
|
165
185
|
- spec/liquidscript/scanner/token_spec.rb
|
166
186
|
- spec/liquidscript/scanner_spec.rb
|
@@ -169,6 +189,7 @@ files:
|
|
169
189
|
- spec/support/matchers/be_token.rb
|
170
190
|
- spec/support/matchers/compile.rb
|
171
191
|
- spec/support/matchers/generate.rb
|
192
|
+
- spec/support/matchers/run.rb
|
172
193
|
homepage: https://github.com/redjazz96/liquidscript
|
173
194
|
licenses:
|
174
195
|
- MIT
|
@@ -201,12 +222,15 @@ test_files:
|
|
201
222
|
- spec/fixtures/expression.generate.yml
|
202
223
|
- spec/fixtures/function.generate.yml
|
203
224
|
- spec/fixtures/get.generate.yml
|
225
|
+
- spec/fixtures/heredoc.generate.yml
|
204
226
|
- spec/fixtures/literals.generate.yml
|
227
|
+
- spec/fixtures/loop.generate.yml
|
205
228
|
- spec/fixtures/main.compile.yml
|
206
229
|
- spec/fixtures/operator.generate.yml
|
207
230
|
- spec/fixtures/set.generate.yml
|
208
231
|
- spec/fixtures/string.compile.yml
|
209
232
|
- spec/fixtures/string.generate.yml
|
233
|
+
- spec/fixtures/underscore.js
|
210
234
|
- spec/fixtures/underscore.ls
|
211
235
|
- spec/liquidscript/buffer_spec.rb
|
212
236
|
- spec/liquidscript/compiler/icr_spec.rb
|
@@ -214,6 +238,7 @@ test_files:
|
|
214
238
|
- spec/liquidscript/icr/code_spec.rb
|
215
239
|
- spec/liquidscript/icr/context_spec.rb
|
216
240
|
- spec/liquidscript/icr/set_spec.rb
|
241
|
+
- spec/liquidscript/node_spec.rb
|
217
242
|
- spec/liquidscript/scanner/lexer_spec.rb
|
218
243
|
- spec/liquidscript/scanner/token_spec.rb
|
219
244
|
- spec/liquidscript/scanner_spec.rb
|
@@ -222,4 +247,5 @@ test_files:
|
|
222
247
|
- spec/support/matchers/be_token.rb
|
223
248
|
- spec/support/matchers/compile.rb
|
224
249
|
- spec/support/matchers/generate.rb
|
250
|
+
- spec/support/matchers/run.rb
|
225
251
|
has_rdoc:
|