liquidscript 0.6.5 → 0.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51ca166ca554e616ff1286df7160d3562d17bec9
4
- data.tar.gz: 014dddad0abfc08a64e106287e9c22913baa407c
3
+ metadata.gz: ee4e04ff0fb7e70cc829b24f939b5dc3818876de
4
+ data.tar.gz: df98980cc63c5f2913684363eb897972d53dc59a
5
5
  SHA512:
6
- metadata.gz: 62a05f026218fb4b63e17bb462da4a52b03a51404daac97aeb3a717995d57c030c819ba77d9af731d58cd4067f32d82ece97cccefc489a4ea321686e5e4ba59e
7
- data.tar.gz: dbc2e0f247123670a9472e0e507e6c3ea15f42b33f41678423ccdf138806c6793dd64d0617550bc8d1890996d248133fef51787a8e196fb3ea0a574a0c39742d
6
+ metadata.gz: e9a16921b5902920a3f5bab535fb597f7076d9d441daf504ae19c5536fa76d4aaa866876440711abccf355f3225df1e2a5e80ad7fe787f04cdf94032e4196ec2
7
+ data.tar.gz: 1eae537900f300cdeb2a58db4a9aa6dc000dc75d1d555a78e0f8c69f5a5291954df851f1b5c623199fb135677735539a12aef07d1073f0c10fa3d138169f7b63
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ![Liquidscript](http://i.imgur.com/xbdhTsr.png)
2
2
 
3
- [![Build Status](http://img.shields.io/travis/redjazz96/liquidscript.svg)](https://travis-ci.org/redjazz96/liquidscript) [![Coverage Status](http://img.shields.io/coveralls/redjazz96/liquidscript.svg)](https://coveralls.io/r/redjazz96/liquidscript?branch=master) [![Code Climate](http://img.shields.io/codeclimate/github/redjazz96/liquidscript.svg)](https://codeclimate.com/github/redjazz96/liquidscript) [![Gem Version](http://img.shields.io/gem/v/liquidscript.svg)](http://badge.fury.io/rb/liquidscript) [![Dependencies](http://img.shields.io/gemnasium/redjazz96/liquidscript.svg)](https://gemnasium.com/redjazz96/liquidscript) [![License](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://choosealicense.com/licenses/mit/)
3
+ [![Build Status](http://img.shields.io/travis/redjazz96/liquidscript.svg)](https://travis-ci.org/redjazz96/liquidscript) [![Coverage Status](http://img.shields.io/coveralls/redjazz96/liquidscript.svg)](https://coveralls.io/r/redjazz96/liquidscript?branch=master) [![Code Climate](http://img.shields.io/codeclimate/github/redjazz96/liquidscript.svg)](https://codeclimate.com/github/redjazz96/liquidscript) [![Gem Version](http://img.shields.io/gem/v/liquidscript.svg)](http://badge.fury.io/rb/liquidscript) [![Dependency Status](https://gemnasium.com/redjazz96/liquidscript.svg)](https://gemnasium.com/redjazz96/liquidscript) [![License](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://choosealicense.com/licenses/mit/)
4
4
 
5
5
  A javascript-based language that compiles to javascript.
6
6
 
@@ -12,7 +12,7 @@ end
12
12
 
13
13
  module Liquidscript
14
14
  def self.compile(data)
15
- compiler = Compiler::ICR.new(Scanner::Liquidscript.new(data))
15
+ compiler = Compiler::ICR.new(s = Scanner::Liquidscript.new(data))
16
16
  compiler.compile
17
17
  Generator::Javascript.new(compiler.top).generate
18
18
  end
@@ -108,7 +108,14 @@ module Liquidscript
108
108
 
109
109
  def generate_binop(code)
110
110
  op = BINOP_SWITCH.fetch(code[1].value) do
111
- code[1].value
111
+ case code[1].type
112
+ when :minus
113
+ '-'
114
+ when :plus
115
+ '+'
116
+ else
117
+ code[1].value
118
+ end
112
119
  end
113
120
 
114
121
  " #{replace(code[2])} #{op} #{replace(code[3])}"
@@ -20,6 +20,10 @@ module Liquidscript
20
20
  to_a!.to_yaml
21
21
  end
22
22
 
23
+ def to_sexp
24
+ Sexp.new(self)
25
+ end
26
+
23
27
  def to_a!
24
28
  do_map = proc do |e|
25
29
  if e.is_a?(Representable)
@@ -1,7 +1,7 @@
1
1
  module Liquidscript
2
2
  module ICR
3
3
 
4
- class ::Array; def to_sexp; Sexp.new(self).output; end; end
4
+ class ::Array; def to_sexp; Sexp.new(self); end; end
5
5
 
6
6
  # @private
7
7
  class Sexp
@@ -15,6 +15,10 @@ module Liquidscript
15
15
  out(@compiler).strip
16
16
  end
17
17
 
18
+ def to_s
19
+ output
20
+ end
21
+
18
22
  private
19
23
 
20
24
  def out(v)
@@ -58,7 +58,7 @@ module Liquidscript
58
58
  false
59
59
  )
60
60
 
61
- set :identifier, %r{[A-Za-z_$][A-Za-z0-9_$]*}
61
+ set :identifier, %r{[A-Za-z_$]([A-Za-z0-9_$-]*[A-Za-z0-9_$])?}
62
62
 
63
63
  on("class") { emit :class }
64
64
  on("module") { emit :module }
@@ -104,7 +104,7 @@ module Liquidscript
104
104
  on("///" => :block_regex)
105
105
  on(:binops) { |m| emit :binop, m }
106
106
  on(:unops) { |m| emit :unop, m }
107
- on(:identifier) { |m| emit :identifier, m }
107
+ on(:identifier) { |m| emit :identifier, m.gsub(/\-[a-z]/) { |m| m[1].upcase } }
108
108
 
109
109
  on(%r{#! ([A-Za-z]+) ?(.*?)\n}) do |_, c, a|
110
110
  metadata[:directives] ||= []
@@ -1,5 +1,5 @@
1
1
  module Liquidscript
2
2
 
3
3
  # The current version of liquidscript.
4
- VERSION = "0.6.5".freeze
4
+ VERSION = "0.7.0".freeze
5
5
  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.6.5
4
+ version: 0.7.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-19 00:00:00.000000000 Z
11
+ date: 2014-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler