oedipus_lex 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61adb0e46462bf1c5bc415fdc1654e216ab490b4
4
- data.tar.gz: 04be5ee4d10e6b8829af5af8ddb01f8fd2592bcd
3
+ metadata.gz: ab5673d633e7abae710deb96e4b764b2518bed0e
4
+ data.tar.gz: 9e16b31d4ffeaad609fe27812e69f8dfa3b0b8ff
5
5
  SHA512:
6
- metadata.gz: 6a622ea8f3751c1408c5775c47dea719e43da6a5d296cd65ce39ef6b4a0fbf80135de1a290d862eb9d689c93748bb84fb8fc42b5881a67bbf0f065734282e173
7
- data.tar.gz: e81ff0a38cb4fbf6e3cac5d6babb3d8652bdc2be385e7995cb2426670aa6f65a52aa5cfb900757045d77c476ce7012cfe01e2f20f247cdb700a557cb30536ee6
6
+ metadata.gz: c3948a898e603ccb19494bdcb753f1ae5f799d21660c42a8ba80611884e18a94f615ef1511c79d1ac5f592e6ea7288ab673b6729988e8f8a07d37c881e9f6c6f
7
+ data.tar.gz: 7876d02faa16c81ef199ceec5b342cf9bd69e9e0d6c4970328e8e92c49abc3904dd06e1b1a40734fe5cc80314030e2b5cc21d7a2ec60afb60ff66f532a93572c
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,9 @@
1
+ === 2.4.1 / 2016-01-21
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Use `skip` and `match?` instead of `scan` and `check`. Better on GC. (presidentbeef)
6
+
1
7
  === 2.4.0 / 2014-08-29
2
8
 
3
9
  * 1 minor enhancement:
@@ -19,7 +19,7 @@ At the very least, you need to add slashes to all your regexps.
19
19
 
20
20
  Oedipus, like rexical, is based primarily on generating code much like
21
21
  you would a hand-written lexer. It is _not_ a table or hash driven
22
- lexer. It use StrScanner within a multi-level case statement. As such,
22
+ lexer. It uses StrScanner within a multi-level case statement. As such,
23
23
  Oedipus matches on the _first_ match, not the longest (like lex and
24
24
  its ilk).
25
25
 
data/Rakefile CHANGED
@@ -3,8 +3,6 @@
3
3
  require "rubygems"
4
4
  require "hoe"
5
5
 
6
- Hoe.plugin :debugging
7
- Hoe.plugin :git
8
6
  Hoe.plugin :isolate
9
7
  Hoe.plugin :seattlerb
10
8
 
@@ -16,6 +14,10 @@ Hoe.spec "oedipus_lex" do
16
14
  self.history_file = "History.rdoc"
17
15
  end
18
16
 
17
+ Hoe.bad_plugins.each do |bad|
18
+ warn "BAD: Hoe.plugin :#{bad}"
19
+ end
20
+
19
21
  task :bootstrap do
20
22
  ruby "-Ilib lib/oedipus_lex.rb lib/oedipus_lex.rex > lib/oedipus_lex.rex.rb.new"
21
23
  system "diff -uw lib/oedipus_lex.rex.rb lib/oedipus_lex.rex.rb.new"
@@ -78,4 +80,9 @@ task :debug do
78
80
  puts rex.generate
79
81
  end
80
82
 
83
+ task :wtf => :isolate do
84
+ puts `~/.rbenv/versions/2.2.0/bin/ruby -S gem env`
85
+ puts `~/.rbenv/versions/2.2.0/bin/ruby -S gem list`
86
+ end
87
+
81
88
  # vim: syntax=ruby
@@ -4,7 +4,7 @@ require "erb"
4
4
  require "oedipus_lex.rex"
5
5
 
6
6
  class OedipusLex
7
- VERSION = "2.4.0"
7
+ VERSION = "2.4.1"
8
8
 
9
9
  attr_accessor :class_name
10
10
  attr_accessor :header
@@ -44,28 +44,33 @@ class OedipusLex
44
44
  start_state == state or
45
45
  (state.nil? and predicates.include? start_state)
46
46
 
47
- cond =
48
- if exclusive or not start_state then
49
- "when text = ss.scan(#{regexp}) then"
50
- elsif start_state =~ /^:/ then
51
- "when (state == #{start_state}) && (text = ss.scan(#{regexp})) then"
52
- else
53
- "when #{start_state} && (text = ss.scan(#{regexp})) then"
54
- end
47
+ uses_text = false
55
48
 
56
49
  body =
57
50
  case action
58
51
  when nil, false then
59
52
  " # do nothing"
60
53
  when /^\{/ then
54
+ uses_text = action =~ /\btext\b/
61
55
  " action #{action}"
62
56
  when /^:/, "nil" then
63
57
  " [:state, #{action}]"
64
- else
58
+ else # plain method name
59
+ uses_text = true
65
60
  " #{action} text"
66
61
  end
67
62
 
68
- [cond, body]
63
+ check = uses_text ? "text = ss.scan(#{regexp})" : "ss.skip(#{regexp})"
64
+
65
+ cond = if exclusive or not start_state then
66
+ check
67
+ elsif start_state =~ /^:/ then
68
+ "(state == #{start_state}) && (#{check})"
69
+ else # predicate method
70
+ "#{start_state} && (#{check})"
71
+ end
72
+
73
+ ["when #{cond} then", body]
69
74
  end
70
75
 
71
76
  def pretty_print pp
@@ -100,7 +105,7 @@ class OedipusLex
100
105
 
101
106
  def to_ruby state, predicates, exclusive
102
107
  [
103
- "when ss.check(#{regex}) then",
108
+ "when ss.match?(#{regex}) then",
104
109
  " case",
105
110
  rules.map { |subrule|
106
111
  s = subrule.to_ruby(state, predicates, exclusive)
@@ -1,4 +1,3 @@
1
- gem "minitest"
2
1
  require "minitest/autorun"
3
2
  require "oedipus_lex"
4
3
  require "stringio"
@@ -458,7 +457,7 @@ class TestOedipusLex < Minitest::Test
458
457
 
459
458
  ruby = generate_lexer src
460
459
 
461
- assert_match "when ss.check(/\\d/) then", ruby
460
+ assert_match "when ss.match?(/\\d/) then", ruby
462
461
  assert_match "when text = ss.scan(/\\d+\\.\\d+/) then", ruby
463
462
  assert_match "when text = ss.scan(/\\d+/) then", ruby
464
463
  assert_match "end # group /\\d/", ruby
@@ -481,12 +480,12 @@ class TestOedipusLex < Minitest::Test
481
480
 
482
481
  ruby = generate_lexer src
483
482
 
484
- assert_match "when ss.check(/\\d/) then", ruby
483
+ assert_match "when ss.match?(/\\d/) then", ruby
485
484
  assert_match "when text = ss.scan(/\\d+\\.\\d+/) then", ruby
486
485
  assert_match "when text = ss.scan(/\\d+/) then", ruby
487
486
  assert_match "end # group /\\d/", ruby
488
487
 
489
- assert_match "when ss.check(/\\+/) then", ruby
488
+ assert_match "when ss.match?(/\\+/) then", ruby
490
489
  assert_match "when xx? && (text = ss.scan(/\\+whatever/)) then", ruby
491
490
  assert_match "when (state == :x) && (text = ss.scan(/\\+\\d+/)) then", ruby
492
491
  assert_match "end # group /\\d/", ruby
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.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTEzMDkxNjIzMDQxMloXDTE0MDkxNjIzMDQxMlowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTE1MDkxOTIwNTEyMloXDTE2MDkxODIwNTEyMlowRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -22,14 +22,14 @@ cert_chain:
22
22
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
23
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
24
  HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
25
- AQCFZ7JTzoy1gcG4d8A6dmOJy7ygtO5MFpRIz8HuKCF5566nOvpy7aHhDDzFmQuu
26
- FX3zDU6ghx5cQIueDhf2SGOncyBmmJRRYawm3wI0o1MeN6LZJ/3cRaOTjSFy6+S6
27
- zqDmHBp8fVA2TGJtO0BLNkbGVrBJjh0UPmSoGzWlRhEVnYC33TpDAbNA+u39UrQI
28
- ynwhNN7YbnmSR7+JU2cUjBFv2iPBO+TGuWC+9L2zn3NHjuc6tnmSYipA9y8Hv+As
29
- Y4evBVezr3SjXz08vPqRO5YRdO3zfeMT8gBjRqZjWJGMZ2lD4XNfrs7eky74CyZw
30
- xx3n58i0lQkBE1EpKE0lFu/y
25
+ AQB+Hx8xUgrpZa4P8H8gR8zme5kISwQrG80MbpqJV6/G3/ZicRFhN5sjwu0uHGue
26
+ bd9Cymf6oIRwHVarJux2M32T6bL07Hmi07w2QaPc3MnMKB/D46SRZ2JSSGPFRBTc
27
+ SilobMRoGs/7B15uGFUEnNrCB/ltMqhwwSx1r++UQPfeySHEV9uqu03E5Vb7J37O
28
+ 2Er6PLXHRiYsIycD1LkMi6YnixdITRHmrqJYE2rsjaIfpIehiusVAPHkNf7qbpHq
29
+ qx3h45R1CAsObX0SQDIT+rRbQrtKz1GHIZTOFYvEJjUY1XmRTZupD3CJ8Q7sDqSy
30
+ NLq5jm1fq6Y9Uolu3RJbmycf
31
31
  -----END CERTIFICATE-----
32
- date: 2014-08-30 00:00:00.000000000 Z
32
+ date: 2016-01-21 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: minitest
@@ -37,14 +37,14 @@ dependencies:
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '5.4'
40
+ version: '5.8'
41
41
  type: :development
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '5.4'
47
+ version: '5.8'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rdoc
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -65,14 +65,14 @@ dependencies:
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '3.12'
68
+ version: '3.14'
69
69
  type: :development
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: '3.12'
75
+ version: '3.14'
76
76
  description: |-
77
77
  Oedipus Lex is a lexer generator in the same family as Rexical and
78
78
  Rex. Oedipus Lex is my independent lexer fork of Rexical. Rexical was
@@ -88,7 +88,7 @@ description: |-
88
88
 
89
89
  Oedipus, like rexical, is based primarily on generating code much like
90
90
  you would a hand-written lexer. It is _not_ a table or hash driven
91
- lexer. It use StrScanner within a multi-level case statement. As such,
91
+ lexer. It uses StrScanner within a multi-level case statement. As such,
92
92
  Oedipus matches on the _first_ match, not the longest (like lex and
93
93
  its ilk).
94
94
 
@@ -107,7 +107,6 @@ extra_rdoc_files:
107
107
  - sample/error1.txt
108
108
  files:
109
109
  - .autotest
110
- - .gemtest
111
110
  - History.rdoc
112
111
  - Manifest.txt
113
112
  - README.rdoc
@@ -156,9 +155,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
155
  version: '0'
157
156
  requirements: []
158
157
  rubyforge_project:
159
- rubygems_version: 2.2.1
158
+ rubygems_version: 2.4.5
160
159
  signing_key:
161
160
  specification_version: 4
162
161
  summary: Oedipus Lex is a lexer generator in the same family as Rexical and Rex
163
- test_files:
164
- - test/test_oedipus_lex.rb
162
+ test_files: []
metadata.gz.sig CHANGED
Binary file
data/.gemtest DELETED
File without changes