oedipus_lex 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +6 -0
- data/lib/oedipus_lex.rb +5 -1
- data/lib/oedipus_lex.rex.rb +2 -1
- data/test/test_oedipus_lex.rb +40 -9
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c56dcc885b6ee098fa6e988db8ffd9a423134640
|
4
|
+
data.tar.gz: 03ee3915b080e450e7ff564842b5c7298dde0672
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2843b5841203dbc901caded1175e7cdb392e392429f0cdb8723054cd5bb04de9e4351a83e56ba75a5fa43a0144ee50e70a430d4cbbd04d7598370788ae76c64
|
7
|
+
data.tar.gz: 369ae18943123aca8e0b5d331932747d98c5eb7dee8ff100fab4bfba3e81078e776871237c52fc74055f6b4ccb45e8989b32af31a8dae009abbbae3e10d06eb4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
data/lib/oedipus_lex.rb
CHANGED
@@ -4,7 +4,7 @@ require "erb"
|
|
4
4
|
require "oedipus_lex.rex"
|
5
5
|
|
6
6
|
class OedipusLex
|
7
|
-
VERSION = "2.3.
|
7
|
+
VERSION = "2.3.1"
|
8
8
|
|
9
9
|
attr_accessor :class_name
|
10
10
|
attr_accessor :header
|
@@ -232,10 +232,14 @@ class OedipusLex
|
|
232
232
|
all_states = [[nil, *inclusives], # nil+incls # eg [[nil, :a],
|
233
233
|
*exclusives.map { |s| [s] }] # [excls] # [:A], [:B]]
|
234
234
|
|
235
|
+
encoding = header.shift if header.first =~ /encoding:/
|
236
|
+
encoding ||= "# encoding: UTF-8"
|
237
|
+
|
235
238
|
ERB.new(TEMPLATE, nil, "%").result binding
|
236
239
|
end
|
237
240
|
|
238
241
|
TEMPLATE = <<-'REX'.gsub(/^ {6}/, '')
|
242
|
+
<%= encoding %>
|
239
243
|
#--
|
240
244
|
# This file is automatically generated. Do not modify it.
|
241
245
|
# Generated by: oedipus_lex version <%= VERSION %>.
|
data/lib/oedipus_lex.rex.rb
CHANGED
data/test/test_oedipus_lex.rb
CHANGED
@@ -592,15 +592,46 @@ class TestOedipusLex < Minitest::Test
|
|
592
592
|
|
593
593
|
ruby = generate_lexer src
|
594
594
|
|
595
|
-
exp = ["
|
596
|
-
"
|
597
|
-
"#
|
598
|
-
"
|
599
|
-
"
|
600
|
-
"
|
601
|
-
"module
|
602
|
-
|
603
|
-
|
595
|
+
exp = ["# encoding: UTF-8",
|
596
|
+
"#--",
|
597
|
+
"# This file is automatically generated. Do not modify it.",
|
598
|
+
"# Generated by: oedipus_lex version #{OedipusLex::VERSION}.",
|
599
|
+
"#++",
|
600
|
+
"",
|
601
|
+
"module X",
|
602
|
+
"module Y"]
|
603
|
+
|
604
|
+
assert_equal exp, ruby.lines.map(&:chomp).first(8)
|
605
|
+
end
|
606
|
+
|
607
|
+
def test_header_encoding_is_on_top
|
608
|
+
src = <<-'REX'
|
609
|
+
# encoding: UTF-8
|
610
|
+
|
611
|
+
module X
|
612
|
+
module Y
|
613
|
+
class Calculator
|
614
|
+
rule
|
615
|
+
/\d+/ { [:number, text.to_i] }
|
616
|
+
/\s+/
|
617
|
+
/[+-]/ { [:op, text] }
|
618
|
+
end
|
619
|
+
end
|
620
|
+
end
|
621
|
+
REX
|
622
|
+
|
623
|
+
ruby = generate_lexer src
|
624
|
+
|
625
|
+
exp = ["# encoding: UTF-8",
|
626
|
+
"#--",
|
627
|
+
"# This file is automatically generated. Do not modify it.",
|
628
|
+
"# Generated by: oedipus_lex version #{OedipusLex::VERSION}.",
|
629
|
+
"#++",
|
630
|
+
"",
|
631
|
+
"",
|
632
|
+
"module X"]
|
633
|
+
|
634
|
+
assert_equal exp, ruby.lines.map(&:chomp).first(8)
|
604
635
|
end
|
605
636
|
|
606
637
|
def test_read_non_existent_file
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oedipus_lex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
Y4evBVezr3SjXz08vPqRO5YRdO3zfeMT8gBjRqZjWJGMZ2lD4XNfrs7eky74CyZw
|
30
30
|
xx3n58i0lQkBE1EpKE0lFu/y
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2014-
|
32
|
+
date: 2014-06-10 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: minitest
|
metadata.gz.sig
CHANGED
Binary file
|