parser 2.3.0.4 → 2.3.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/parser/lexer.rl +10 -6
- data/lib/parser/version.rb +1 -1
- data/test/test_lexer.rb +7 -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: 5f5323dd1c3baff2484da66bc48e788fddb6dd8e
|
4
|
+
data.tar.gz: 7c604fd2f64eeeedc37b4154b3eab307093a108d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92bd32ec6046d060f0310b7a33a103061d9c21b1b3b74e831de19314abfdca2cedae541a056cbad3f972f38dfdf0d118e096ef906d83b54c3e4faefdb2ad8be9
|
7
|
+
data.tar.gz: 989e665aa9cdd33251358b2b0e8008b1a600018ede1ac73abde23151ebac6e95c4649148abfb35fb8d2b495f67a2e66f313a97d0f30e3f9ff7071a6974ce5873
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
v2.3.0.5 (2016-02-12)
|
5
|
+
---------------------
|
6
|
+
|
7
|
+
Bugs fixed:
|
8
|
+
* lexer.rl: "%Q{\あ}": fix encoding of UTF-8 noop escapes. (whitequark)
|
9
|
+
|
4
10
|
v2.3.0.4 (2016-02-09)
|
5
11
|
---------------------
|
6
12
|
|
@@ -17,7 +23,7 @@ Bugs fixed:
|
|
17
23
|
* Add :csend to Parser::Meta::NODE_TYPES (Markus Schirp)
|
18
24
|
* lexer/dedenter: "\<\<x\n y\\n z\nx": don't dedent after escaped newline. (whitequark)
|
19
25
|
|
20
|
-
v2.3.0.
|
26
|
+
v2.3.0.5 (2016-01-16)
|
21
27
|
---------------------
|
22
28
|
|
23
29
|
v2.3.0.1 (2016-01-14)
|
data/lib/parser/lexer.rl
CHANGED
@@ -92,7 +92,6 @@ class Parser::Lexer
|
|
92
92
|
RBRACE_OR_RBRACK = %w"} ]".freeze
|
93
93
|
|
94
94
|
attr_reader :source_buffer
|
95
|
-
attr_reader :encoding
|
96
95
|
|
97
96
|
attr_accessor :diagnostics
|
98
97
|
attr_accessor :static_env
|
@@ -183,7 +182,7 @@ class Parser::Lexer
|
|
183
182
|
if @source_buffer
|
184
183
|
source = @source_buffer.source
|
185
184
|
|
186
|
-
if
|
185
|
+
if defined?(Encoding) && source.encoding == Encoding::UTF_8
|
187
186
|
@source_pts = source.unpack('U*')
|
188
187
|
else
|
189
188
|
@source_pts = source.unpack('C*')
|
@@ -198,6 +197,10 @@ class Parser::Lexer
|
|
198
197
|
end
|
199
198
|
end
|
200
199
|
|
200
|
+
def encoding
|
201
|
+
@source_buffer.source.encoding
|
202
|
+
end
|
203
|
+
|
201
204
|
LEX_STATES = {
|
202
205
|
:line_begin => lex_en_line_begin,
|
203
206
|
:expr_dot => lex_en_expr_dot,
|
@@ -305,11 +308,10 @@ class Parser::Lexer
|
|
305
308
|
@stack[@top]
|
306
309
|
end
|
307
310
|
|
308
|
-
if
|
311
|
+
if defined?(Encoding)
|
309
312
|
def encode_escape(ord)
|
310
|
-
ord.chr.force_encoding(source_buffer.source.encoding)
|
313
|
+
ord.chr.force_encoding(@source_buffer.source.encoding)
|
311
314
|
end
|
312
|
-
|
313
315
|
else
|
314
316
|
def encode_escape(ord)
|
315
317
|
ord.chr
|
@@ -663,7 +665,9 @@ class Parser::Lexer
|
|
663
665
|
|
664
666
|
action unescape_char {
|
665
667
|
codepoint = @source_pts[p - 1]
|
666
|
-
@escape = ESCAPES[codepoint]
|
668
|
+
if (@escape = ESCAPES[codepoint]).nil?
|
669
|
+
@escape = encode_escape(@source_buffer.slice(p - 1))
|
670
|
+
end
|
667
671
|
}
|
668
672
|
|
669
673
|
action invalid_complex_escape {
|
data/lib/parser/version.rb
CHANGED
data/test/test_lexer.rb
CHANGED
@@ -3176,6 +3176,13 @@ class TestLexer < Minitest::Test
|
|
3176
3176
|
end
|
3177
3177
|
end
|
3178
3178
|
|
3179
|
+
def test_bug_string_utf_escape_noop
|
3180
|
+
if defined?(Encoding)
|
3181
|
+
assert_scanned(%q{"\あ"}.force_encoding(Encoding::UTF_8),
|
3182
|
+
:tSTRING, "あ".force_encoding(Encoding::UTF_8), [0, 4])
|
3183
|
+
end
|
3184
|
+
end
|
3185
|
+
|
3179
3186
|
def test_bug_string_non_utf
|
3180
3187
|
assert_scanned(%Q{"caf\xE9"},
|
3181
3188
|
:tSTRING, "caf\xE9", [0, 6])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.0.
|
4
|
+
version: 2.3.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- whitequark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ast
|