liquidscript 0.6.5 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/liquidscript.rb +1 -1
- data/lib/liquidscript/generator/javascript/literals.rb +8 -1
- data/lib/liquidscript/icr/representable.rb +4 -0
- data/lib/liquidscript/icr/sexp.rb +5 -1
- data/lib/liquidscript/scanner/liquidscript.rb +2 -2
- data/lib/liquidscript/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: ee4e04ff0fb7e70cc829b24f939b5dc3818876de
|
4
|
+
data.tar.gz: df98980cc63c5f2913684363eb897972d53dc59a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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) [![
|
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
|
|
data/lib/liquidscript.rb
CHANGED
@@ -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].
|
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])}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Liquidscript
|
2
2
|
module ICR
|
3
3
|
|
4
|
-
class ::Array; def to_sexp; Sexp.new(self)
|
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] ||= []
|
data/lib/liquidscript/version.rb
CHANGED
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.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-
|
11
|
+
date: 2014-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|