liquidscript 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 050bb1c044cba44a8a78dd38fdb22a2d5bd0d52e
4
- data.tar.gz: d50d87318b45e35dd0509b31250aec5a643b63fd
3
+ metadata.gz: 0f8c6c51fffb0d24bf827a356b8cf8c46e2bed25
4
+ data.tar.gz: e67a07ac9bbf1d249dde0b499d334b1084d6fd15
5
5
  SHA512:
6
- metadata.gz: ce6e5e973be00db681dd473387119b47d87960de35d8bb14907099bd51c2f310a164bcd161a1bf0aa5d41f90f107e982296bb595811be4f24b7616ad14a46df6
7
- data.tar.gz: ba7f2b51d7ef53ad1009ed192aea8d1ffd9ae9a470270b7a73955db31cf8f0335f91107c285627aa9dac6e6ecae1f5886f91bbf3f37a62b3af0e01c282fc0e3e
6
+ metadata.gz: 629068c68ffea87eaa555918f770424272be615355651c0e19c81113f6416136d288a99f6ef2c24fb6485e75821a613913437d6c0997f0477787794cb63e2535
7
+ data.tar.gz: dba22b9effe63127631a2687961bdb8d4c8b46051430e152bd680eabe573d2c131a4f44bd78a41258a503abcab3445877948e519ea4ada251909f0098e3b6a4a
data/README.md CHANGED
@@ -17,6 +17,11 @@ And then execute:
17
17
  Or install it yourself as:
18
18
 
19
19
  $ gem install liquidscript
20
+
21
+ If you're using Sprockets in your application, place this in
22
+ your Gemfile:
23
+
24
+ gem 'liquidscript', require: 'sprockets/liquidscript'
20
25
 
21
26
  ## Usage
22
27
 
@@ -35,13 +35,7 @@ module Liquidscript
35
35
  :heredoc, :iheredoc
36
36
  ] => :heredoc
37
37
 
38
- if peek? :binop, :minus, :plus
39
- compile_binop(out)
40
- elsif peek? :prop
41
- compile_property(out)
42
- else
43
- out
44
- end
38
+ value_expect(out)
45
39
  end
46
40
 
47
41
  def compile_minus
@@ -13,7 +13,7 @@ module Liquidscript
13
13
  # Just in case there is a property named 'class' or 'module'
14
14
  v = expect [:identifier, :class, :module] => property
15
15
 
16
- value_expect(v)
16
+ v
17
17
  end
18
18
 
19
19
  def compile_access(body)
@@ -23,7 +23,7 @@ module Liquidscript
23
23
 
24
24
  v = code :access, body, key
25
25
 
26
- value_expect(v)
26
+ v
27
27
  end
28
28
 
29
29
  def compile_call(subject)
@@ -36,13 +36,15 @@ module Liquidscript
36
36
  arguments = collect_compiles :expression, :rparen,
37
37
  :comma => action.shift
38
38
 
39
- code :call, subject, *arguments
39
+ call = code :call, subject, *arguments
40
+ call
40
41
  end
41
42
 
42
43
  protected
43
44
 
44
45
  def value_expect(v, &default)
45
- expect :lparen => action { compile_call(v) },
46
+ out = expect \
47
+ :lparen => action { compile_call(v) },
46
48
  :equal => action { compile_assignment(v) },
47
49
  :prop => action { compile_property(v) },
48
50
  :lbrack => action { compile_access(v) },
@@ -51,6 +53,12 @@ module Liquidscript
51
53
  :plus] => action { compile_binop(v) },
52
54
  :unop => action { |o| code :op, v, o },
53
55
  :_ => default || action { v }
56
+
57
+ if out != v
58
+ value_expect(out)
59
+ else
60
+ out
61
+ end
54
62
  end
55
63
  end
56
64
  end
@@ -52,6 +52,7 @@ module Liquidscript
52
52
  end
53
53
 
54
54
  def _compile_for_seg(first)
55
+ first = value_expect(first)
55
56
  shift :comma
56
57
  second = compile_vexpression
57
58
  shift :comma
@@ -64,11 +65,9 @@ module Liquidscript
64
65
  end
65
66
 
66
67
  def compile_identifier(identifier)
67
- default = action do
68
- code :get, ref(identifier)
69
- end
68
+ ref(identifier) unless peek?(:equal)
70
69
 
71
- value_expect(identifier, &default)
70
+ identifier
72
71
  end
73
72
 
74
73
  def compile_regex
@@ -9,7 +9,7 @@ module Liquidscript
9
9
 
10
10
  def render
11
11
  @_render ||= begin
12
- compiler = Compiler::ICR.new(s = Scanner::Liquidscript.new(@data))
12
+ compiler = Compiler::ICR.new(Scanner::Liquidscript.new(@data))
13
13
  compiler.compile
14
14
  Generator::Javascript.new(compiler.top).generate
15
15
  end
@@ -1,5 +1,5 @@
1
1
  module Liquidscript
2
2
 
3
3
  # The current version of liquidscript.
4
- VERSION = "0.6.3".freeze
4
+ VERSION = "0.6.4".freeze
5
5
  end
@@ -28,9 +28,8 @@ compiled:
28
28
  - - :identifier
29
29
  - console
30
30
  - log
31
- - - :get
32
- - - :_variable
33
- - :v
31
+ - - :identifier
32
+ - v
34
33
  - - :call
35
34
  - - :property
36
35
  - - :identifier
@@ -27,8 +27,7 @@ compiled:
27
27
  - - :interop
28
28
  - - :istring_begin
29
29
  - "hello "
30
- - - :get
31
- - - :_variable
32
- - :console
30
+ - - :identifier
31
+ - console
33
32
  - - :istring
34
33
  - ""
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.6.3
4
+ version: 0.6.4
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-16 00:00:00.000000000 Z
11
+ date: 2014-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler