rmasalov-surpass 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/LICENSE.txt +110 -0
- data/README.txt +26 -0
- data/Rakefile +36 -0
- data/bin/surpass +8 -0
- data/lib/surpass.rb +64 -0
- data/lib/surpass/ExcelFormula.g +393 -0
- data/lib/surpass/ExcelFormula.tokens +32 -0
- data/lib/surpass/ExcelFormulaLexer.rb +1490 -0
- data/lib/surpass/ExcelFormulaParser.rb +1822 -0
- data/lib/surpass/biff_record.rb +2173 -0
- data/lib/surpass/bitmap.rb +218 -0
- data/lib/surpass/chart.rb +16 -0
- data/lib/surpass/column.rb +40 -0
- data/lib/surpass/document.rb +406 -0
- data/lib/surpass/excel_magic.rb +1016 -0
- data/lib/surpass/formatting.rb +607 -0
- data/lib/surpass/formula.rb +25 -0
- data/lib/surpass/row.rb +173 -0
- data/lib/surpass/style.rb +194 -0
- data/lib/surpass/surpass_cell.rb +187 -0
- data/lib/surpass/tokens.txt +2 -0
- data/lib/surpass/utilities.rb +118 -0
- data/lib/surpass/workbook.rb +207 -0
- data/lib/surpass/worksheet.rb +574 -0
- data/rmasalov-surpass +0 -0
- data/surpass.gemspec +39 -0
- metadata +120 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
GE=8
|
2
|
+
LT=7
|
3
|
+
NUM_CONST=21
|
4
|
+
PERCENT=16
|
5
|
+
REF2D=22
|
6
|
+
CONCAT=10
|
7
|
+
RP=25
|
8
|
+
LP=24
|
9
|
+
INT_CONST=20
|
10
|
+
STR_CONST=19
|
11
|
+
POWER=15
|
12
|
+
SUB=12
|
13
|
+
FUNC_CHOOSE=30
|
14
|
+
SEMICOLON=28
|
15
|
+
BANG=26
|
16
|
+
TRUE_CONST=17
|
17
|
+
MUL=13
|
18
|
+
ALPHA=34
|
19
|
+
COLON=23
|
20
|
+
NAME=31
|
21
|
+
FALSE_CONST=18
|
22
|
+
WS=35
|
23
|
+
COMMA=29
|
24
|
+
GT=6
|
25
|
+
DIGIT=33
|
26
|
+
EQ=4
|
27
|
+
DIV=14
|
28
|
+
FUNC_IF=27
|
29
|
+
QUOTENAME=32
|
30
|
+
LE=9
|
31
|
+
NE=5
|
32
|
+
ADD=11
|
@@ -0,0 +1,1490 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# ExcelFormula.g
|
4
|
+
#
|
5
|
+
# Generated using ANTLR version: 3.2.1-SNAPSHOT Dec 18, 2009 04:29:28
|
6
|
+
# Ruby runtime library version: 1.3.1
|
7
|
+
# Input grammar file: ExcelFormula.g
|
8
|
+
# Generated at: 2010-06-13 10:19:27
|
9
|
+
#
|
10
|
+
|
11
|
+
# ~~~> start load path setup
|
12
|
+
this_directory = File.expand_path( File.dirname( __FILE__ ) )
|
13
|
+
$:.unshift( this_directory ) unless $:.include?( this_directory )
|
14
|
+
|
15
|
+
antlr_load_failed = proc do
|
16
|
+
load_path = $LOAD_PATH.map { |dir| ' - ' << dir }.join( $/ )
|
17
|
+
raise LoadError, <<-END.strip!
|
18
|
+
|
19
|
+
Failed to load the ANTLR3 runtime library (version 1.3.1):
|
20
|
+
|
21
|
+
Ensure the library has been installed on your system and is available
|
22
|
+
on the load path. If rubygems is available on your system, this can
|
23
|
+
be done with the command:
|
24
|
+
|
25
|
+
gem install antlr3
|
26
|
+
|
27
|
+
Current load path:
|
28
|
+
#{ load_path }
|
29
|
+
|
30
|
+
END
|
31
|
+
end
|
32
|
+
|
33
|
+
defined?(ANTLR3) or begin
|
34
|
+
|
35
|
+
# 1: try to load the ruby antlr3 runtime library from the system path
|
36
|
+
require 'antlr3'
|
37
|
+
|
38
|
+
rescue LoadError
|
39
|
+
|
40
|
+
# 2: try to load rubygems if it isn't already loaded
|
41
|
+
defined?(Gem) or begin
|
42
|
+
require 'rubygems'
|
43
|
+
rescue LoadError
|
44
|
+
antlr_load_failed.call
|
45
|
+
end
|
46
|
+
|
47
|
+
# 3: try to activate the antlr3 gem
|
48
|
+
begin
|
49
|
+
Gem.activate( 'antlr3', '= 1.3.1' )
|
50
|
+
rescue Gem::LoadError
|
51
|
+
antlr_load_failed.call
|
52
|
+
end
|
53
|
+
|
54
|
+
require 'antlr3'
|
55
|
+
|
56
|
+
end
|
57
|
+
# <~~~ end load path setup
|
58
|
+
|
59
|
+
|
60
|
+
module ExcelFormula
|
61
|
+
# TokenData defines all of the token type integer values
|
62
|
+
# as constants, which will be included in all
|
63
|
+
# ANTLR-generated recognizers.
|
64
|
+
const_defined?(:TokenData) or TokenData = ANTLR3::TokenScheme.new
|
65
|
+
|
66
|
+
module TokenData
|
67
|
+
|
68
|
+
# define the token constants
|
69
|
+
define_tokens(:GE => 8, :LT => 7, :NUM_CONST => 21, :PERCENT => 16,
|
70
|
+
:REF2D => 22, :CONCAT => 10, :RP => 25, :LP => 24, :INT_CONST => 20,
|
71
|
+
:STR_CONST => 19, :POWER => 15, :SUB => 12, :FUNC_CHOOSE => 30,
|
72
|
+
:SEMICOLON => 28, :BANG => 26, :TRUE_CONST => 17, :EOF => -1,
|
73
|
+
:MUL => 13, :ALPHA => 34, :COLON => 23, :FALSE_CONST => 18,
|
74
|
+
:NAME => 31, :WS => 35, :COMMA => 29, :GT => 6, :DIGIT => 33,
|
75
|
+
:DIV => 14, :EQ => 4, :FUNC_IF => 27, :QUOTENAME => 32,
|
76
|
+
:LE => 9, :ADD => 11, :NE => 5)
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
class Lexer < ANTLR3::Lexer
|
82
|
+
@grammar_home = ExcelFormula
|
83
|
+
include TokenData
|
84
|
+
|
85
|
+
begin
|
86
|
+
generated_using( "ExcelFormula.g", "3.2.1-SNAPSHOT Dec 18, 2009 04:29:28", "1.3.1" )
|
87
|
+
rescue NoMethodError => error
|
88
|
+
error.name.to_sym == :generated_using or raise
|
89
|
+
end
|
90
|
+
|
91
|
+
RULE_NAMES = ["EQ", "LT", "GT", "NE", "LE", "GE", "ADD", "SUB", "MUL",
|
92
|
+
"DIV", "COLON", "SEMICOLON", "COMMA", "LP", "RP", "CONCAT",
|
93
|
+
"PERCENT", "POWER", "BANG", "DIGIT", "INT_CONST", "NUM_CONST",
|
94
|
+
"STR_CONST", "REF2D", "TRUE_CONST", "FALSE_CONST", "QUOTENAME",
|
95
|
+
"FUNC_IF", "FUNC_CHOOSE", "ALPHA", "NAME", "WS"].freeze
|
96
|
+
RULE_METHODS = [:eq!, :lt!, :gt!, :ne!, :le!, :ge!, :add!, :sub!, :mul!,
|
97
|
+
:div!, :colon!, :semicolon!, :comma!, :lp!, :rp!, :concat!,
|
98
|
+
:percent!, :power!, :bang!, :digit!, :int_const!, :num_const!,
|
99
|
+
:str_const!, :ref_2_d!, :true_const!, :false_const!,
|
100
|
+
:quotename!, :func_if!, :func_choose!, :alpha!, :name!,
|
101
|
+
:ws!].freeze
|
102
|
+
|
103
|
+
|
104
|
+
def initialize(input=nil, options = {})
|
105
|
+
super(input, options)
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
# - - - - - - - - - - - lexer rules - - - - - - - - - - - -
|
110
|
+
# lexer rule eq! (EQ)
|
111
|
+
# (in ExcelFormula.g)
|
112
|
+
def eq!
|
113
|
+
# -> uncomment the next line to manually enable rule tracing
|
114
|
+
# trace_in(__method__, 1)
|
115
|
+
|
116
|
+
type = EQ
|
117
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
118
|
+
|
119
|
+
|
120
|
+
# - - - - main rule block - - - -
|
121
|
+
# at line 340:5: '='
|
122
|
+
match(?=)
|
123
|
+
|
124
|
+
|
125
|
+
@state.type = type
|
126
|
+
@state.channel = channel
|
127
|
+
|
128
|
+
ensure
|
129
|
+
# -> uncomment the next line to manually enable rule tracing
|
130
|
+
# trace_out(__method__, 1)
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
# lexer rule lt! (LT)
|
135
|
+
# (in ExcelFormula.g)
|
136
|
+
def lt!
|
137
|
+
# -> uncomment the next line to manually enable rule tracing
|
138
|
+
# trace_in(__method__, 2)
|
139
|
+
|
140
|
+
type = LT
|
141
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
142
|
+
|
143
|
+
|
144
|
+
# - - - - main rule block - - - -
|
145
|
+
# at line 341:5: '<'
|
146
|
+
match(?<)
|
147
|
+
|
148
|
+
|
149
|
+
@state.type = type
|
150
|
+
@state.channel = channel
|
151
|
+
|
152
|
+
ensure
|
153
|
+
# -> uncomment the next line to manually enable rule tracing
|
154
|
+
# trace_out(__method__, 2)
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
# lexer rule gt! (GT)
|
159
|
+
# (in ExcelFormula.g)
|
160
|
+
def gt!
|
161
|
+
# -> uncomment the next line to manually enable rule tracing
|
162
|
+
# trace_in(__method__, 3)
|
163
|
+
|
164
|
+
type = GT
|
165
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
166
|
+
|
167
|
+
|
168
|
+
# - - - - main rule block - - - -
|
169
|
+
# at line 342:5: '>'
|
170
|
+
match(?>)
|
171
|
+
|
172
|
+
|
173
|
+
@state.type = type
|
174
|
+
@state.channel = channel
|
175
|
+
|
176
|
+
ensure
|
177
|
+
# -> uncomment the next line to manually enable rule tracing
|
178
|
+
# trace_out(__method__, 3)
|
179
|
+
|
180
|
+
end
|
181
|
+
|
182
|
+
# lexer rule ne! (NE)
|
183
|
+
# (in ExcelFormula.g)
|
184
|
+
def ne!
|
185
|
+
# -> uncomment the next line to manually enable rule tracing
|
186
|
+
# trace_in(__method__, 4)
|
187
|
+
|
188
|
+
type = NE
|
189
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
190
|
+
|
191
|
+
|
192
|
+
# - - - - main rule block - - - -
|
193
|
+
# at line 343:5: '<>'
|
194
|
+
match("<>")
|
195
|
+
|
196
|
+
|
197
|
+
@state.type = type
|
198
|
+
@state.channel = channel
|
199
|
+
|
200
|
+
ensure
|
201
|
+
# -> uncomment the next line to manually enable rule tracing
|
202
|
+
# trace_out(__method__, 4)
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
# lexer rule le! (LE)
|
207
|
+
# (in ExcelFormula.g)
|
208
|
+
def le!
|
209
|
+
# -> uncomment the next line to manually enable rule tracing
|
210
|
+
# trace_in(__method__, 5)
|
211
|
+
|
212
|
+
type = LE
|
213
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
214
|
+
|
215
|
+
|
216
|
+
# - - - - main rule block - - - -
|
217
|
+
# at line 344:5: '<='
|
218
|
+
match("<=")
|
219
|
+
|
220
|
+
|
221
|
+
@state.type = type
|
222
|
+
@state.channel = channel
|
223
|
+
|
224
|
+
ensure
|
225
|
+
# -> uncomment the next line to manually enable rule tracing
|
226
|
+
# trace_out(__method__, 5)
|
227
|
+
|
228
|
+
end
|
229
|
+
|
230
|
+
# lexer rule ge! (GE)
|
231
|
+
# (in ExcelFormula.g)
|
232
|
+
def ge!
|
233
|
+
# -> uncomment the next line to manually enable rule tracing
|
234
|
+
# trace_in(__method__, 6)
|
235
|
+
|
236
|
+
type = GE
|
237
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
238
|
+
|
239
|
+
|
240
|
+
# - - - - main rule block - - - -
|
241
|
+
# at line 345:5: '>='
|
242
|
+
match(">=")
|
243
|
+
|
244
|
+
|
245
|
+
@state.type = type
|
246
|
+
@state.channel = channel
|
247
|
+
|
248
|
+
ensure
|
249
|
+
# -> uncomment the next line to manually enable rule tracing
|
250
|
+
# trace_out(__method__, 6)
|
251
|
+
|
252
|
+
end
|
253
|
+
|
254
|
+
# lexer rule add! (ADD)
|
255
|
+
# (in ExcelFormula.g)
|
256
|
+
def add!
|
257
|
+
# -> uncomment the next line to manually enable rule tracing
|
258
|
+
# trace_in(__method__, 7)
|
259
|
+
|
260
|
+
type = ADD
|
261
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
262
|
+
|
263
|
+
|
264
|
+
# - - - - main rule block - - - -
|
265
|
+
# at line 347:6: '+'
|
266
|
+
match(?+)
|
267
|
+
|
268
|
+
|
269
|
+
@state.type = type
|
270
|
+
@state.channel = channel
|
271
|
+
|
272
|
+
ensure
|
273
|
+
# -> uncomment the next line to manually enable rule tracing
|
274
|
+
# trace_out(__method__, 7)
|
275
|
+
|
276
|
+
end
|
277
|
+
|
278
|
+
# lexer rule sub! (SUB)
|
279
|
+
# (in ExcelFormula.g)
|
280
|
+
def sub!
|
281
|
+
# -> uncomment the next line to manually enable rule tracing
|
282
|
+
# trace_in(__method__, 8)
|
283
|
+
|
284
|
+
type = SUB
|
285
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
286
|
+
|
287
|
+
|
288
|
+
# - - - - main rule block - - - -
|
289
|
+
# at line 348:6: '-'
|
290
|
+
match(?-)
|
291
|
+
|
292
|
+
|
293
|
+
@state.type = type
|
294
|
+
@state.channel = channel
|
295
|
+
|
296
|
+
ensure
|
297
|
+
# -> uncomment the next line to manually enable rule tracing
|
298
|
+
# trace_out(__method__, 8)
|
299
|
+
|
300
|
+
end
|
301
|
+
|
302
|
+
# lexer rule mul! (MUL)
|
303
|
+
# (in ExcelFormula.g)
|
304
|
+
def mul!
|
305
|
+
# -> uncomment the next line to manually enable rule tracing
|
306
|
+
# trace_in(__method__, 9)
|
307
|
+
|
308
|
+
type = MUL
|
309
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
310
|
+
|
311
|
+
|
312
|
+
# - - - - main rule block - - - -
|
313
|
+
# at line 349:6: '*'
|
314
|
+
match(?*)
|
315
|
+
|
316
|
+
|
317
|
+
@state.type = type
|
318
|
+
@state.channel = channel
|
319
|
+
|
320
|
+
ensure
|
321
|
+
# -> uncomment the next line to manually enable rule tracing
|
322
|
+
# trace_out(__method__, 9)
|
323
|
+
|
324
|
+
end
|
325
|
+
|
326
|
+
# lexer rule div! (DIV)
|
327
|
+
# (in ExcelFormula.g)
|
328
|
+
def div!
|
329
|
+
# -> uncomment the next line to manually enable rule tracing
|
330
|
+
# trace_in(__method__, 10)
|
331
|
+
|
332
|
+
type = DIV
|
333
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
334
|
+
|
335
|
+
|
336
|
+
# - - - - main rule block - - - -
|
337
|
+
# at line 350:6: '/'
|
338
|
+
match(?/)
|
339
|
+
|
340
|
+
|
341
|
+
@state.type = type
|
342
|
+
@state.channel = channel
|
343
|
+
|
344
|
+
ensure
|
345
|
+
# -> uncomment the next line to manually enable rule tracing
|
346
|
+
# trace_out(__method__, 10)
|
347
|
+
|
348
|
+
end
|
349
|
+
|
350
|
+
# lexer rule colon! (COLON)
|
351
|
+
# (in ExcelFormula.g)
|
352
|
+
def colon!
|
353
|
+
# -> uncomment the next line to manually enable rule tracing
|
354
|
+
# trace_in(__method__, 11)
|
355
|
+
|
356
|
+
type = COLON
|
357
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
358
|
+
|
359
|
+
|
360
|
+
# - - - - main rule block - - - -
|
361
|
+
# at line 352:8: ':'
|
362
|
+
match(?:)
|
363
|
+
|
364
|
+
|
365
|
+
@state.type = type
|
366
|
+
@state.channel = channel
|
367
|
+
|
368
|
+
ensure
|
369
|
+
# -> uncomment the next line to manually enable rule tracing
|
370
|
+
# trace_out(__method__, 11)
|
371
|
+
|
372
|
+
end
|
373
|
+
|
374
|
+
# lexer rule semicolon! (SEMICOLON)
|
375
|
+
# (in ExcelFormula.g)
|
376
|
+
def semicolon!
|
377
|
+
# -> uncomment the next line to manually enable rule tracing
|
378
|
+
# trace_in(__method__, 12)
|
379
|
+
|
380
|
+
type = SEMICOLON
|
381
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
382
|
+
|
383
|
+
|
384
|
+
# - - - - main rule block - - - -
|
385
|
+
# at line 353:12: ';'
|
386
|
+
match(?;)
|
387
|
+
|
388
|
+
|
389
|
+
@state.type = type
|
390
|
+
@state.channel = channel
|
391
|
+
|
392
|
+
ensure
|
393
|
+
# -> uncomment the next line to manually enable rule tracing
|
394
|
+
# trace_out(__method__, 12)
|
395
|
+
|
396
|
+
end
|
397
|
+
|
398
|
+
# lexer rule comma! (COMMA)
|
399
|
+
# (in ExcelFormula.g)
|
400
|
+
def comma!
|
401
|
+
# -> uncomment the next line to manually enable rule tracing
|
402
|
+
# trace_in(__method__, 13)
|
403
|
+
|
404
|
+
type = COMMA
|
405
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
406
|
+
|
407
|
+
|
408
|
+
# - - - - main rule block - - - -
|
409
|
+
# at line 354:8: ','
|
410
|
+
match(?,)
|
411
|
+
|
412
|
+
|
413
|
+
@state.type = type
|
414
|
+
@state.channel = channel
|
415
|
+
|
416
|
+
ensure
|
417
|
+
# -> uncomment the next line to manually enable rule tracing
|
418
|
+
# trace_out(__method__, 13)
|
419
|
+
|
420
|
+
end
|
421
|
+
|
422
|
+
# lexer rule lp! (LP)
|
423
|
+
# (in ExcelFormula.g)
|
424
|
+
def lp!
|
425
|
+
# -> uncomment the next line to manually enable rule tracing
|
426
|
+
# trace_in(__method__, 14)
|
427
|
+
|
428
|
+
type = LP
|
429
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
430
|
+
|
431
|
+
|
432
|
+
# - - - - main rule block - - - -
|
433
|
+
# at line 356:5: '('
|
434
|
+
match(?()
|
435
|
+
|
436
|
+
|
437
|
+
@state.type = type
|
438
|
+
@state.channel = channel
|
439
|
+
|
440
|
+
ensure
|
441
|
+
# -> uncomment the next line to manually enable rule tracing
|
442
|
+
# trace_out(__method__, 14)
|
443
|
+
|
444
|
+
end
|
445
|
+
|
446
|
+
# lexer rule rp! (RP)
|
447
|
+
# (in ExcelFormula.g)
|
448
|
+
def rp!
|
449
|
+
# -> uncomment the next line to manually enable rule tracing
|
450
|
+
# trace_in(__method__, 15)
|
451
|
+
|
452
|
+
type = RP
|
453
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
454
|
+
|
455
|
+
|
456
|
+
# - - - - main rule block - - - -
|
457
|
+
# at line 357:5: ')'
|
458
|
+
match(?))
|
459
|
+
|
460
|
+
|
461
|
+
@state.type = type
|
462
|
+
@state.channel = channel
|
463
|
+
|
464
|
+
ensure
|
465
|
+
# -> uncomment the next line to manually enable rule tracing
|
466
|
+
# trace_out(__method__, 15)
|
467
|
+
|
468
|
+
end
|
469
|
+
|
470
|
+
# lexer rule concat! (CONCAT)
|
471
|
+
# (in ExcelFormula.g)
|
472
|
+
def concat!
|
473
|
+
# -> uncomment the next line to manually enable rule tracing
|
474
|
+
# trace_in(__method__, 16)
|
475
|
+
|
476
|
+
type = CONCAT
|
477
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
478
|
+
|
479
|
+
|
480
|
+
# - - - - main rule block - - - -
|
481
|
+
# at line 358:9: '&'
|
482
|
+
match(?&)
|
483
|
+
|
484
|
+
|
485
|
+
@state.type = type
|
486
|
+
@state.channel = channel
|
487
|
+
|
488
|
+
ensure
|
489
|
+
# -> uncomment the next line to manually enable rule tracing
|
490
|
+
# trace_out(__method__, 16)
|
491
|
+
|
492
|
+
end
|
493
|
+
|
494
|
+
# lexer rule percent! (PERCENT)
|
495
|
+
# (in ExcelFormula.g)
|
496
|
+
def percent!
|
497
|
+
# -> uncomment the next line to manually enable rule tracing
|
498
|
+
# trace_in(__method__, 17)
|
499
|
+
|
500
|
+
type = PERCENT
|
501
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
502
|
+
|
503
|
+
|
504
|
+
# - - - - main rule block - - - -
|
505
|
+
# at line 359:10: '\\%'
|
506
|
+
match(?\%)
|
507
|
+
|
508
|
+
|
509
|
+
@state.type = type
|
510
|
+
@state.channel = channel
|
511
|
+
|
512
|
+
ensure
|
513
|
+
# -> uncomment the next line to manually enable rule tracing
|
514
|
+
# trace_out(__method__, 17)
|
515
|
+
|
516
|
+
end
|
517
|
+
|
518
|
+
# lexer rule power! (POWER)
|
519
|
+
# (in ExcelFormula.g)
|
520
|
+
def power!
|
521
|
+
# -> uncomment the next line to manually enable rule tracing
|
522
|
+
# trace_in(__method__, 18)
|
523
|
+
|
524
|
+
type = POWER
|
525
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
526
|
+
|
527
|
+
|
528
|
+
# - - - - main rule block - - - -
|
529
|
+
# at line 360:8: '^'
|
530
|
+
match(?^)
|
531
|
+
|
532
|
+
|
533
|
+
@state.type = type
|
534
|
+
@state.channel = channel
|
535
|
+
|
536
|
+
ensure
|
537
|
+
# -> uncomment the next line to manually enable rule tracing
|
538
|
+
# trace_out(__method__, 18)
|
539
|
+
|
540
|
+
end
|
541
|
+
|
542
|
+
# lexer rule bang! (BANG)
|
543
|
+
# (in ExcelFormula.g)
|
544
|
+
def bang!
|
545
|
+
# -> uncomment the next line to manually enable rule tracing
|
546
|
+
# trace_in(__method__, 19)
|
547
|
+
|
548
|
+
type = BANG
|
549
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
550
|
+
|
551
|
+
|
552
|
+
# - - - - main rule block - - - -
|
553
|
+
# at line 361:7: '!'
|
554
|
+
match(?!)
|
555
|
+
|
556
|
+
|
557
|
+
@state.type = type
|
558
|
+
@state.channel = channel
|
559
|
+
|
560
|
+
ensure
|
561
|
+
# -> uncomment the next line to manually enable rule tracing
|
562
|
+
# trace_out(__method__, 19)
|
563
|
+
|
564
|
+
end
|
565
|
+
|
566
|
+
# lexer rule digit! (DIGIT)
|
567
|
+
# (in ExcelFormula.g)
|
568
|
+
def digit!
|
569
|
+
# -> uncomment the next line to manually enable rule tracing
|
570
|
+
# trace_in(__method__, 20)
|
571
|
+
|
572
|
+
|
573
|
+
# - - - - main rule block - - - -
|
574
|
+
# at line 363:17: '0' .. '9'
|
575
|
+
match_range(?0, ?9)
|
576
|
+
|
577
|
+
ensure
|
578
|
+
# -> uncomment the next line to manually enable rule tracing
|
579
|
+
# trace_out(__method__, 20)
|
580
|
+
|
581
|
+
end
|
582
|
+
|
583
|
+
# lexer rule int_const! (INT_CONST)
|
584
|
+
# (in ExcelFormula.g)
|
585
|
+
def int_const!
|
586
|
+
# -> uncomment the next line to manually enable rule tracing
|
587
|
+
# trace_in(__method__, 21)
|
588
|
+
|
589
|
+
type = INT_CONST
|
590
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
591
|
+
|
592
|
+
|
593
|
+
# - - - - main rule block - - - -
|
594
|
+
# at line 365:12: ( DIGIT )+
|
595
|
+
# at file 365:12: ( DIGIT )+
|
596
|
+
match_count_1 = 0
|
597
|
+
loop do
|
598
|
+
alt_1 = 2
|
599
|
+
look_1_0 = @input.peek(1)
|
600
|
+
|
601
|
+
if (look_1_0.between?(?0, ?9))
|
602
|
+
alt_1 = 1
|
603
|
+
|
604
|
+
end
|
605
|
+
case alt_1
|
606
|
+
when 1
|
607
|
+
# at line 365:12: DIGIT
|
608
|
+
digit!
|
609
|
+
|
610
|
+
else
|
611
|
+
match_count_1 > 0 and break
|
612
|
+
eee = EarlyExit(1)
|
613
|
+
|
614
|
+
|
615
|
+
raise eee
|
616
|
+
end
|
617
|
+
match_count_1 += 1
|
618
|
+
end
|
619
|
+
|
620
|
+
|
621
|
+
|
622
|
+
@state.type = type
|
623
|
+
@state.channel = channel
|
624
|
+
|
625
|
+
ensure
|
626
|
+
# -> uncomment the next line to manually enable rule tracing
|
627
|
+
# trace_out(__method__, 21)
|
628
|
+
|
629
|
+
end
|
630
|
+
|
631
|
+
# lexer rule num_const! (NUM_CONST)
|
632
|
+
# (in ExcelFormula.g)
|
633
|
+
def num_const!
|
634
|
+
# -> uncomment the next line to manually enable rule tracing
|
635
|
+
# trace_in(__method__, 22)
|
636
|
+
|
637
|
+
type = NUM_CONST
|
638
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
639
|
+
|
640
|
+
|
641
|
+
# - - - - main rule block - - - -
|
642
|
+
# at line 366:12: ( DIGIT )* '.' ( DIGIT )+ ( ( 'E' | 'e' ) ( '+' | '-' )? ( DIGIT )+ )?
|
643
|
+
# at line 366:12: ( DIGIT )*
|
644
|
+
loop do # decision 2
|
645
|
+
alt_2 = 2
|
646
|
+
look_2_0 = @input.peek(1)
|
647
|
+
|
648
|
+
if (look_2_0.between?(?0, ?9))
|
649
|
+
alt_2 = 1
|
650
|
+
|
651
|
+
end
|
652
|
+
case alt_2
|
653
|
+
when 1
|
654
|
+
# at line 366:12: DIGIT
|
655
|
+
digit!
|
656
|
+
|
657
|
+
else
|
658
|
+
break # out of loop for decision 2
|
659
|
+
end
|
660
|
+
end # loop for decision 2
|
661
|
+
match(?.)
|
662
|
+
# at file 366:23: ( DIGIT )+
|
663
|
+
match_count_3 = 0
|
664
|
+
loop do
|
665
|
+
alt_3 = 2
|
666
|
+
look_3_0 = @input.peek(1)
|
667
|
+
|
668
|
+
if (look_3_0.between?(?0, ?9))
|
669
|
+
alt_3 = 1
|
670
|
+
|
671
|
+
end
|
672
|
+
case alt_3
|
673
|
+
when 1
|
674
|
+
# at line 366:23: DIGIT
|
675
|
+
digit!
|
676
|
+
|
677
|
+
else
|
678
|
+
match_count_3 > 0 and break
|
679
|
+
eee = EarlyExit(3)
|
680
|
+
|
681
|
+
|
682
|
+
raise eee
|
683
|
+
end
|
684
|
+
match_count_3 += 1
|
685
|
+
end
|
686
|
+
|
687
|
+
# at line 366:30: ( ( 'E' | 'e' ) ( '+' | '-' )? ( DIGIT )+ )?
|
688
|
+
alt_6 = 2
|
689
|
+
look_6_0 = @input.peek(1)
|
690
|
+
|
691
|
+
if (look_6_0 == ?E || look_6_0 == ?e)
|
692
|
+
alt_6 = 1
|
693
|
+
end
|
694
|
+
case alt_6
|
695
|
+
when 1
|
696
|
+
# at line 366:31: ( 'E' | 'e' ) ( '+' | '-' )? ( DIGIT )+
|
697
|
+
if @input.peek(1) == ?E || @input.peek(1) == ?e
|
698
|
+
@input.consume
|
699
|
+
else
|
700
|
+
mse = MismatchedSet(nil)
|
701
|
+
recover(mse)
|
702
|
+
raise mse
|
703
|
+
end
|
704
|
+
|
705
|
+
|
706
|
+
# at line 366:41: ( '+' | '-' )?
|
707
|
+
alt_4 = 2
|
708
|
+
look_4_0 = @input.peek(1)
|
709
|
+
|
710
|
+
if (look_4_0 == ?+ || look_4_0 == ?-)
|
711
|
+
alt_4 = 1
|
712
|
+
end
|
713
|
+
case alt_4
|
714
|
+
when 1
|
715
|
+
# at line
|
716
|
+
if @input.peek(1) == ?+ || @input.peek(1) == ?-
|
717
|
+
@input.consume
|
718
|
+
else
|
719
|
+
mse = MismatchedSet(nil)
|
720
|
+
recover(mse)
|
721
|
+
raise mse
|
722
|
+
end
|
723
|
+
|
724
|
+
|
725
|
+
|
726
|
+
end
|
727
|
+
# at file 366:52: ( DIGIT )+
|
728
|
+
match_count_5 = 0
|
729
|
+
loop do
|
730
|
+
alt_5 = 2
|
731
|
+
look_5_0 = @input.peek(1)
|
732
|
+
|
733
|
+
if (look_5_0.between?(?0, ?9))
|
734
|
+
alt_5 = 1
|
735
|
+
|
736
|
+
end
|
737
|
+
case alt_5
|
738
|
+
when 1
|
739
|
+
# at line 366:52: DIGIT
|
740
|
+
digit!
|
741
|
+
|
742
|
+
else
|
743
|
+
match_count_5 > 0 and break
|
744
|
+
eee = EarlyExit(5)
|
745
|
+
|
746
|
+
|
747
|
+
raise eee
|
748
|
+
end
|
749
|
+
match_count_5 += 1
|
750
|
+
end
|
751
|
+
|
752
|
+
|
753
|
+
end
|
754
|
+
|
755
|
+
|
756
|
+
@state.type = type
|
757
|
+
@state.channel = channel
|
758
|
+
|
759
|
+
ensure
|
760
|
+
# -> uncomment the next line to manually enable rule tracing
|
761
|
+
# trace_out(__method__, 22)
|
762
|
+
|
763
|
+
end
|
764
|
+
|
765
|
+
# lexer rule str_const! (STR_CONST)
|
766
|
+
# (in ExcelFormula.g)
|
767
|
+
def str_const!
|
768
|
+
# -> uncomment the next line to manually enable rule tracing
|
769
|
+
# trace_in(__method__, 23)
|
770
|
+
|
771
|
+
type = STR_CONST
|
772
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
773
|
+
|
774
|
+
|
775
|
+
# - - - - main rule block - - - -
|
776
|
+
# at line 367:12: '\"' (~ '\"' )+ '\"'
|
777
|
+
match(?")
|
778
|
+
# at file 367:16: (~ '\"' )+
|
779
|
+
match_count_7 = 0
|
780
|
+
loop do
|
781
|
+
alt_7 = 2
|
782
|
+
look_7_0 = @input.peek(1)
|
783
|
+
|
784
|
+
if (look_7_0.between?(0x0000, ?!) || look_7_0.between?(?#, 0xFFFF))
|
785
|
+
alt_7 = 1
|
786
|
+
|
787
|
+
end
|
788
|
+
case alt_7
|
789
|
+
when 1
|
790
|
+
# at line 367:17: ~ '\"'
|
791
|
+
if @input.peek(1).between?(0x0000, ?!) || @input.peek(1).between?(?#, 0x00FF)
|
792
|
+
@input.consume
|
793
|
+
else
|
794
|
+
mse = MismatchedSet(nil)
|
795
|
+
recover(mse)
|
796
|
+
raise mse
|
797
|
+
end
|
798
|
+
|
799
|
+
|
800
|
+
|
801
|
+
else
|
802
|
+
match_count_7 > 0 and break
|
803
|
+
eee = EarlyExit(7)
|
804
|
+
|
805
|
+
|
806
|
+
raise eee
|
807
|
+
end
|
808
|
+
match_count_7 += 1
|
809
|
+
end
|
810
|
+
|
811
|
+
match(?")
|
812
|
+
|
813
|
+
|
814
|
+
@state.type = type
|
815
|
+
@state.channel = channel
|
816
|
+
|
817
|
+
ensure
|
818
|
+
# -> uncomment the next line to manually enable rule tracing
|
819
|
+
# trace_out(__method__, 23)
|
820
|
+
|
821
|
+
end
|
822
|
+
|
823
|
+
# lexer rule ref_2_d! (REF2D)
|
824
|
+
# (in ExcelFormula.g)
|
825
|
+
def ref_2_d!
|
826
|
+
# -> uncomment the next line to manually enable rule tracing
|
827
|
+
# trace_in(__method__, 24)
|
828
|
+
|
829
|
+
type = REF2D
|
830
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
831
|
+
|
832
|
+
|
833
|
+
# - - - - main rule block - - - -
|
834
|
+
# at line 368:8: ( '$' )? ( 'A' .. 'I' )? ( 'A' .. 'Z' ) ( '$' )? ( DIGIT )+
|
835
|
+
# at line 368:8: ( '$' )?
|
836
|
+
alt_8 = 2
|
837
|
+
look_8_0 = @input.peek(1)
|
838
|
+
|
839
|
+
if (look_8_0 == ?$)
|
840
|
+
alt_8 = 1
|
841
|
+
end
|
842
|
+
case alt_8
|
843
|
+
when 1
|
844
|
+
# at line 368:8: '$'
|
845
|
+
match(?$)
|
846
|
+
|
847
|
+
end
|
848
|
+
# at line 368:13: ( 'A' .. 'I' )?
|
849
|
+
alt_9 = 2
|
850
|
+
look_9_0 = @input.peek(1)
|
851
|
+
|
852
|
+
if (look_9_0.between?(?A, ?I))
|
853
|
+
look_9_1 = @input.peek(2)
|
854
|
+
|
855
|
+
if (look_9_1.between?(?A, ?Z))
|
856
|
+
alt_9 = 1
|
857
|
+
end
|
858
|
+
end
|
859
|
+
case alt_9
|
860
|
+
when 1
|
861
|
+
# at line 368:14: 'A' .. 'I'
|
862
|
+
match_range(?A, ?I)
|
863
|
+
|
864
|
+
end
|
865
|
+
# at line 368:25: ( 'A' .. 'Z' )
|
866
|
+
# at line 368:26: 'A' .. 'Z'
|
867
|
+
match_range(?A, ?Z)
|
868
|
+
|
869
|
+
# at line 368:36: ( '$' )?
|
870
|
+
alt_10 = 2
|
871
|
+
look_10_0 = @input.peek(1)
|
872
|
+
|
873
|
+
if (look_10_0 == ?$)
|
874
|
+
alt_10 = 1
|
875
|
+
end
|
876
|
+
case alt_10
|
877
|
+
when 1
|
878
|
+
# at line 368:36: '$'
|
879
|
+
match(?$)
|
880
|
+
|
881
|
+
end
|
882
|
+
# at file 368:41: ( DIGIT )+
|
883
|
+
match_count_11 = 0
|
884
|
+
loop do
|
885
|
+
alt_11 = 2
|
886
|
+
look_11_0 = @input.peek(1)
|
887
|
+
|
888
|
+
if (look_11_0.between?(?0, ?9))
|
889
|
+
alt_11 = 1
|
890
|
+
|
891
|
+
end
|
892
|
+
case alt_11
|
893
|
+
when 1
|
894
|
+
# at line 368:41: DIGIT
|
895
|
+
digit!
|
896
|
+
|
897
|
+
else
|
898
|
+
match_count_11 > 0 and break
|
899
|
+
eee = EarlyExit(11)
|
900
|
+
|
901
|
+
|
902
|
+
raise eee
|
903
|
+
end
|
904
|
+
match_count_11 += 1
|
905
|
+
end
|
906
|
+
|
907
|
+
|
908
|
+
|
909
|
+
@state.type = type
|
910
|
+
@state.channel = channel
|
911
|
+
|
912
|
+
ensure
|
913
|
+
# -> uncomment the next line to manually enable rule tracing
|
914
|
+
# trace_out(__method__, 24)
|
915
|
+
|
916
|
+
end
|
917
|
+
|
918
|
+
# lexer rule true_const! (TRUE_CONST)
|
919
|
+
# (in ExcelFormula.g)
|
920
|
+
def true_const!
|
921
|
+
# -> uncomment the next line to manually enable rule tracing
|
922
|
+
# trace_in(__method__, 25)
|
923
|
+
|
924
|
+
type = TRUE_CONST
|
925
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
926
|
+
|
927
|
+
|
928
|
+
# - - - - main rule block - - - -
|
929
|
+
# at line 369:13: ( 'T' | 't' ) ( 'R' | 'r' ) ( 'U' | 'u' ) ( 'E' | 'e' )
|
930
|
+
if @input.peek(1) == ?T || @input.peek(1) == ?t
|
931
|
+
@input.consume
|
932
|
+
else
|
933
|
+
mse = MismatchedSet(nil)
|
934
|
+
recover(mse)
|
935
|
+
raise mse
|
936
|
+
end
|
937
|
+
|
938
|
+
|
939
|
+
if @input.peek(1) == ?R || @input.peek(1) == ?r
|
940
|
+
@input.consume
|
941
|
+
else
|
942
|
+
mse = MismatchedSet(nil)
|
943
|
+
recover(mse)
|
944
|
+
raise mse
|
945
|
+
end
|
946
|
+
|
947
|
+
|
948
|
+
if @input.peek(1) == ?U || @input.peek(1) == ?u
|
949
|
+
@input.consume
|
950
|
+
else
|
951
|
+
mse = MismatchedSet(nil)
|
952
|
+
recover(mse)
|
953
|
+
raise mse
|
954
|
+
end
|
955
|
+
|
956
|
+
|
957
|
+
if @input.peek(1) == ?E || @input.peek(1) == ?e
|
958
|
+
@input.consume
|
959
|
+
else
|
960
|
+
mse = MismatchedSet(nil)
|
961
|
+
recover(mse)
|
962
|
+
raise mse
|
963
|
+
end
|
964
|
+
|
965
|
+
|
966
|
+
|
967
|
+
|
968
|
+
@state.type = type
|
969
|
+
@state.channel = channel
|
970
|
+
|
971
|
+
ensure
|
972
|
+
# -> uncomment the next line to manually enable rule tracing
|
973
|
+
# trace_out(__method__, 25)
|
974
|
+
|
975
|
+
end
|
976
|
+
|
977
|
+
# lexer rule false_const! (FALSE_CONST)
|
978
|
+
# (in ExcelFormula.g)
|
979
|
+
def false_const!
|
980
|
+
# -> uncomment the next line to manually enable rule tracing
|
981
|
+
# trace_in(__method__, 26)
|
982
|
+
|
983
|
+
type = FALSE_CONST
|
984
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
985
|
+
|
986
|
+
|
987
|
+
# - - - - main rule block - - - -
|
988
|
+
# at line 370:14: ( 'F' | 'f' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'S' | 's' ) ( 'E' | 'e' )
|
989
|
+
if @input.peek(1) == ?F || @input.peek(1) == ?f
|
990
|
+
@input.consume
|
991
|
+
else
|
992
|
+
mse = MismatchedSet(nil)
|
993
|
+
recover(mse)
|
994
|
+
raise mse
|
995
|
+
end
|
996
|
+
|
997
|
+
|
998
|
+
if @input.peek(1) == ?A || @input.peek(1) == ?a
|
999
|
+
@input.consume
|
1000
|
+
else
|
1001
|
+
mse = MismatchedSet(nil)
|
1002
|
+
recover(mse)
|
1003
|
+
raise mse
|
1004
|
+
end
|
1005
|
+
|
1006
|
+
|
1007
|
+
if @input.peek(1) == ?L || @input.peek(1) == ?l
|
1008
|
+
@input.consume
|
1009
|
+
else
|
1010
|
+
mse = MismatchedSet(nil)
|
1011
|
+
recover(mse)
|
1012
|
+
raise mse
|
1013
|
+
end
|
1014
|
+
|
1015
|
+
|
1016
|
+
if @input.peek(1) == ?S || @input.peek(1) == ?s
|
1017
|
+
@input.consume
|
1018
|
+
else
|
1019
|
+
mse = MismatchedSet(nil)
|
1020
|
+
recover(mse)
|
1021
|
+
raise mse
|
1022
|
+
end
|
1023
|
+
|
1024
|
+
|
1025
|
+
if @input.peek(1) == ?E || @input.peek(1) == ?e
|
1026
|
+
@input.consume
|
1027
|
+
else
|
1028
|
+
mse = MismatchedSet(nil)
|
1029
|
+
recover(mse)
|
1030
|
+
raise mse
|
1031
|
+
end
|
1032
|
+
|
1033
|
+
|
1034
|
+
|
1035
|
+
|
1036
|
+
@state.type = type
|
1037
|
+
@state.channel = channel
|
1038
|
+
|
1039
|
+
ensure
|
1040
|
+
# -> uncomment the next line to manually enable rule tracing
|
1041
|
+
# trace_out(__method__, 26)
|
1042
|
+
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
# lexer rule quotename! (QUOTENAME)
|
1046
|
+
# (in ExcelFormula.g)
|
1047
|
+
def quotename!
|
1048
|
+
# -> uncomment the next line to manually enable rule tracing
|
1049
|
+
# trace_in(__method__, 27)
|
1050
|
+
|
1051
|
+
type = QUOTENAME
|
1052
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
1053
|
+
|
1054
|
+
|
1055
|
+
# - - - - main rule block - - - -
|
1056
|
+
# at line 371:12: '\\'(?:[^\\']|\\'\\')*\\''
|
1057
|
+
match("'(?:[^']|'')*'")
|
1058
|
+
|
1059
|
+
|
1060
|
+
@state.type = type
|
1061
|
+
@state.channel = channel
|
1062
|
+
|
1063
|
+
ensure
|
1064
|
+
# -> uncomment the next line to manually enable rule tracing
|
1065
|
+
# trace_out(__method__, 27)
|
1066
|
+
|
1067
|
+
end
|
1068
|
+
|
1069
|
+
# lexer rule func_if! (FUNC_IF)
|
1070
|
+
# (in ExcelFormula.g)
|
1071
|
+
def func_if!
|
1072
|
+
# -> uncomment the next line to manually enable rule tracing
|
1073
|
+
# trace_in(__method__, 28)
|
1074
|
+
|
1075
|
+
type = FUNC_IF
|
1076
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
1077
|
+
|
1078
|
+
|
1079
|
+
# - - - - main rule block - - - -
|
1080
|
+
# at line 372:10: 'IF'
|
1081
|
+
match("IF")
|
1082
|
+
|
1083
|
+
|
1084
|
+
@state.type = type
|
1085
|
+
@state.channel = channel
|
1086
|
+
|
1087
|
+
ensure
|
1088
|
+
# -> uncomment the next line to manually enable rule tracing
|
1089
|
+
# trace_out(__method__, 28)
|
1090
|
+
|
1091
|
+
end
|
1092
|
+
|
1093
|
+
# lexer rule func_choose! (FUNC_CHOOSE)
|
1094
|
+
# (in ExcelFormula.g)
|
1095
|
+
def func_choose!
|
1096
|
+
# -> uncomment the next line to manually enable rule tracing
|
1097
|
+
# trace_in(__method__, 29)
|
1098
|
+
|
1099
|
+
type = FUNC_CHOOSE
|
1100
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
1101
|
+
|
1102
|
+
|
1103
|
+
# - - - - main rule block - - - -
|
1104
|
+
# at line 373:14: 'CHOOSE'
|
1105
|
+
match("CHOOSE")
|
1106
|
+
|
1107
|
+
|
1108
|
+
@state.type = type
|
1109
|
+
@state.channel = channel
|
1110
|
+
|
1111
|
+
ensure
|
1112
|
+
# -> uncomment the next line to manually enable rule tracing
|
1113
|
+
# trace_out(__method__, 29)
|
1114
|
+
|
1115
|
+
end
|
1116
|
+
|
1117
|
+
# lexer rule alpha! (ALPHA)
|
1118
|
+
# (in ExcelFormula.g)
|
1119
|
+
def alpha!
|
1120
|
+
# -> uncomment the next line to manually enable rule tracing
|
1121
|
+
# trace_in(__method__, 30)
|
1122
|
+
|
1123
|
+
|
1124
|
+
# - - - - main rule block - - - -
|
1125
|
+
# at line
|
1126
|
+
if @input.peek(1).between?(?A, ?Z) || @input.peek(1).between?(?a, ?z)
|
1127
|
+
@input.consume
|
1128
|
+
else
|
1129
|
+
mse = MismatchedSet(nil)
|
1130
|
+
recover(mse)
|
1131
|
+
raise mse
|
1132
|
+
end
|
1133
|
+
|
1134
|
+
|
1135
|
+
|
1136
|
+
ensure
|
1137
|
+
# -> uncomment the next line to manually enable rule tracing
|
1138
|
+
# trace_out(__method__, 30)
|
1139
|
+
|
1140
|
+
end
|
1141
|
+
|
1142
|
+
# lexer rule name! (NAME)
|
1143
|
+
# (in ExcelFormula.g)
|
1144
|
+
def name!
|
1145
|
+
# -> uncomment the next line to manually enable rule tracing
|
1146
|
+
# trace_in(__method__, 31)
|
1147
|
+
|
1148
|
+
type = NAME
|
1149
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
1150
|
+
|
1151
|
+
|
1152
|
+
# - - - - main rule block - - - -
|
1153
|
+
# at line 376:7: ( ALPHA )+
|
1154
|
+
# at file 376:7: ( ALPHA )+
|
1155
|
+
match_count_12 = 0
|
1156
|
+
loop do
|
1157
|
+
alt_12 = 2
|
1158
|
+
look_12_0 = @input.peek(1)
|
1159
|
+
|
1160
|
+
if (look_12_0.between?(?A, ?Z) || look_12_0.between?(?a, ?z))
|
1161
|
+
alt_12 = 1
|
1162
|
+
|
1163
|
+
end
|
1164
|
+
case alt_12
|
1165
|
+
when 1
|
1166
|
+
# at line 376:7: ALPHA
|
1167
|
+
alpha!
|
1168
|
+
|
1169
|
+
else
|
1170
|
+
match_count_12 > 0 and break
|
1171
|
+
eee = EarlyExit(12)
|
1172
|
+
|
1173
|
+
|
1174
|
+
raise eee
|
1175
|
+
end
|
1176
|
+
match_count_12 += 1
|
1177
|
+
end
|
1178
|
+
|
1179
|
+
|
1180
|
+
|
1181
|
+
@state.type = type
|
1182
|
+
@state.channel = channel
|
1183
|
+
|
1184
|
+
ensure
|
1185
|
+
# -> uncomment the next line to manually enable rule tracing
|
1186
|
+
# trace_out(__method__, 31)
|
1187
|
+
|
1188
|
+
end
|
1189
|
+
|
1190
|
+
# lexer rule ws! (WS)
|
1191
|
+
# (in ExcelFormula.g)
|
1192
|
+
def ws!
|
1193
|
+
# -> uncomment the next line to manually enable rule tracing
|
1194
|
+
# trace_in(__method__, 32)
|
1195
|
+
|
1196
|
+
type = WS
|
1197
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
1198
|
+
|
1199
|
+
|
1200
|
+
# - - - - main rule block - - - -
|
1201
|
+
# at line 378:5: ( ' ' )+
|
1202
|
+
# at file 378:5: ( ' ' )+
|
1203
|
+
match_count_13 = 0
|
1204
|
+
loop do
|
1205
|
+
alt_13 = 2
|
1206
|
+
look_13_0 = @input.peek(1)
|
1207
|
+
|
1208
|
+
if (look_13_0 == ?\s)
|
1209
|
+
alt_13 = 1
|
1210
|
+
|
1211
|
+
end
|
1212
|
+
case alt_13
|
1213
|
+
when 1
|
1214
|
+
# at line 378:6: ' '
|
1215
|
+
match(?\s)
|
1216
|
+
|
1217
|
+
else
|
1218
|
+
match_count_13 > 0 and break
|
1219
|
+
eee = EarlyExit(13)
|
1220
|
+
|
1221
|
+
|
1222
|
+
raise eee
|
1223
|
+
end
|
1224
|
+
match_count_13 += 1
|
1225
|
+
end
|
1226
|
+
|
1227
|
+
# --> action
|
1228
|
+
skip()
|
1229
|
+
# <-- action
|
1230
|
+
|
1231
|
+
|
1232
|
+
@state.type = type
|
1233
|
+
@state.channel = channel
|
1234
|
+
|
1235
|
+
ensure
|
1236
|
+
# -> uncomment the next line to manually enable rule tracing
|
1237
|
+
# trace_out(__method__, 32)
|
1238
|
+
|
1239
|
+
end
|
1240
|
+
|
1241
|
+
# main rule used to study the input at the current position,
|
1242
|
+
# and choose the proper lexer rule to call in order to
|
1243
|
+
# fetch the next token
|
1244
|
+
#
|
1245
|
+
# usually, you don't make direct calls to this method,
|
1246
|
+
# but instead use the next_token method, which will
|
1247
|
+
# build and emit the actual next token
|
1248
|
+
def token!
|
1249
|
+
# at line 1:8: ( EQ | LT | GT | NE | LE | GE | ADD | SUB | MUL | DIV | COLON | SEMICOLON | COMMA | LP | RP | CONCAT | PERCENT | POWER | BANG | INT_CONST | NUM_CONST | STR_CONST | REF2D | TRUE_CONST | FALSE_CONST | QUOTENAME | FUNC_IF | FUNC_CHOOSE | NAME | WS )
|
1250
|
+
alt_14 = 30
|
1251
|
+
alt_14 = @dfa14.predict(@input)
|
1252
|
+
case alt_14
|
1253
|
+
when 1
|
1254
|
+
# at line 1:10: EQ
|
1255
|
+
eq!
|
1256
|
+
|
1257
|
+
when 2
|
1258
|
+
# at line 1:13: LT
|
1259
|
+
lt!
|
1260
|
+
|
1261
|
+
when 3
|
1262
|
+
# at line 1:16: GT
|
1263
|
+
gt!
|
1264
|
+
|
1265
|
+
when 4
|
1266
|
+
# at line 1:19: NE
|
1267
|
+
ne!
|
1268
|
+
|
1269
|
+
when 5
|
1270
|
+
# at line 1:22: LE
|
1271
|
+
le!
|
1272
|
+
|
1273
|
+
when 6
|
1274
|
+
# at line 1:25: GE
|
1275
|
+
ge!
|
1276
|
+
|
1277
|
+
when 7
|
1278
|
+
# at line 1:28: ADD
|
1279
|
+
add!
|
1280
|
+
|
1281
|
+
when 8
|
1282
|
+
# at line 1:32: SUB
|
1283
|
+
sub!
|
1284
|
+
|
1285
|
+
when 9
|
1286
|
+
# at line 1:36: MUL
|
1287
|
+
mul!
|
1288
|
+
|
1289
|
+
when 10
|
1290
|
+
# at line 1:40: DIV
|
1291
|
+
div!
|
1292
|
+
|
1293
|
+
when 11
|
1294
|
+
# at line 1:44: COLON
|
1295
|
+
colon!
|
1296
|
+
|
1297
|
+
when 12
|
1298
|
+
# at line 1:50: SEMICOLON
|
1299
|
+
semicolon!
|
1300
|
+
|
1301
|
+
when 13
|
1302
|
+
# at line 1:60: COMMA
|
1303
|
+
comma!
|
1304
|
+
|
1305
|
+
when 14
|
1306
|
+
# at line 1:66: LP
|
1307
|
+
lp!
|
1308
|
+
|
1309
|
+
when 15
|
1310
|
+
# at line 1:69: RP
|
1311
|
+
rp!
|
1312
|
+
|
1313
|
+
when 16
|
1314
|
+
# at line 1:72: CONCAT
|
1315
|
+
concat!
|
1316
|
+
|
1317
|
+
when 17
|
1318
|
+
# at line 1:79: PERCENT
|
1319
|
+
percent!
|
1320
|
+
|
1321
|
+
when 18
|
1322
|
+
# at line 1:87: POWER
|
1323
|
+
power!
|
1324
|
+
|
1325
|
+
when 19
|
1326
|
+
# at line 1:93: BANG
|
1327
|
+
bang!
|
1328
|
+
|
1329
|
+
when 20
|
1330
|
+
# at line 1:98: INT_CONST
|
1331
|
+
int_const!
|
1332
|
+
|
1333
|
+
when 21
|
1334
|
+
# at line 1:108: NUM_CONST
|
1335
|
+
num_const!
|
1336
|
+
|
1337
|
+
when 22
|
1338
|
+
# at line 1:118: STR_CONST
|
1339
|
+
str_const!
|
1340
|
+
|
1341
|
+
when 23
|
1342
|
+
# at line 1:128: REF2D
|
1343
|
+
ref_2_d!
|
1344
|
+
|
1345
|
+
when 24
|
1346
|
+
# at line 1:134: TRUE_CONST
|
1347
|
+
true_const!
|
1348
|
+
|
1349
|
+
when 25
|
1350
|
+
# at line 1:145: FALSE_CONST
|
1351
|
+
false_const!
|
1352
|
+
|
1353
|
+
when 26
|
1354
|
+
# at line 1:157: QUOTENAME
|
1355
|
+
quotename!
|
1356
|
+
|
1357
|
+
when 27
|
1358
|
+
# at line 1:167: FUNC_IF
|
1359
|
+
func_if!
|
1360
|
+
|
1361
|
+
when 28
|
1362
|
+
# at line 1:175: FUNC_CHOOSE
|
1363
|
+
func_choose!
|
1364
|
+
|
1365
|
+
when 29
|
1366
|
+
# at line 1:187: NAME
|
1367
|
+
name!
|
1368
|
+
|
1369
|
+
when 30
|
1370
|
+
# at line 1:192: WS
|
1371
|
+
ws!
|
1372
|
+
|
1373
|
+
end
|
1374
|
+
end
|
1375
|
+
|
1376
|
+
|
1377
|
+
# - - - - - - - - - - DFA definitions - - - - - - - - - - -
|
1378
|
+
class DFA14 < ANTLR3::DFA
|
1379
|
+
EOT = unpack(2, -1, 1, 34, 1, 36, 13, -1, 1, 37, 3, -1, 6, 30, 1,
|
1380
|
+
-1, 2, 30, 8, -1, 3, 30, 1, 45, 3, 30, 1, -1, 2, 30,
|
1381
|
+
1, 51, 1, 30, 1, 53, 1, -1, 1, 30, 1, -1, 1, 55, 1, -1)
|
1382
|
+
EOF = unpack(56, -1)
|
1383
|
+
MIN = unpack(1, 32, 1, -1, 2, 61, 13, -1, 1, 46, 3, -1, 3, 36, 1,
|
1384
|
+
82, 1, 36, 1, 65, 1, -1, 2, 36, 8, -1, 1, 36, 1, 76,
|
1385
|
+
1, 85, 2, 36, 1, 83, 1, 69, 1, -1, 1, 79, 1, 69, 1, 65,
|
1386
|
+
1, 83, 1, 65, 1, -1, 1, 69, 1, -1, 1, 65, 1, -1)
|
1387
|
+
MAX = unpack(1, 122, 1, -1, 1, 62, 1, 61, 13, -1, 1, 57, 3, -1, 1,
|
1388
|
+
97, 1, 114, 1, 57, 1, 114, 1, 90, 1, 97, 1, -1, 2, 90,
|
1389
|
+
8, -1, 2, 108, 1, 117, 1, 122, 1, 79, 1, 115, 1, 101,
|
1390
|
+
1, -1, 1, 79, 1, 101, 1, 122, 1, 83, 1, 122, 1, -1, 1,
|
1391
|
+
69, 1, -1, 1, 122, 1, -1)
|
1392
|
+
ACCEPT = unpack(1, -1, 1, 1, 2, -1, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11,
|
1393
|
+
1, 12, 1, 13, 1, 14, 1, 15, 1, 16, 1, 17, 1, 18, 1,
|
1394
|
+
19, 1, -1, 1, 21, 1, 22, 1, 23, 6, -1, 1, 26, 2, -1,
|
1395
|
+
1, 29, 1, 30, 1, 4, 1, 5, 1, 2, 1, 6, 1, 3, 1, 20,
|
1396
|
+
7, -1, 1, 27, 5, -1, 1, 24, 1, -1, 1, 25, 1, -1, 1,
|
1397
|
+
28)
|
1398
|
+
SPECIAL = unpack(56, -1)
|
1399
|
+
TRANSITION = [
|
1400
|
+
unpack(1, 31, 1, 16, 1, 19, 1, -1, 1, 20, 1, 14, 1, 13, 1, 27, 1,
|
1401
|
+
11, 1, 12, 1, 6, 1, 4, 1, 10, 1, 5, 1, 18, 1, 7, 10, 17,
|
1402
|
+
1, 8, 1, 9, 1, 2, 1, 1, 1, 3, 2, -1, 2, 29, 1, 28, 2, 29,
|
1403
|
+
1, 21, 2, 29, 1, 25, 10, 23, 1, 22, 6, 23, 3, -1, 1, 15,
|
1404
|
+
2, -1, 5, 30, 1, 26, 13, 30, 1, 24, 6, 30),
|
1405
|
+
unpack(),
|
1406
|
+
unpack(1, 33, 1, 32),
|
1407
|
+
unpack(1, 35),
|
1408
|
+
unpack(),
|
1409
|
+
unpack(),
|
1410
|
+
unpack(),
|
1411
|
+
unpack(),
|
1412
|
+
unpack(),
|
1413
|
+
unpack(),
|
1414
|
+
unpack(),
|
1415
|
+
unpack(),
|
1416
|
+
unpack(),
|
1417
|
+
unpack(),
|
1418
|
+
unpack(),
|
1419
|
+
unpack(),
|
1420
|
+
unpack(),
|
1421
|
+
unpack(1, 18, 1, -1, 10, 17),
|
1422
|
+
unpack(),
|
1423
|
+
unpack(),
|
1424
|
+
unpack(),
|
1425
|
+
unpack(1, 20, 11, -1, 10, 20, 7, -1, 1, 38, 25, 23, 6, -1, 1, 39),
|
1426
|
+
unpack(1, 20, 11, -1, 10, 20, 24, -1, 1, 40, 31, -1, 1, 40),
|
1427
|
+
unpack(1, 20, 11, -1, 10, 20),
|
1428
|
+
unpack(1, 40, 31, -1, 1, 40),
|
1429
|
+
unpack(1, 20, 11, -1, 10, 20, 7, -1, 5, 23, 1, 41, 20, 23),
|
1430
|
+
unpack(1, 39, 31, -1, 1, 39),
|
1431
|
+
unpack(),
|
1432
|
+
unpack(1, 20, 11, -1, 10, 20, 7, -1, 7, 23, 1, 42, 18, 23),
|
1433
|
+
unpack(1, 20, 11, -1, 10, 20, 7, -1, 26, 23),
|
1434
|
+
unpack(),
|
1435
|
+
unpack(),
|
1436
|
+
unpack(),
|
1437
|
+
unpack(),
|
1438
|
+
unpack(),
|
1439
|
+
unpack(),
|
1440
|
+
unpack(),
|
1441
|
+
unpack(),
|
1442
|
+
unpack(1, 20, 11, -1, 10, 20, 18, -1, 1, 43, 31, -1, 1, 43),
|
1443
|
+
unpack(1, 43, 31, -1, 1, 43),
|
1444
|
+
unpack(1, 44, 31, -1, 1, 44),
|
1445
|
+
unpack(1, 20, 11, -1, 10, 20, 7, -1, 26, 30, 6, -1, 26, 30),
|
1446
|
+
unpack(1, 20, 11, -1, 10, 20, 21, -1, 1, 46),
|
1447
|
+
unpack(1, 47, 31, -1, 1, 47),
|
1448
|
+
unpack(1, 48, 31, -1, 1, 48),
|
1449
|
+
unpack(),
|
1450
|
+
unpack(1, 49),
|
1451
|
+
unpack(1, 50, 31, -1, 1, 50),
|
1452
|
+
unpack(26, 30, 6, -1, 26, 30),
|
1453
|
+
unpack(1, 52),
|
1454
|
+
unpack(26, 30, 6, -1, 26, 30),
|
1455
|
+
unpack(),
|
1456
|
+
unpack(1, 54),
|
1457
|
+
unpack(),
|
1458
|
+
unpack(26, 30, 6, -1, 26, 30),
|
1459
|
+
unpack()
|
1460
|
+
].freeze
|
1461
|
+
|
1462
|
+
( 0 ... MIN.length ).zip( MIN, MAX ) do | i, a, z |
|
1463
|
+
if a > 0 and z < 0
|
1464
|
+
MAX[ i ] %= 0x10000
|
1465
|
+
end
|
1466
|
+
end
|
1467
|
+
|
1468
|
+
@decision = 14
|
1469
|
+
|
1470
|
+
|
1471
|
+
def description
|
1472
|
+
<<-'__dfa_description__'.strip!
|
1473
|
+
1:1: Tokens : ( EQ | LT | GT | NE | LE | GE | ADD | SUB | MUL | DIV | COLON | SEMICOLON | COMMA | LP | RP | CONCAT | PERCENT | POWER | BANG | INT_CONST | NUM_CONST | STR_CONST | REF2D | TRUE_CONST | FALSE_CONST | QUOTENAME | FUNC_IF | FUNC_CHOOSE | NAME | WS );
|
1474
|
+
__dfa_description__
|
1475
|
+
end
|
1476
|
+
end
|
1477
|
+
|
1478
|
+
|
1479
|
+
private
|
1480
|
+
|
1481
|
+
def initialize_dfas
|
1482
|
+
super rescue nil
|
1483
|
+
@dfa14 = DFA14.new(self, 14)
|
1484
|
+
|
1485
|
+
end
|
1486
|
+
end # class Lexer < ANTLR3::Lexer
|
1487
|
+
|
1488
|
+
at_exit { Lexer.main(ARGV) } if __FILE__ == $0
|
1489
|
+
end
|
1490
|
+
|