elparser 0.0.6 → 0.0.7
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 +4 -4
- data/lib/elparser.rb +10 -2
- data/lib/elparser/version.rb +1 -1
- data/test/test-elparser.rb +2 -0
- 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: 109878a1bf9bc20d2681cf61a39d43aa925caab8
|
4
|
+
data.tar.gz: 03eb25d9ed4cd6910ccba1257df9416ee27420c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68bfea59646dcf934b18e42a6ac4cc3b711aa1fa410edcbbc709b835142d7f7a6c6337efa2d2b9d65077bb25ad13e870a101102f8fe61547e924830fd514ecd9
|
7
|
+
data.tar.gz: 3ae2a4eb0f4599315ab3d7920a780c513cd376872a1c5f7f923ab38db8321f823ab835dbe5981ba16e339191e12f170c8f7a2fdb7af22fed6bfdfc0f4554c4ba
|
data/lib/elparser.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'elparser/version'
|
2
2
|
require 'elparser/parser.tab.rb'
|
3
3
|
require 'strscan'
|
4
4
|
|
@@ -65,7 +65,15 @@ module Elparser
|
|
65
65
|
@str = str
|
66
66
|
end
|
67
67
|
def to_s
|
68
|
-
|
68
|
+
# replace unicode point escape syntax : \u{xxxx} -> \uxxxx, \u{yyyyy} -> \U000yyyyy
|
69
|
+
@str.dump.gsub(/\\u\{(\h{4,6})\}/) do |m|
|
70
|
+
i = $1
|
71
|
+
if i.size == 4 then
|
72
|
+
"\\u#{i}"
|
73
|
+
else
|
74
|
+
"\\U00%06x"%(i.hex)
|
75
|
+
end
|
76
|
+
end
|
69
77
|
end
|
70
78
|
def to_ruby
|
71
79
|
@str
|
data/lib/elparser/version.rb
CHANGED
data/test/test-elparser.rb
CHANGED
@@ -175,6 +175,8 @@ class TestElparser < Test::Unit::TestCase
|
|
175
175
|
"nested list" => [[1,[2,[3,4]]], "(1 (2 (3 4)))"],
|
176
176
|
"hash1" => [{"a" => "b", "c" => "d"}, "((\"a\" . \"b\") (\"c\" . \"d\"))"],
|
177
177
|
"hash2" => [{:a => [1,2,3], :b => {:c => [4,5,6]}}, "((a 1 2 3) (b (c 4 5 6)))"],
|
178
|
+
"unicode1" => ["unicode \u{2026}\u{2027} normal", "\"unicode \\u2026\\u2027 normal\""],
|
179
|
+
"unicode2" => ["unicode \u{1f607} emoji", "\"unicode \\U0001f607 emoji\""],
|
178
180
|
})
|
179
181
|
def test_encode(data)
|
180
182
|
src, expected = data
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SAKURAI Masashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: racc
|