rpdf2txt 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/History.txt +4 -0
- data/Manifest.txt +0 -4
- data/README.txt +16 -3
- data/bin/rpdf2txt +4 -1
- data/lib/rpdf2txt/data/cmap.rb +10 -9
- data/lib/rpdf2txt/data/cmap_range.rb +13 -12
- data/lib/rpdf2txt/data/pdfattributes.rb +14 -13
- data/lib/rpdf2txt/data/pdftext.rb +19 -18
- data/lib/rpdf2txt/object.rb +68 -13
- data/lib/rpdf2txt/parser.rb +6 -2
- data/lib/rpdf2txt/text.rb +1 -2
- data/lib/rpdf2txt/text_state.rb +10 -2
- data/lib/rpdf2txt-rockit/rockit.rb +1 -1
- data/lib/rpdf2txt-rockit/rockit_grammars_parser.rb +1 -0
- data/lib/rpdf2txt-rockit/token.rb +1 -0
- data/test/mock.rb +19 -11
- data/test/test_object.rb +33 -0
- data/test/test_pdf_object.rb +25 -24
- data/test/test_pdf_parser.rb +8 -5
- data/test/test_pdf_text.rb +11 -10
- data/test/test_space_bug_05_2004.rb +2 -1
- data/test/test_stream.rb +6 -5
- data/test/test_text_state.rb +220 -219
- metadata +13 -14
- data/config.save +0 -12
- data/lib/rpdf2txt/data/_cmap.grammar +0 -11
- data/lib/rpdf2txt/data/_cmap_range.grammar +0 -15
- data/lib/rpdf2txt/data/_pdfattributes.grammar +0 -32
data/test/test_text_state.rb
CHANGED
@@ -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
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
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
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
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
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
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
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
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
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
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
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
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
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 57
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
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:
|
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:
|
29
|
+
hash: 41
|
30
30
|
segments:
|
31
31
|
- 2
|
32
|
-
-
|
33
|
-
-
|
34
|
-
version: 2.
|
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.
|
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,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]
|