oedipus_lex 2.0.0 → 2.1.0

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: ae00ca9bebb1e13070e5b9ee44b4cfa762333cce
4
- data.tar.gz: 5b798da04b678300ed976de7a281fcbb6d39a979
3
+ metadata.gz: 16d5bf4e2e41af8957fcfee63012c44ee33f65df
4
+ data.tar.gz: 55ec9b8e51834e8bee5f1ae27d6d4a1276c53094
5
5
  SHA512:
6
- metadata.gz: 86902463f0f518bca1f7a02412a70e9e90aa95cd6be8169a48ed88a11228b520ffb11ea9cccb5e212c8e2fe3183e4a4b54a73c2aabbee8e61ac15147671028ef
7
- data.tar.gz: c0b06ce63410490eafdfa2d8ee5758d7e92dd824d444b9e30767ce65e82c5439a04c51e4959bc97d5f2b55b80968f3b046320f92c2be9944b7b7444b7c189265
6
+ metadata.gz: d78c2765d033065c1be87a0a18860bec9d0f7ce359218ad88db34cd5381e70ff34435e489cdcb6fa2a6091b115f16524333dda547fcb712fac36c1192d8b8553
7
+ data.tar.gz: 62cc88bdb0ee37be1d38aaca8a7ad7979839d6a9602d1797f25361873a40994d394c8d44e0d0fe15d255916cb5e716d829a410161783a8e4283b90a16bb8153b
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,4 +1,12 @@
1
- === 1.0.0 / 2013-12-13
1
+ === 2.1.0 / 2014-01-22
2
+
3
+ * 3 minor enhancements:
4
+
5
+ * Added lineno and do_parse as options via grammar.
6
+ * All options are now opt-in. You might want to add do_parse and lineno to your grammar.
7
+ * New option lineno will turn on automatic line number handling at the top of next_token.
8
+
9
+ === 2.0.0 / 2013-12-13
2
10
 
3
11
  * 1 major enhancement
4
12
 
data/README.rdoc CHANGED
@@ -47,6 +47,8 @@ resource for CS learning. Books... books are good. I like books.
47
47
  option_section = /options?/ NL (option)*
48
48
  option = /stub/i
49
49
  | /debug/i
50
+ | /do_parse/i
51
+ | /lineno/i
50
52
 
51
53
  inner_section = /inner/ NL (misc_line)*
52
54
 
@@ -109,7 +111,8 @@ testability.
109
111
 
110
112
  ==== Options
111
113
 
112
- There are currently only two options for Oedipus: "debug" and "stub".
114
+ All options are opt-in and can be specified either in the grammar or
115
+ via an options hash in `OedipusLex#initialize`.
113
116
 
114
117
  Specify `debug` to turn on basic tracing output.
115
118
 
@@ -118,6 +121,13 @@ specified on the commandline with a rather generic handler. This makes
118
121
  it easy to get up and running before you have the rest of your system
119
122
  in place.
120
123
 
124
+ Specify `do_parse` to generate a generic do_parse method that
125
+ automatically dispatches off to `lex_<token_type>` methods.
126
+
127
+ Specify `lineno` to generate automatic line number handling at the
128
+ beginning of `next_token`. This was the default in 1.0.0 and you must
129
+ now activate it.
130
+
121
131
  ==== Inner
122
132
 
123
133
  The inner section is just code, like header or footer, but inner gets
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.0.0"
7
+ VERSION = "2.1.0"
8
8
 
9
9
  attr_accessor :class_name
10
10
  attr_accessor :header
@@ -17,7 +17,8 @@ class OedipusLex
17
17
 
18
18
  DEFAULTS = {
19
19
  :debug => false,
20
- :do_parse => true,
20
+ :do_parse => false,
21
+ :lineno => false,
21
22
  :stub => false,
22
23
  }
23
24
 
@@ -166,7 +167,9 @@ class OedipusLex
166
167
  % starts.each do |s|
167
168
  <%= s %>
168
169
  % end
170
+ % if option[:lineno] then
169
171
  self.lineno += 1 if ss.peek(1) == "\n"
172
+ % end
170
173
 
171
174
  token = nil
172
175
 
data/lib/oedipus_lex.rex CHANGED
@@ -13,6 +13,11 @@
13
13
 
14
14
  class OedipusLex
15
15
 
16
+ option
17
+
18
+ do_parse
19
+ lineno
20
+
16
21
  macro
17
22
  ST /(?:(:\S+|\w+\??))/
18
23
  RE /(\/(?:\\.|[^\/])+\/[ion]?)/
@@ -37,6 +42,8 @@ rule
37
42
  :option /\s+/ # do nothing
38
43
  :option /stub/i { [:option, text] }
39
44
  :option /debug/i { [:option, text] }
45
+ :option /do_parse/i { [:option, text] }
46
+ :option /lineno/i { [:option, text] }
40
47
 
41
48
  :inner /.*/ { [:inner, text] }
42
49
 
@@ -104,6 +104,10 @@ class OedipusLex
104
104
  action { [:option, text] }
105
105
  when (state == :option) && (text = ss.scan(/debug/i)) then
106
106
  action { [:option, text] }
107
+ when (state == :option) && (text = ss.scan(/do_parse/i)) then
108
+ action { [:option, text] }
109
+ when (state == :option) && (text = ss.scan(/lineno/i)) then
110
+ action { [:option, text] }
107
111
  when (state == :inner) && (text = ss.scan(/.*/)) then
108
112
  action { [:inner, text] }
109
113
  when (state == :start) && (text = ss.scan(/.*/)) then
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.0.0
4
+ version: 2.1.0
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: 2013-12-14 00:00:00.000000000 Z
32
+ date: 2014-01-22 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: minitest
@@ -65,14 +65,14 @@ dependencies:
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '3.7'
68
+ version: '3.8'
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.7'
75
+ version: '3.8'
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
@@ -107,6 +107,7 @@ extra_rdoc_files:
107
107
  - sample/error1.txt
108
108
  files:
109
109
  - .autotest
110
+ - .gemtest
110
111
  - History.rdoc
111
112
  - Manifest.txt
112
113
  - README.rdoc
@@ -133,7 +134,6 @@ files:
133
134
  - sample/xhtmlparser.rex
134
135
  - sample/xhtmlparser.xhtml
135
136
  - test/test_oedipus_lex.rb
136
- - .gemtest
137
137
  homepage: http://github.com/seattlerb/oedipus_lex
138
138
  licenses:
139
139
  - MIT
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  version: '0'
157
157
  requirements: []
158
158
  rubyforge_project: oedipus_lex
159
- rubygems_version: 2.1.10
159
+ rubygems_version: 2.2.1
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: Oedipus Lex is a lexer generator in the same family as Rexical and Rex
metadata.gz.sig CHANGED
Binary file