rpdf2txt 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # encoding: ascii-8bit
2
3
  #
3
4
  # Rpdf2txt -- PDF to Text Parser
4
5
  # Copyright (C) 2003 Andreas Schrafl, Hannes Wyss
@@ -66,231 +67,231 @@ endobj
66
67
  @font = Rpdf2txt::Font.new(font_src)
67
68
  @text_state.set_font(@font)
68
69
  end
69
- def test_set
70
- @text_state.set_x("42.7953")
71
- @text_state.set_y("670.6528")
72
- @text_state.update!
73
- assert_equal(427953, (@text_state.x*10000).round)
74
- assert_equal(6706528, (@text_state.y*10000).round)
75
- end
76
- def test_update_td
77
- @text_state.set_x("100.1234")
78
- @text_state.set_y("200.5678")
79
- @text_state.update_x("1.2345")
80
- @text_state.update_y("6.7890")
81
- @text_state.update!
82
- assert_equal(1013579, (@text_state.x*10000).to_i)
83
- assert_equal(2073568, (@text_state.y*10000).to_i)
84
- @text_state.update_x("-1.2345")
85
- @text_state.update_y("-6.7890")
86
- @text_state.update!
87
- assert_equal(1001234, (@text_state.x*10000).to_i)
88
- assert_equal(2005678, (@text_state.y*10000).to_i)
89
- end
90
- def test_update_tD
91
- @text_state.set_x("100.1234")
92
- @text_state.set_y("200.5678")
93
- @text_state.set_lead("-6.7890")
94
- @text_state.update_x("1.2345")
95
- @text_state.update_y("6.7890")
96
- @text_state.update!
97
- assert_equal(-6789.0, @text_state.lead*1000)
98
- assert_equal(1013579, (@text_state.x*10000).to_i)
99
- assert_equal(2073568, (@text_state.y*10000).to_i)
100
- @text_state.set_lead(-1.2345)
101
- @text_state.set_lead(6.7890)
102
- @text_state.update_x("-1.2345")
103
- @text_state.update_y("-6.7890")
104
- @text_state.update!
105
- assert_equal(6789.0, @text_state.lead*1000)
106
- assert_equal(1001234, (@text_state.x*10000).to_i)
107
- assert_equal(2005678, (@text_state.y*10000).to_i)
108
- end
109
- def test_set_lead_tl
110
- @text_state.set_lead("1.2345")
111
- assert_equal(1234.5, @text_state.lead*1000)
112
- @text_state.set_lead("-6.7890")
113
- assert_equal(-6789.0, @text_state.lead*1000)
114
- end
115
- def test_step
116
- @text_state.set_lead(-3.4567)
117
- @text_state.set_y(200.1234)
118
- @text_state.set_x(400.5678)
119
- @text_state.set_txt('foo')
120
- @text_state.advance_x
121
- @text_state.update!
122
- assert_equal(2001234, (@text_state.y * 10000).to_i)
123
- assert_not_equal(4005678, (@text_state.x * 10000).to_i)
124
- @text_state.step
125
- @text_state.update!
126
- assert_equal(1966667, (@text_state.y * 10000).to_i)
127
- assert_equal(4005678, (@text_state.x * 10000).to_i)
128
- end
129
- def test_compare1
130
- @text_state.set_font_size(0.0)
131
- @text_state.set_x 100.1234
132
- @text_state.set_y 200.5678
133
- @text_state.update!
134
- text_state = Rpdf2txt::TextState.new
135
- text_state.set_font_size(0.0)
136
- text_state.set_x 88.9012
137
- text_state.set_y 250.3456
138
- text_state.update!
139
- assert(text_state > @text_state, text_state <=> @text_state)
140
- end
141
- def test_compare2
142
- @text_state.set_font_size(10)
143
- @text_state.set_x 100.1234
144
- @text_state.set_y 200.5678
145
- @text_state.update!
146
- text_state = Rpdf2txt::TextState.new
147
- text_state.set_font_size(10)
148
- text_state.set_x 88.9012
149
- text_state.set_y 200.5678
150
- text_state.update!
151
- assert(text_state < @text_state, text_state <=> @text_state)
152
- end
153
- def test_same_word
154
- (p1 = Rpdf2txt::TextState.new).set_x -10000
155
- (p1 = Rpdf2txt::TextState.new).set_y 10000
156
- (p2 = Rpdf2txt::TextState.new).set_x -5000
157
- (p2 = Rpdf2txt::TextState.new).set_y 10000
158
- (p3 = Rpdf2txt::TextState.new).set_x 5000
159
- (p3 = Rpdf2txt::TextState.new).set_y 10000
160
- (p4 = Rpdf2txt::TextState.new).set_x 10000
161
- (p4 = Rpdf2txt::TextState.new).set_y 10000
162
- p1.set_font_size(10)
163
- p2.set_font_size(10)
164
- p3.set_font_size(10)
165
- p4.set_font_size(10)
166
- p1.update!
167
- p2.update!
168
- p3.update!
169
- p4.update!
170
- assert_equal(true, p1.same_word(p1))
171
- assert_equal(true, p1.same_word(p2))
172
- assert_equal(true, p1.same_word(p3))
173
- assert_equal(true, p1.same_word(p4))
174
- assert_equal(true, p2.same_word(p2))
175
- assert_equal(true, p2.same_word(p3))
176
- assert_equal(true, p2.same_word(p4))
177
- assert_equal(true, p3.same_word(p3))
178
- assert_equal(true, p3.same_word(p4))
179
- assert_equal(true, p4.same_word(p4))
180
- p1.set_y -10
181
- p1.update!
182
- assert_equal(true, p1.same_word(p1))
183
- assert_equal(false, p1.same_word(p2))
184
- assert_equal(false, p1.same_word(p3))
185
- assert_equal(false, p1.same_word(p4))
186
- end
187
- def test_same_line
188
- ts1 = Rpdf2txt::TextState.new
189
- ts1.set_y(210)
190
- ts1.set_font_size(10)
191
- ts1.update!
192
- assert_equal(210.000, ts1.y)
193
- assert_equal(200.000, ts1.y2)
70
+ def test_set
71
+ @text_state.set_x("42.7953")
72
+ @text_state.set_y("670.6528")
73
+ @text_state.update!
74
+ assert_equal(427953, (@text_state.x*10000).round)
75
+ assert_equal(6706528, (@text_state.y*10000).round)
76
+ end
77
+ def test_update_td
78
+ @text_state.set_x("100.1234")
79
+ @text_state.set_y("200.5678")
80
+ @text_state.update_x("1.2345")
81
+ @text_state.update_y("6.7890")
82
+ @text_state.update!
83
+ assert_equal(1013579, (@text_state.x*10000).to_i)
84
+ assert_equal(2073568, (@text_state.y*10000).to_i)
85
+ @text_state.update_x("-1.2345")
86
+ @text_state.update_y("-6.7890")
87
+ @text_state.update!
88
+ assert_equal(1001234, (@text_state.x*10000).to_i)
89
+ assert_equal(2005678, (@text_state.y*10000).to_i)
90
+ end
91
+ def test_update_tD
92
+ @text_state.set_x("100.1234")
93
+ @text_state.set_y("200.5678")
94
+ @text_state.set_lead("-6.7890")
95
+ @text_state.update_x("1.2345")
96
+ @text_state.update_y("6.7890")
97
+ @text_state.update!
98
+ assert_equal(-6789.0, @text_state.lead*1000)
99
+ assert_equal(1013579, (@text_state.x*10000).to_i)
100
+ assert_equal(2073568, (@text_state.y*10000).to_i)
101
+ @text_state.set_lead(-1.2345)
102
+ @text_state.set_lead(6.7890)
103
+ @text_state.update_x("-1.2345")
104
+ @text_state.update_y("-6.7890")
105
+ @text_state.update!
106
+ assert_equal(6789.0, @text_state.lead*1000)
107
+ assert_equal(1001234, (@text_state.x*10000).to_i)
108
+ assert_equal(2005678, (@text_state.y*10000).to_i)
109
+ end
110
+ def test_set_lead_tl
111
+ @text_state.set_lead("1.2345")
112
+ assert_equal(1234.5, @text_state.lead*1000)
113
+ @text_state.set_lead("-6.7890")
114
+ assert_equal(-6789.0, @text_state.lead*1000)
115
+ end
116
+ def test_step
117
+ @text_state.set_lead(-3.4567)
118
+ @text_state.set_y(200.1234)
119
+ @text_state.set_x(400.5678)
120
+ @text_state.set_txt('foo')
121
+ @text_state.advance_x
122
+ @text_state.update!
123
+ assert_equal(2001234, (@text_state.y * 10000).to_i)
124
+ assert_not_equal(4005678, (@text_state.x * 10000).to_i)
125
+ @text_state.step
126
+ @text_state.update!
127
+ assert_equal(1966667, (@text_state.y * 10000).to_i)
128
+ assert_equal(4005678, (@text_state.x * 10000).to_i)
129
+ end
130
+ def test_compare1
131
+ @text_state.set_font_size(0.0)
132
+ @text_state.set_x 100.1234
133
+ @text_state.set_y 200.5678
134
+ @text_state.update!
135
+ text_state = Rpdf2txt::TextState.new
136
+ text_state.set_font_size(0.0)
137
+ text_state.set_x 88.9012
138
+ text_state.set_y 250.3456
139
+ text_state.update!
140
+ assert(text_state > @text_state, text_state <=> @text_state)
141
+ end
142
+ def test_compare2
143
+ @text_state.set_font_size(10)
144
+ @text_state.set_x 100.1234
145
+ @text_state.set_y 200.5678
146
+ @text_state.update!
147
+ text_state = Rpdf2txt::TextState.new
148
+ text_state.set_font_size(10)
149
+ text_state.set_x 88.9012
150
+ text_state.set_y 200.5678
151
+ text_state.update!
152
+ assert(text_state < @text_state, text_state <=> @text_state)
153
+ end
154
+ def test_same_word
155
+ (p1 = Rpdf2txt::TextState.new).set_x -10000
156
+ (p1 = Rpdf2txt::TextState.new).set_y 10000
157
+ (p2 = Rpdf2txt::TextState.new).set_x -5000
158
+ (p2 = Rpdf2txt::TextState.new).set_y 10000
159
+ (p3 = Rpdf2txt::TextState.new).set_x 5000
160
+ (p3 = Rpdf2txt::TextState.new).set_y 10000
161
+ (p4 = Rpdf2txt::TextState.new).set_x 10000
162
+ (p4 = Rpdf2txt::TextState.new).set_y 10000
163
+ p1.set_font_size(10)
164
+ p2.set_font_size(10)
165
+ p3.set_font_size(10)
166
+ p4.set_font_size(10)
167
+ p1.update!
168
+ p2.update!
169
+ p3.update!
170
+ p4.update!
171
+ assert_equal(true, p1.same_word(p1))
172
+ assert_equal(true, p1.same_word(p2))
173
+ assert_equal(true, p1.same_word(p3))
174
+ assert_equal(true, p1.same_word(p4))
175
+ assert_equal(true, p2.same_word(p2))
176
+ assert_equal(true, p2.same_word(p3))
177
+ assert_equal(true, p2.same_word(p4))
178
+ assert_equal(true, p3.same_word(p3))
179
+ assert_equal(true, p3.same_word(p4))
180
+ assert_equal(true, p4.same_word(p4))
181
+ p1.set_y -10
182
+ p1.update!
183
+ assert_equal(true, p1.same_word(p1))
184
+ assert_equal(false, p1.same_word(p2))
185
+ assert_equal(false, p1.same_word(p3))
186
+ assert_equal(false, p1.same_word(p4))
187
+ end
188
+ def test_same_line
189
+ ts1 = Rpdf2txt::TextState.new
190
+ ts1.set_y(210)
191
+ ts1.set_font_size(10)
192
+ ts1.update!
193
+ assert_equal(210.000, ts1.y)
194
+ assert_equal(200.000, ts1.y2)
194
195
 
195
- ts2 = Rpdf2txt::TextState.new
196
- ts2.set_y(200)
197
- ts2.set_font_size(10)
198
- ts2.update!
199
- assert_equal(200.000, ts2.y)
200
- assert_equal(190.000, ts2.y2)
196
+ ts2 = Rpdf2txt::TextState.new
197
+ ts2.set_y(200)
198
+ ts2.set_font_size(10)
199
+ ts2.update!
200
+ assert_equal(200.000, ts2.y)
201
+ assert_equal(190.000, ts2.y2)
201
202
 
202
- # -----
203
- # ts1
204
- # ----- ----- => not same line
205
- # ts2
206
- # -----
207
- assert_equal(false, ts1.same_line(ts2))
208
- assert_equal(false, ts2.same_line(ts1))
203
+ # -----
204
+ # ts1
205
+ # ----- ----- => not same line
206
+ # ts2
207
+ # -----
208
+ assert_equal(false, ts1.same_line(ts2))
209
+ assert_equal(false, ts2.same_line(ts1))
209
210
 
210
- ts3 = Rpdf2txt::TextState.new
211
- ts3.set_y(205)
212
- ts3.set_font_size(10)
213
- ts3.update!
214
- assert_equal(205.000, ts3.y)
215
- assert_equal(195.000, ts3.y2)
216
-
217
- # -----
218
- # ts1 -----
219
- # ----- ts3 => same line
220
- # -----
221
- assert_equal(true, ts1.same_line(ts3))
222
- assert_equal(true, ts3.same_line(ts1))
211
+ ts3 = Rpdf2txt::TextState.new
212
+ ts3.set_y(205)
213
+ ts3.set_font_size(10)
214
+ ts3.update!
215
+ assert_equal(205.000, ts3.y)
216
+ assert_equal(195.000, ts3.y2)
223
217
 
224
- # -----
225
- # ----- ts3 => same line
226
- # ts2 -----
227
- # -----
228
- assert_equal(true, ts2.same_line(ts3))
229
- assert_equal(true, ts3.same_line(ts2))
218
+ # -----
219
+ # ts1 -----
220
+ # ----- ts3 => same line
221
+ # -----
222
+ assert_equal(true, ts1.same_line(ts3))
223
+ assert_equal(true, ts3.same_line(ts1))
230
224
 
231
- ts4 = Rpdf2txt::TextState.new
232
- ts4.set_y(210)
233
- ts4.set_font_size(30)
234
- ts4.update!
235
- assert_equal(210.000, ts4.y)
236
- assert_equal(180.000, ts4.y2)
225
+ # -----
226
+ # ----- ts3 => same line
227
+ # ts2 -----
228
+ # -----
229
+ assert_equal(true, ts2.same_line(ts3))
230
+ assert_equal(true, ts3.same_line(ts2))
237
231
 
238
- # -----
239
- # -----
240
- # ts1 ts4 => same line
241
- # -----
242
- # -----
243
- assert_equal(true, ts1.same_line(ts4))
244
- assert_equal(true, ts4.same_line(ts1))
245
- end
246
- def test_set_txt
247
- @text_state.set_txt("Hello World")
248
- assert_in_delta(5.612, @text_state.w, 0.001)
249
- end
250
- def test_set_char_spacing
251
- assert_equal(0, @text_state.char_spacing)
252
- @text_state.set_char_spacing('-0.456 Tc')
253
- assert_equal(-456, @text_state.char_spacing)
254
- @text_state.set_char_spacing('0.789 Tc')
255
- assert_equal(789, @text_state.char_spacing)
256
- end
257
- def test_same_word2
258
- (p1 = Rpdf2txt::TextState.new).set_x -10000
259
- (p1 = Rpdf2txt::TextState.new).set_y 10000
260
- (p2 = Rpdf2txt::TextState.new).set_x -5000
261
- (p2 = Rpdf2txt::TextState.new).set_y 10000
262
- (p3 = Rpdf2txt::TextState.new).set_x 5000
263
- (p3 = Rpdf2txt::TextState.new).set_y 10000
264
- (p4 = Rpdf2txt::TextState.new).set_x 10000
265
- (p4 = Rpdf2txt::TextState.new).set_y 10000
266
- p1.set_font_size(10.0)
267
- p2.set_font_size(10.0)
268
- p3.set_font_size(10.0)
269
- p4.set_font_size(10.0)
270
- chars = %w(a b c)
271
- [p1,p2,p3,p4].each { |text_state|
272
- text_state.set_font(@font)
273
- text_state.set_txt(chars.join)
274
- text_state.update!
275
- chars = chars.collect { |char| char.next }
276
- }
277
- assert_equal(true, p1.same_word(p1))
278
- assert_equal(true, p1.same_word(p2))
279
- assert_equal(true, p1.same_word(p3))
280
- assert_equal(true, p1.same_word(p4))
281
- assert_equal(true, p2.same_word(p2))
282
- assert_equal(true, p2.same_word(p3))
283
- assert_equal(true, p2.same_word(p4))
284
- assert_equal(true, p3.same_word(p3))
285
- assert_equal(true, p3.same_word(p4))
286
- assert_equal(true, p4.same_word(p4))
287
- p1.set_y -10
288
- p1.update!
289
- assert_equal(true, p1.same_word(p1))
290
- assert_equal(false, p1.same_word(p2))
291
- assert_equal(false, p1.same_word(p3))
292
- assert_equal(false, p1.same_word(p4))
293
- end
232
+ ts4 = Rpdf2txt::TextState.new
233
+ ts4.set_y(210)
234
+ ts4.set_font_size(30)
235
+ ts4.update!
236
+ assert_equal(210.000, ts4.y)
237
+ assert_equal(180.000, ts4.y2)
238
+
239
+ # -----
240
+ # -----
241
+ # ts1 ts4 => same line
242
+ # -----
243
+ # -----
244
+ assert_equal(true, ts1.same_line(ts4))
245
+ assert_equal(true, ts4.same_line(ts1))
246
+ end
247
+ def test_set_txt
248
+ @text_state.set_txt("Hello World")
249
+ assert_in_delta(5.612, @text_state.w, 0.001)
250
+ end
251
+ def test_set_char_spacing
252
+ assert_equal(0, @text_state.char_spacing)
253
+ @text_state.set_char_spacing('-0.456 Tc')
254
+ assert_equal(-456, @text_state.char_spacing)
255
+ @text_state.set_char_spacing('0.789 Tc')
256
+ assert_equal(789, @text_state.char_spacing)
257
+ end
258
+ def test_same_word2
259
+ (p1 = Rpdf2txt::TextState.new).set_x -10000
260
+ (p1 = Rpdf2txt::TextState.new).set_y 10000
261
+ (p2 = Rpdf2txt::TextState.new).set_x -5000
262
+ (p2 = Rpdf2txt::TextState.new).set_y 10000
263
+ (p3 = Rpdf2txt::TextState.new).set_x 5000
264
+ (p3 = Rpdf2txt::TextState.new).set_y 10000
265
+ (p4 = Rpdf2txt::TextState.new).set_x 10000
266
+ (p4 = Rpdf2txt::TextState.new).set_y 10000
267
+ p1.set_font_size(10.0)
268
+ p2.set_font_size(10.0)
269
+ p3.set_font_size(10.0)
270
+ p4.set_font_size(10.0)
271
+ chars = %w(a b c)
272
+ [p1,p2,p3,p4].each { |text_state|
273
+ text_state.set_font(@font)
274
+ text_state.set_txt(chars.join)
275
+ text_state.update!
276
+ chars = chars.collect { |char| char.next }
277
+ }
278
+ assert_equal(true, p1.same_word(p1))
279
+ assert_equal(true, p1.same_word(p2))
280
+ assert_equal(true, p1.same_word(p3))
281
+ assert_equal(true, p1.same_word(p4))
282
+ assert_equal(true, p2.same_word(p2))
283
+ assert_equal(true, p2.same_word(p3))
284
+ assert_equal(true, p2.same_word(p4))
285
+ assert_equal(true, p3.same_word(p3))
286
+ assert_equal(true, p3.same_word(p4))
287
+ assert_equal(true, p4.same_word(p4))
288
+ p1.set_y -10
289
+ p1.update!
290
+ assert_equal(true, p1.same_word(p1))
291
+ assert_equal(false, p1.same_word(p2))
292
+ assert_equal(false, p1.same_word(p3))
293
+ assert_equal(false, p1.same_word(p4))
294
+ end
294
295
  def test_char_width
295
296
  assert_equal(0.556, @text_state.char_width('a'))
296
297
  assert_equal(0.278, @text_state.char_width(' '))
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpdf2txt
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
5
- prerelease: false
4
+ hash: 57
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 2
10
- version: 0.8.2
9
+ - 3
10
+ version: 0.8.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Masaomi Hatakeyama, Zeno R.R. Davatz
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-15 00:00:00 +01:00
18
+ date: 2012-01-05 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 47
29
+ hash: 41
30
30
  segments:
31
31
  - 2
32
- - 8
33
- - 0
34
- version: 2.8.0
32
+ - 9
33
+ - 1
34
+ version: 2.9.1
35
35
  type: :development
36
36
  version_requirements: *id001
37
37
  description: rpdf2txt will turn a PDF-file into a textfile.
@@ -56,7 +56,6 @@ files:
56
56
  - README.txt
57
57
  - Rakefile
58
58
  - bin/rpdf2txt
59
- - config.save
60
59
  - install.rb
61
60
  - lib/rpdf2txt-rockit/base_extensions.rb
62
61
  - lib/rpdf2txt-rockit/bootstrap.rb
@@ -88,9 +87,6 @@ files:
88
87
  - lib/rpdf2txt/data/cmap.rb
89
88
  - lib/rpdf2txt/data/cmap_range.grammar
90
89
  - lib/rpdf2txt/data/cmap_range.rb
91
- - lib/rpdf2txt/data/_cmap.grammar
92
- - lib/rpdf2txt/data/_cmap_range.grammar
93
- - lib/rpdf2txt/data/_pdfattributes.grammar
94
90
  - lib/rpdf2txt/data/fonts/Courier-Bold.afm
95
91
  - lib/rpdf2txt/data/fonts/Courier-BoldOblique.afm
96
92
  - lib/rpdf2txt/data/fonts/Courier-Oblique.afm
@@ -176,6 +172,8 @@ files:
176
172
  - usage-en.txt
177
173
  - user-stories/UserStories_Rpdf2Txt.txt
178
174
  - user-stories/documents/swissmedicjournal/04_2004.pdf
175
+ - test/test_object.rb
176
+ - .gemtest
179
177
  has_rdoc: true
180
178
  homepage: http://scm.ywesee.com/?p=rpdf2txt/.git;a=summary
181
179
  licenses: []
@@ -207,11 +205,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
205
  requirements: []
208
206
 
209
207
  rubyforge_project: rpdf2txt
210
- rubygems_version: 1.3.7
208
+ rubygems_version: 1.4.2
211
209
  signing_key:
212
210
  specification_version: 3
213
211
  summary: rpdf2txt will turn a PDF-file into a textfile.
214
212
  test_files:
213
+ - test/test_object.rb
215
214
  - test/test_pdf_object.rb
216
215
  - test/test_pdf_parser.rb
217
216
  - test/test_pdf_text.rb
data/config.save DELETED
@@ -1,12 +0,0 @@
1
- site-ruby=$prefix/lib/ruby/site_ruby/1.8
2
- prefix=/usr
3
- ruby-prog=/usr/bin/ruby18
4
- ruby-path=/usr/bin/ruby18
5
- make-prog=make
6
- site-ruby-common=$prefix/lib/ruby/site_ruby
7
- rb-dir=$site-ruby
8
- without-ext=no
9
- std-ruby=$prefix/lib/ruby/1.8
10
- bin-dir=$prefix/bin
11
- data-dir=$prefix/share
12
- so-dir=$prefix/lib/ruby/site_ruby/1.8/i686-linux
@@ -1,11 +0,0 @@
1
- Grammar CMap
2
- Tokens
3
- SPACE = /\s+/n [:Skip]
4
- HEXSNIPPET = /[0-9A-F]+/in
5
- Productions
6
- HexArray -> RangeDef+
7
- [^: values ]
8
- RangeDef -> HexElement HexElement
9
- [: source, target ]
10
- HexElement -> '<' HEXSNIPPET '>'
11
- [^: _, hexsnip, _ ]
@@ -1,15 +0,0 @@
1
- Grammar CMap
2
- Tokens
3
- SPACE = /\s+/n [:Skip]
4
- HEXSNIPPET = /[0-9A-F]+/in
5
- Productions
6
- HexArray -> RangeDef+
7
- [^: values ]
8
- RangeDef -> HexElement HexElement HexElement
9
- [: start, stop, offset ]
10
- | HexElement HexElement Explicit
11
- [: start, stop, explicit ]
12
- Explicit -> '[' HexElement+ ']'
13
- [^: _, explicit, _ ]
14
- HexElement -> '<' HEXSNIPPET '>'
15
- [^: _, hexsnip, _ ]
@@ -1,32 +0,0 @@
1
- Grammar PdfAttributes
2
- Tokens
3
- IDENTIFIER = /^\/[\w:+\#\-\.]*(, ?[\w:+\#\-\.]*)*/n
4
- NUMERIC = /-?[0-9]+([.,][0-9]+)?/n
5
- REFERENCE = /[0-9]+\s+[0-9]+\s+R/n
6
- WORD = /[a-z\.]{2,}/in
7
- SPACE = /\s+/mn [:Skip]
8
- COMMENT = /%[^%]*%/mn [:Skip]
9
- FILEIDENTIFIER = /<[a-zA-Z0-9\n]+>/n
10
- Productions
11
- Expr -> IDENTIFIER [^: val]
12
- | Hash [^: val]
13
- | Array [^: val]
14
- | REFERENCE [^: val]
15
- | NUMERIC [^: val]
16
- | Text [^: val]
17
- | Date [^: val]
18
- | WORD [^: val]
19
- | FILEIDENTIFIER [^: val]
20
- Array -> '[' ArrayElements ']'
21
- [: _, values, _]
22
- | '[' ']'
23
- [: _, _]
24
- ArrayElements -> ArrayElement+
25
- [^: values]
26
- ArrayElement -> (Array|Hash|NUMERIC|IDENTIFIER|REFERENCE|WORD|FILEIDENTIFIER|Text)
27
- [^: _]
28
- Hash -> '<<' (IDENTIFIER Expr)* '>>'
29
- [: _, pairs, _]
30
- Date -> '(D:' /[\d+']+/n ')'
31
- Text -> /\(([^\)\\]|\\[\(\)\\]?)*?\)/n
32
- [: text]