oedipus_lex 2.5.3 → 2.6.0
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 +11 -0
- data/lib/oedipus_lex.rb +3 -2
- data/lib/oedipus_lex.rex +1 -1
- data/lib/oedipus_lex.rex.rb +4 -3
- data/test/test_oedipus_lex.rb +19 -4
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +1 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a4715d1253bc4e949f28fe08756befae60945975dea73942e4821293e910a21
|
4
|
+
data.tar.gz: c54b53dd59c1ebd5f81b0d4e3cfcd81b06520813934f91827a03d1185d4a7971
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d611cdec7771203561d7f6c4edaf5afa7a4839eff5efa0b82c22a88a7f68b87a8f6b7bd13891a2dbcdccfed1017ea8d32dc4424a5427be7cf6a9b4444626d1d
|
7
|
+
data.tar.gz: 259a6b53e966df95e6138f7a6fd3c80948d151ffca0d50a9c03badb737b30b949800e9bf761cacbbaaf55c20c72469733dbd1e0aff7dca8b819005efcb1aac6f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
=== 2.6.0 / 2021-10-27
|
2
|
+
|
3
|
+
* 2 minor enhancements:
|
4
|
+
|
5
|
+
* Add frozen_string_literal comment to generated lexers.
|
6
|
+
* Allow empty regex. (marcandre)
|
7
|
+
|
8
|
+
* 1 bug fix:
|
9
|
+
|
10
|
+
* Switched from peek(1) == "\n" to check(/\n/) to save a ton of strings.
|
11
|
+
|
1
12
|
=== 2.5.3 / 2021-05-29
|
2
13
|
|
3
14
|
* 1 bug fix:
|
data/lib/oedipus_lex.rb
CHANGED
@@ -30,7 +30,7 @@ require "oedipus_lex.rex"
|
|
30
30
|
# books.
|
31
31
|
|
32
32
|
class OedipusLex
|
33
|
-
VERSION = "2.
|
33
|
+
VERSION = "2.6.0" # :nodoc:
|
34
34
|
|
35
35
|
##
|
36
36
|
# The class name to generate.
|
@@ -394,6 +394,7 @@ class OedipusLex
|
|
394
394
|
# :stopdoc:
|
395
395
|
|
396
396
|
TEMPLATE = <<-'REX'.gsub(/^ {6}/, '')
|
397
|
+
# frozen_string_literal: true
|
397
398
|
<%= encoding %>
|
398
399
|
#--
|
399
400
|
# This file is automatically generated. Do not modify it.
|
@@ -564,7 +565,7 @@ class OedipusLex
|
|
564
565
|
|
565
566
|
until ss.eos? or token do
|
566
567
|
% if option[:lineno] then
|
567
|
-
if ss.
|
568
|
+
if ss.check(/\n/) then
|
568
569
|
self.lineno += 1
|
569
570
|
% if option[:column] then
|
570
571
|
# line starts 1 position after the newline
|
data/lib/oedipus_lex.rex
CHANGED
data/lib/oedipus_lex.rex.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# encoding: UTF-8
|
2
3
|
#--
|
3
4
|
# This file is automatically generated. Do not modify it.
|
4
|
-
# Generated by: oedipus_lex version 2.
|
5
|
+
# Generated by: oedipus_lex version 2.6.0.
|
5
6
|
# Source: lib/oedipus_lex.rex
|
6
7
|
#++
|
7
8
|
|
@@ -14,7 +15,7 @@ class OedipusLex
|
|
14
15
|
|
15
16
|
# :stopdoc:
|
16
17
|
ST = /(?:(:\S+|\w+\??))/
|
17
|
-
RE = /(\/(?:\\.|[^\/])
|
18
|
+
RE = /(\/(?:\\.|[^\/])*\/[ion]?)/
|
18
19
|
ACT = /(\{.*|:?\w+)/
|
19
20
|
# :startdoc:
|
20
21
|
# :stopdoc:
|
@@ -137,7 +138,7 @@ class OedipusLex
|
|
137
138
|
token = nil
|
138
139
|
|
139
140
|
until ss.eos? or token do
|
140
|
-
if ss.
|
141
|
+
if ss.check(/\n/) then
|
141
142
|
self.lineno += 1
|
142
143
|
# line starts 1 position after the newline
|
143
144
|
self.start_of_current_line_pos = ss.pos + 1
|
data/test/test_oedipus_lex.rb
CHANGED
@@ -635,7 +635,8 @@ class TestOedipusLex < Minitest::Test
|
|
635
635
|
|
636
636
|
ruby = generate_lexer src
|
637
637
|
|
638
|
-
exp = ["#
|
638
|
+
exp = ["# frozen_string_literal: true",
|
639
|
+
"# encoding: UTF-8",
|
639
640
|
"#--",
|
640
641
|
"# This file is automatically generated. Do not modify it.",
|
641
642
|
"# Generated by: oedipus_lex version #{OedipusLex::VERSION}.",
|
@@ -644,7 +645,7 @@ class TestOedipusLex < Minitest::Test
|
|
644
645
|
"module X",
|
645
646
|
"module Y"]
|
646
647
|
|
647
|
-
assert_equal exp, ruby.lines.map(&:chomp).first(
|
648
|
+
assert_equal exp, ruby.lines.map(&:chomp).first(9)
|
648
649
|
end
|
649
650
|
|
650
651
|
def test_header_encoding_is_on_top
|
@@ -665,7 +666,8 @@ class TestOedipusLex < Minitest::Test
|
|
665
666
|
|
666
667
|
ruby = generate_lexer src
|
667
668
|
|
668
|
-
exp = ["#
|
669
|
+
exp = ["# frozen_string_literal: true",
|
670
|
+
"# encoding: UTF-8",
|
669
671
|
"#--",
|
670
672
|
"# This file is automatically generated. Do not modify it.",
|
671
673
|
"# Generated by: oedipus_lex version #{OedipusLex::VERSION}.",
|
@@ -674,7 +676,7 @@ class TestOedipusLex < Minitest::Test
|
|
674
676
|
"",
|
675
677
|
"module X"]
|
676
678
|
|
677
|
-
assert_equal exp, ruby.lines.map(&:chomp).first(
|
679
|
+
assert_equal exp, ruby.lines.map(&:chomp).first(9)
|
678
680
|
end
|
679
681
|
|
680
682
|
def test_read_non_existent_file
|
@@ -765,6 +767,19 @@ class TestOedipusLex < Minitest::Test
|
|
765
767
|
assert_match 'ss.scan(/#{X}/)', source
|
766
768
|
end
|
767
769
|
|
770
|
+
def test_parses_empty_regexp
|
771
|
+
source = generate_lexer %q{
|
772
|
+
class Foo
|
773
|
+
rule
|
774
|
+
/\w+/ { @state = :ARG; emit :tFUNCTION_CALL }
|
775
|
+
:ARG /\(/ { @state = nil; emit :tARG_LIST_BEGIN }
|
776
|
+
:ARG // { @state = nil }
|
777
|
+
end
|
778
|
+
}
|
779
|
+
|
780
|
+
assert_match 'ss.skip(//)', source
|
781
|
+
end
|
782
|
+
|
768
783
|
def test_changing_state_during_lexing
|
769
784
|
src = <<-'REX'
|
770
785
|
class Calculator
|
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.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
d/AHw/kcnU6iuMUoJEcGiJd4gVCTn1l3cDcIvxakGslCA88Jubw0Sqatan0TnC9g
|
30
30
|
KToW560QIey7SPfHWduzFJnV
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2021-
|
32
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rdoc
|
metadata.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
#��Ir!A��xW�����ȇL[n`�|���j�D�g�-�}���'[H�У@_\H��
|
1
|
+
��-�V���F���k���r�Xp�G0�_3�t�6pu�+H_r�t�O�|F=yg��'0�rZ�{�3��U�#͍KJ����T�7�(/��z����?Tp�&4�E�����s��Sb��z����M5������F�k�,=F
|