lib/surpass/ExcelFormulaLexer.rb in surpass-0.0.7 vs lib/surpass/ExcelFormulaLexer.rb in surpass-0.0.9

- old
+ new

@@ -1,922 +1,1363 @@ -# ExcelFormulaLexer (ExcelFormula.g) -# Generated by ANTLR 3.1.2-2008-10-21 on 2009-06-15 23:03:59 +#!/usr/bin/env ruby +# +# ExcelFormula.g +# +# Generated using ANTLR version: 3.2.1-SNAPSHOT Dec 18, 2009 04:29:28 +# Ruby runtime library version: 1.3.1 +# Input grammar file: ExcelFormula.g +# Generated at: 2010-05-03 16:34:32 +# -class ExcelFormulaLexer - require 'stringio' +# ~~~> start load path setup +this_directory = File.expand_path( File.dirname( __FILE__ ) ) +$:.unshift( this_directory ) unless $:.include?( this_directory ) - COMMA=25 - TRUE_CONST=12 - PERCENT=11 - POWER=10 - FUNC_CHOOSE=33 - BANG=28 - EQ=4 - QUOTENAME=31 - LT=19 - NE=21 - GT=20 - FUNC_IF=32 - RP=27 - FALSE_CONST=13 - LP=26 - GE=23 - MUL=8 - NUM_CONST=16 - REF2D=17 - SEMICOLON=24 - CONCAT=5 - EOF=-1 - LE=22 - INT_CONST=15 - STR_CONST=14 - COLON=18 - DIV=9 - DIGIT=29 - SUB=7 - NAME=30 - ADD=6 - - def initialize(input) - input = StringIO.new(input) if input.respond_to?(:to_str) - @input = CharStream.new(input) - @backtracking = 0 - @failed = false +antlr_load_failed = proc do + load_path = $LOAD_PATH.map { |dir| ' - ' << dir }.join( $/ ) + raise LoadError, <<-END.strip! + +Failed to load the ANTLR3 runtime library (version 1.3.1): - end +Ensure the library has been installed on your system and is available +on the load path. If rubygems is available on your system, this can +be done with the command: + + gem install antlr3 - def next_token - # TODO: catch exceptions - @token = nil - @channel = nil - @text = nil +Current load path: +#{ load_path } - @start = @input.index - @line = @input.line - @pos = @input.column + END +end - @type = nil - @type_int = nil +defined?(ANTLR3) or begin + + # 1: try to load the ruby antlr3 runtime library from the system path + require 'antlr3' + +rescue LoadError + + # 2: try to load rubygems if it isn't already loaded + defined?(Gem) or begin + require 'rubygems' + rescue LoadError + antlr_load_failed.call + end + + # 3: try to activate the antlr3 gem + begin + Gem.activate( 'antlr3', '= 1.3.1' ) + rescue Gem::LoadError + antlr_load_failed.call + end + + require 'antlr3' + +end +# <~~~ end load path setup - return :EOF if @input.look_ahead(1) == :EOF - match_Tokens() +module ExcelFormula + # TokenData defines all of the token type integer values + # as constants, which will be included in all + # ANTLR-generated recognizers. + const_defined?(:TokenData) or TokenData = ANTLR3::TokenScheme.new - if @token == nil - @text ||= @input.substring(@start, @input.index - 1) - @token = Token.new(@type, @type_int, @line, @pos, @text, @channel) - end + module TokenData - return @token - end + # define the token constants + define_tokens(:GE => 8, :LT => 7, :NUM_CONST => 21, :PERCENT => 16, + :REF2D => 22, :CONCAT => 10, :RP => 29, :LP => 26, :INT_CONST => 20, + :STR_CONST => 19, :POWER => 15, :SUB => 12, :FUNC_CHOOSE => 30, + :SEMICOLON => 27, :BANG => 24, :TRUE_CONST => 17, :EOF => -1, + :MUL => 13, :COLON => 23, :FALSE_CONST => 18, :NAME => 31, + :COMMA => 28, :GT => 6, :DIGIT => 33, :DIV => 14, :EQ => 4, + :FUNC_IF => 25, :QUOTENAME => 32, :LE => 9, :ADD => 11, + :NE => 5) + + end - class Token - attr_reader :token_type - attr_reader :int_type - attr_reader :line - attr_reader :pos - attr_reader :text - attr_reader :channel - def initialize(token_type, int_type, line, pos, text, channel = nil) - @token_type = token_type - @int_type = int_type - @line = line - @pos = pos - @text = text - @channel = channel - end + class Lexer < ANTLR3::Lexer + @grammar_home = ExcelFormula + include TokenData - alias :to_i :int_type + begin + generated_using( "ExcelFormula.g", "3.2.1-SNAPSHOT Dec 18, 2009 04:29:28", "1.3.1" ) + rescue NoMethodError => error + error.name.to_sym == :generated_using or raise end + + RULE_NAMES = ["EQ", "LT", "GT", "NE", "LE", "GE", "ADD", "SUB", "MUL", + "DIV", "COLON", "SEMICOLON", "COMMA", "LP", "RP", "CONCAT", + "PERCENT", "POWER", "BANG", "DIGIT", "INT_CONST", "NUM_CONST", + "STR_CONST", "REF2D", "TRUE_CONST", "FALSE_CONST", "NAME", + "QUOTENAME", "FUNC_IF", "FUNC_CHOOSE"].freeze + RULE_METHODS = [:eq!, :lt!, :gt!, :ne!, :le!, :ge!, :add!, :sub!, :mul!, + :div!, :colon!, :semicolon!, :comma!, :lp!, :rp!, :concat!, + :percent!, :power!, :bang!, :digit!, :int_const!, :num_const!, + :str_const!, :ref_2_d!, :true_const!, :false_const!, + :name!, :quotename!, :func_if!, :func_choose!].freeze + + def initialize(input=nil, options = {}) + super(input, options) - private + end + + # - - - - - - - - - - - lexer rules - - - - - - - - - - - - + # lexer rule eq! (EQ) + # (in ExcelFormula.g) + def eq! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 1) - class CharStream - attr_reader :line - attr_reader :column - attr_reader :index + type = EQ + channel = ANTLR3::DEFAULT_CHANNEL - def initialize(input) - @buffer = "" - @input = input - @line = 1 - @column = 0 + + # - - - - main rule block - - - - + # at line 329:5: '=' + match(?=) - @index = 0; - end + + @state.type = type + @state.channel = channel - # returns a Fixnum between 0 and 0xFFFF or :EOF - def look_ahead(pos) - offset = @index + pos - 1 - if @buffer.length < offset + 1 - char = @input.read(offset + 1 - @buffer.length) - @buffer << char if not char.nil? - end + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 1) - if offset < @buffer.length - @buffer[offset] - else - :EOF - end - end + end - def mark - @state = { :index => @index, :line => @line, :column => @column } - return 0 - end + # lexer rule lt! (LT) + # (in ExcelFormula.g) + def lt! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 2) - def rewind(marker) - @index = @state[:index] - @line = @state[:line] - @column = @state[:column] - end + type = LT + channel = ANTLR3::DEFAULT_CHANNEL - def consume - look_ahead(1) # force a read from the input if necessary - @column = @column + 1 - if @buffer[@index] == ?\n - @line = @line + 1 - @column = 0 - end - @index = @index + 1 - end + + # - - - - main rule block - - - - + # at line 330:5: '<' + match(?<) - def substring(start, stop) - @buffer.slice(start, stop - start + 1) - end + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 2) + end + # lexer rule gt! (GT) + # (in ExcelFormula.g) + def gt! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 3) - def match(value = nil) - @failed = false - case - when value.nil? - @input.consume() - when value.respond_to?(:to_str) - catch(:done) do - value.each_byte do |c| - @failed ||= !(@input.look_ahead(1) == c) - @input.consume() if !@failed - throw :done if @failed - end - end - else - @failed = !(@input.look_ahead(1) == value) - @input.consume() if !@failed - end + type = GT + channel = ANTLR3::DEFAULT_CHANNEL - if @failed && @backtracking <= 0 - raise "Expected #{value.respond_to?(:chr) ? value.chr : value}" - end - end + + # - - - - main rule block - - - - + # at line 331:5: '>' + match(?>) - def match_range(from, to) - char = @input.look_ahead(1) + + @state.type = type + @state.channel = channel - if char != :EOF && (char >= from || char <= to) - @failed = false - match() - elsif @backtracking > 0 - @failed = true - else - raise "Expected [#{from.chr}..#{to.chr}]" - end + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 3) + end - def match_EQ() + # lexer rule ne! (NE) + # (in ExcelFormula.g) + def ne! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 4) - # 332:5: '=' - match(?=) + type = NE + channel = ANTLR3::DEFAULT_CHANNEL - end + + # - - - - main rule block - - - - + # at line 332:5: '<>' + match("<>") - def match_LT() + + @state.type = type + @state.channel = channel - @type = :LT - @type_int = LT - # 333:5: '<' - match(?<) + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 4) + end - def match_GT() + # lexer rule le! (LE) + # (in ExcelFormula.g) + def le! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 5) - @type = :GT - @type_int = GT - # 334:5: '>' - match(?>) - end + type = LE + channel = ANTLR3::DEFAULT_CHANNEL - def match_NE() + + # - - - - main rule block - - - - + # at line 333:5: '<=' + match("<=") - @type = :NE - @type_int = NE - # 335:5: '<>' - match("<>") + + @state.type = type + @state.channel = channel + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 5) + end - def match_LE() + # lexer rule ge! (GE) + # (in ExcelFormula.g) + def ge! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 6) - @type = :LE - @type_int = LE - # 336:5: '<=' - match("<=") + type = GE + channel = ANTLR3::DEFAULT_CHANNEL - end + + # - - - - main rule block - - - - + # at line 334:5: '>=' + match(">=") - def match_GE() + + @state.type = type + @state.channel = channel - @type = :GE - @type_int = GE - # 337:5: '>=' - match(">=") + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 6) end - def match_ADD() + # lexer rule add! (ADD) + # (in ExcelFormula.g) + def add! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 7) - @type = :ADD - @type_int = ADD - # 339:6: '+' - match(?+) - end + type = ADD + channel = ANTLR3::DEFAULT_CHANNEL - def match_SUB() + + # - - - - main rule block - - - - + # at line 336:6: '+' + match(?+) - @type = :SUB - @type_int = SUB - # 340:6: '-' - match(?-) + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 7) + end - def match_MUL() + # lexer rule sub! (SUB) + # (in ExcelFormula.g) + def sub! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 8) - @type = :MUL - @type_int = MUL - # 341:6: '*' - match(?*) + type = SUB + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 337:6: '-' + match(?-) + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 8) + end - def match_DIV() + # lexer rule mul! (MUL) + # (in ExcelFormula.g) + def mul! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 9) - @type = :DIV - @type_int = DIV - # 342:6: '/' - match(?/) + type = MUL + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 338:6: '*' + match(?*) + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 9) + end - def match_COLON() + # lexer rule div! (DIV) + # (in ExcelFormula.g) + def div! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 10) - @type = :COLON - @type_int = COLON - # 344:8: ':' - match(?:) + type = DIV + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 339:6: '/' + match(?/) + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 10) + end - def match_SEMICOLON() + # lexer rule colon! (COLON) + # (in ExcelFormula.g) + def colon! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 11) - @type = :SEMICOLON - @type_int = SEMICOLON - # 345:12: ';' - match(?;) + type = COLON + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 341:8: ':' + match(?:) + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 11) + end - def match_COMMA() + # lexer rule semicolon! (SEMICOLON) + # (in ExcelFormula.g) + def semicolon! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 12) - @type = :COMMA - @type_int = COMMA - # 346:8: ',' - match(?,) + type = SEMICOLON + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 342:12: ';' + match(?;) + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 12) + end - def match_LP() + # lexer rule comma! (COMMA) + # (in ExcelFormula.g) + def comma! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 13) - @type = :LP - @type_int = LP - # 348:5: '(' - match(?() + type = COMMA + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 343:8: ',' + match(?,) + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 13) + end - def match_RP() + # lexer rule lp! (LP) + # (in ExcelFormula.g) + def lp! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 14) - @type = :RP - @type_int = RP - # 349:5: ')' - match(?)) + type = LP + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 345:5: '(' + match(?() + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 14) + end - def match_CONCAT() + # lexer rule rp! (RP) + # (in ExcelFormula.g) + def rp! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 15) - @type = :CONCAT - @type_int = CONCAT - # 350:9: '&' - match(?&) + type = RP + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 346:5: ')' + match(?)) + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 15) + end - def match_PERCENT() + # lexer rule concat! (CONCAT) + # (in ExcelFormula.g) + def concat! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 16) - @type = :PERCENT - @type_int = PERCENT - # 351:10: '%' - match(?%) + type = CONCAT + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 347:9: '&' + match(?&) + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 16) + end - def match_POWER() + # lexer rule percent! (PERCENT) + # (in ExcelFormula.g) + def percent! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 17) - @type = :POWER - @type_int = POWER - # 352:8: '^' - match(?^) + type = PERCENT + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 348:10: '%' + match(?%) + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 17) + end - def match_BANG() + # lexer rule power! (POWER) + # (in ExcelFormula.g) + def power! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 18) - @type = :BANG - @type_int = BANG - # 353:7: '!' - match(?!) + type = POWER + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 349:8: '^' + match(?^) + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 18) + end - def match_DIGIT() + # lexer rule bang! (BANG) + # (in ExcelFormula.g) + def bang! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 19) - @type = :DIGIT - @type_int = DIGIT - # 355:8: '0' .. '9' - match_range(?0, ?9) + type = BANG + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 350:7: '!' + match(?!) + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 19) + end - def match_INT_CONST() + # lexer rule digit! (DIGIT) + # (in ExcelFormula.g) + def digit! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 20) - @type = :INT_CONST - @type_int = INT_CONST - # 357:12: ( DIGIT )+ - # 357:12: ( DIGIT )+ - matchedOnce1 = false - while true - alt1 = 2 - # - look_ahead1_0 = @input.look_ahead(1) - look_ahead1_0 = -1 if look_ahead1_0 == :EOF - if (look_ahead1_0 >= ?0 && look_ahead1_0 <= ?9) - alt1 = 1 - end - case alt1 - when 1 - # 357:12: DIGIT - match_DIGIT() - else - break - end - matchedOnce1 = true - end + + # - - - - main rule block - - - - + # at line 352:17: '0' .. '9' + match_range(?0, ?9) - if !matchedOnce1 - raise "Expected at least one match: 357:12: ( DIGIT )+" - end + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 20) + end - def match_NUM_CONST() + # lexer rule int_const! (INT_CONST) + # (in ExcelFormula.g) + def int_const! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 21) - @type = :NUM_CONST - @type_int = NUM_CONST - # 358:12: ( DIGIT )* '.' ( DIGIT )+ ( ( 'E' | 'e' ) ( '+' | '-' )? ( DIGIT )+ )? - # 358:12: ( DIGIT )* - while true - alt2 = 2 - # - look_ahead2_0 = @input.look_ahead(1) - look_ahead2_0 = -1 if look_ahead2_0 == :EOF - if (look_ahead2_0 >= ?0 && look_ahead2_0 <= ?9) - alt2 = 1 - end - case alt2 - when 1 - # 358:12: DIGIT - match_DIGIT() - else - break - end - end - match(?.) - # 358:23: ( DIGIT )+ - matchedOnce3 = false - while true - alt3 = 2 - # - look_ahead3_0 = @input.look_ahead(1) - look_ahead3_0 = -1 if look_ahead3_0 == :EOF - if (look_ahead3_0 >= ?0 && look_ahead3_0 <= ?9) - alt3 = 1 - end - case alt3 - when 1 - # 358:23: DIGIT - match_DIGIT() - else - break - end - matchedOnce3 = true - end + type = INT_CONST + channel = ANTLR3::DEFAULT_CHANNEL - if !matchedOnce3 - raise "Expected at least one match: 358:23: ( DIGIT )+" - end - # 358:30: ( ( 'E' | 'e' ) ( '+' | '-' )? ( DIGIT )+ )? - alt6 = 2 - # - look_ahead6_0 = @input.look_ahead(1) + + # - - - - main rule block - - - - + # at line 354:12: ( DIGIT )+ + # at file 354:12: ( DIGIT )+ + match_count_1 = 0 + loop do + alt_1 = 2 + look_1_0 = @input.peek(1) - look_ahead6_0 = -1 if look_ahead6_0 == :EOF - if look_ahead6_0 == ?E || look_ahead6_0 == ?e - alt6 = 1 - end - case alt6 - when 1 - # 358:31: ( 'E' | 'e' ) ( '+' | '-' )? ( DIGIT )+ - if @input.look_ahead(1) == ?E || @input.look_ahead(1) == ?e - match() - else - raise "Expected set" - end - # 358:41: ( '+' | '-' )? - alt4 = 2 - # - look_ahead4_0 = @input.look_ahead(1) + if (look_1_0.between?(?0, ?9)) + alt_1 = 1 - look_ahead4_0 = -1 if look_ahead4_0 == :EOF - if look_ahead4_0 == ?+ || look_ahead4_0 == ?- - alt4 = 1 - end - case alt4 - when 1 - # - if @input.look_ahead(1) == ?+ || @input.look_ahead(1) == ?- - match() - else - raise "Expected set" - end - end - # 358:52: ( DIGIT )+ - matchedOnce5 = false - while true - alt5 = 2 - # - look_ahead5_0 = @input.look_ahead(1) - look_ahead5_0 = -1 if look_ahead5_0 == :EOF - if (look_ahead5_0 >= ?0 && look_ahead5_0 <= ?9) - alt5 = 1 - end - case alt5 - when 1 - # 358:52: DIGIT - match_DIGIT() - else - break - end - matchedOnce5 = true - end + end + case alt_1 + when 1 + # at line 354:12: DIGIT + digit! - if !matchedOnce5 - raise "Expected at least one match: 358:52: ( DIGIT )+" - end - end + else + match_count_1 > 0 and break + eee = EarlyExit(1) + + + raise eee + end + match_count_1 += 1 + end + + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 21) + end - def match_STR_CONST() + # lexer rule num_const! (NUM_CONST) + # (in ExcelFormula.g) + def num_const! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 22) - @type = :STR_CONST - @type_int = STR_CONST - # 359:12: '\"' ~ '\"' '\"' - match(?") - if (@input.look_ahead(1) >= 0x0000 && @input.look_ahead(1) <= ?!) || (@input.look_ahead(1) >= ?# && @input.look_ahead(1) <= 0x00FF) - match() - else - raise "Expected set" - end - match(?") + type = NUM_CONST + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 355:12: ( DIGIT )* '.' ( DIGIT )+ ( ( 'E' | 'e' ) ( '+' | '-' )? ( DIGIT )+ )? + # at line 355:12: ( DIGIT )* + loop do # decision 2 + alt_2 = 2 + look_2_0 = @input.peek(1) + + if (look_2_0.between?(?0, ?9)) + alt_2 = 1 + + end + case alt_2 + when 1 + # at line 355:12: DIGIT + digit! + + else + break # out of loop for decision 2 + end + end # loop for decision 2 + match(?.) + # at file 355:23: ( DIGIT )+ + match_count_3 = 0 + loop do + alt_3 = 2 + look_3_0 = @input.peek(1) + + if (look_3_0.between?(?0, ?9)) + alt_3 = 1 + + end + case alt_3 + when 1 + # at line 355:23: DIGIT + digit! + + else + match_count_3 > 0 and break + eee = EarlyExit(3) + + + raise eee + end + match_count_3 += 1 + end + + # at line 355:30: ( ( 'E' | 'e' ) ( '+' | '-' )? ( DIGIT )+ )? + alt_6 = 2 + look_6_0 = @input.peek(1) + + if (look_6_0 == ?E || look_6_0 == ?e) + alt_6 = 1 + end + case alt_6 + when 1 + # at line 355:31: ( 'E' | 'e' ) ( '+' | '-' )? ( DIGIT )+ + if @input.peek(1) == ?E || @input.peek(1) == ?e + @input.consume + else + mse = MismatchedSet(nil) + recover(mse) + raise mse + end + + + # at line 355:41: ( '+' | '-' )? + alt_4 = 2 + look_4_0 = @input.peek(1) + + if (look_4_0 == ?+ || look_4_0 == ?-) + alt_4 = 1 + end + case alt_4 + when 1 + # at line + if @input.peek(1) == ?+ || @input.peek(1) == ?- + @input.consume + else + mse = MismatchedSet(nil) + recover(mse) + raise mse + end + + + + end + # at file 355:52: ( DIGIT )+ + match_count_5 = 0 + loop do + alt_5 = 2 + look_5_0 = @input.peek(1) + + if (look_5_0.between?(?0, ?9)) + alt_5 = 1 + + end + case alt_5 + when 1 + # at line 355:52: DIGIT + digit! + + else + match_count_5 > 0 and break + eee = EarlyExit(5) + + + raise eee + end + match_count_5 += 1 + end + + + end + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 22) + end - def match_REF2D() + # lexer rule str_const! (STR_CONST) + # (in ExcelFormula.g) + def str_const! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 23) - @type = :REF2D - @type_int = REF2D - # 360:8: ( '$' )? ( 'A' .. 'I' )? ( 'A' .. 'Z' ) ( '$' )? ( DIGIT )+ - # 360:8: ( '$' )? - alt7 = 2 - # - look_ahead7_0 = @input.look_ahead(1) + type = STR_CONST + channel = ANTLR3::DEFAULT_CHANNEL - look_ahead7_0 = -1 if look_ahead7_0 == :EOF - if look_ahead7_0 == ?$ - alt7 = 1 - end - case alt7 - when 1 - # 360:8: '$' - match(?$) - end - # 360:13: ( 'A' .. 'I' )? - alt8 = 2 - # - look_ahead8_0 = @input.look_ahead(1) + + # - - - - main rule block - - - - + # at line 356:12: '\"' (~ '\"' )+ '\"' + match(?") + # at file 356:16: (~ '\"' )+ + match_count_7 = 0 + loop do + alt_7 = 2 + look_7_0 = @input.peek(1) - look_ahead8_0 = -1 if look_ahead8_0 == :EOF - if (look_ahead8_0 >= ?A && look_ahead8_0 <= ?I) - # - look_ahead8_1 = @input.look_ahead(2) + if (look_7_0.between?(0x0000, ?!) || look_7_0.between?(?#, 0xFFFF)) + alt_7 = 1 - look_ahead8_1 = -1 if look_ahead8_1 == :EOF - if (look_ahead8_1 >= ?A && look_ahead8_1 <= ?Z) - alt8 = 1 - end - end - case alt8 - when 1 - # 360:14: 'A' .. 'I' - match_range(?A, ?I) - end - # 360:26: 'A' .. 'Z' - match_range(?A, ?Z) - # 360:36: ( '$' )? - alt9 = 2 - # - look_ahead9_0 = @input.look_ahead(1) + end + case alt_7 + when 1 + # at line 356:17: ~ '\"' + if @input.peek(1).between?(0x0000, ?!) || @input.peek(1).between?(?#, 0x00FF) + @input.consume + else + mse = MismatchedSet(nil) + recover(mse) + raise mse + end - look_ahead9_0 = -1 if look_ahead9_0 == :EOF - if look_ahead9_0 == ?$ - alt9 = 1 - end - case alt9 - when 1 - # 360:36: '$' - match(?$) - end - # 360:41: ( DIGIT )+ - matchedOnce10 = false - while true - alt10 = 2 - # - look_ahead10_0 = @input.look_ahead(1) - look_ahead10_0 = -1 if look_ahead10_0 == :EOF - if (look_ahead10_0 >= ?0 && look_ahead10_0 <= ?9) - alt10 = 1 - end - case alt10 - when 1 - # 360:41: DIGIT - match_DIGIT() - else - break - end - matchedOnce10 = true - end - if !matchedOnce10 - raise "Expected at least one match: 360:41: ( DIGIT )+" - end + + else + match_count_7 > 0 and break + eee = EarlyExit(7) + + + raise eee + end + match_count_7 += 1 + end + + match(?") + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 23) + end - def match_TRUE_CONST() + # lexer rule ref_2_d! (REF2D) + # (in ExcelFormula.g) + def ref_2_d! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 24) - @type = :TRUE_CONST - @type_int = TRUE_CONST - # 361:13: ( 'T' | 't' ) ( 'R' | 'r' ) ( 'U' | 'u' ) ( 'E' | 'e' ) - if @input.look_ahead(1) == ?T || @input.look_ahead(1) == ?t - match() - else - raise "Expected set" - end - if @input.look_ahead(1) == ?R || @input.look_ahead(1) == ?r - match() - else - raise "Expected set" - end - if @input.look_ahead(1) == ?U || @input.look_ahead(1) == ?u - match() - else - raise "Expected set" - end - if @input.look_ahead(1) == ?E || @input.look_ahead(1) == ?e - match() - else - raise "Expected set" - end + type = REF2D + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 357:8: ( '$' )? ( 'A' .. 'I' )? ( 'A' .. 'Z' ) ( '$' )? ( DIGIT )+ + # at line 357:8: ( '$' )? + alt_8 = 2 + look_8_0 = @input.peek(1) + + if (look_8_0 == ?$) + alt_8 = 1 + end + case alt_8 + when 1 + # at line 357:8: '$' + match(?$) + + end + # at line 357:13: ( 'A' .. 'I' )? + alt_9 = 2 + look_9_0 = @input.peek(1) + + if (look_9_0.between?(?A, ?I)) + look_9_1 = @input.peek(2) + + if (look_9_1.between?(?A, ?Z)) + alt_9 = 1 + end + end + case alt_9 + when 1 + # at line 357:14: 'A' .. 'I' + match_range(?A, ?I) + + end + # at line 357:25: ( 'A' .. 'Z' ) + # at line 357:26: 'A' .. 'Z' + match_range(?A, ?Z) + + # at line 357:36: ( '$' )? + alt_10 = 2 + look_10_0 = @input.peek(1) + + if (look_10_0 == ?$) + alt_10 = 1 + end + case alt_10 + when 1 + # at line 357:36: '$' + match(?$) + + end + # at file 357:41: ( DIGIT )+ + match_count_11 = 0 + loop do + alt_11 = 2 + look_11_0 = @input.peek(1) + + if (look_11_0.between?(?0, ?9)) + alt_11 = 1 + + end + case alt_11 + when 1 + # at line 357:41: DIGIT + digit! + + else + match_count_11 > 0 and break + eee = EarlyExit(11) + + + raise eee + end + match_count_11 += 1 + end + + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 24) + end - def match_FALSE_CONST() + # lexer rule true_const! (TRUE_CONST) + # (in ExcelFormula.g) + def true_const! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 25) - @type = :FALSE_CONST - @type_int = FALSE_CONST - # 362:14: ( 'F' | 'f' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'S' | 's' ) ( 'E' | 'e' ) - if @input.look_ahead(1) == ?F || @input.look_ahead(1) == ?f - match() - else - raise "Expected set" - end - if @input.look_ahead(1) == ?A || @input.look_ahead(1) == ?a - match() - else - raise "Expected set" - end - if @input.look_ahead(1) == ?L || @input.look_ahead(1) == ?l - match() - else - raise "Expected set" - end - if @input.look_ahead(1) == ?S || @input.look_ahead(1) == ?s - match() - else - raise "Expected set" - end - if @input.look_ahead(1) == ?E || @input.look_ahead(1) == ?e - match() - else - raise "Expected set" - end + type = TRUE_CONST + channel = ANTLR3::DEFAULT_CHANNEL + + + # - - - - main rule block - - - - + # at line 358:13: ( 'T' | 't' ) ( 'R' | 'r' ) ( 'U' | 'u' ) ( 'E' | 'e' ) + if @input.peek(1) == ?T || @input.peek(1) == ?t + @input.consume + else + mse = MismatchedSet(nil) + recover(mse) + raise mse + end + + + if @input.peek(1) == ?R || @input.peek(1) == ?r + @input.consume + else + mse = MismatchedSet(nil) + recover(mse) + raise mse + end + + + if @input.peek(1) == ?U || @input.peek(1) == ?u + @input.consume + else + mse = MismatchedSet(nil) + recover(mse) + raise mse + end + + + if @input.peek(1) == ?E || @input.peek(1) == ?e + @input.consume + else + mse = MismatchedSet(nil) + recover(mse) + raise mse + end + + + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 25) + end - def match_NAME() + # lexer rule false_const! (FALSE_CONST) + # (in ExcelFormula.g) + def false_const! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 26) - @type = :NAME - @type_int = NAME - # 363:7: '\\w[\\.\\w]*' - match("w[.w]*") + type = FALSE_CONST + channel = ANTLR3::DEFAULT_CHANNEL + + # - - - - main rule block - - - - + # at line 359:14: ( 'F' | 'f' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'S' | 's' ) ( 'E' | 'e' ) + if @input.peek(1) == ?F || @input.peek(1) == ?f + @input.consume + else + mse = MismatchedSet(nil) + recover(mse) + raise mse + end + + + if @input.peek(1) == ?A || @input.peek(1) == ?a + @input.consume + else + mse = MismatchedSet(nil) + recover(mse) + raise mse + end + + + if @input.peek(1) == ?L || @input.peek(1) == ?l + @input.consume + else + mse = MismatchedSet(nil) + recover(mse) + raise mse + end + + + if @input.peek(1) == ?S || @input.peek(1) == ?s + @input.consume + else + mse = MismatchedSet(nil) + recover(mse) + raise mse + end + + + if @input.peek(1) == ?E || @input.peek(1) == ?e + @input.consume + else + mse = MismatchedSet(nil) + recover(mse) + raise mse + end + + + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 26) + end - def match_QUOTENAME() + # lexer rule name! (NAME) + # (in ExcelFormula.g) + def name! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 27) - @type = :QUOTENAME - @type_int = QUOTENAME - # 364:12: '\\'(?:[^\\']|\\'\\')*\\'' - match("'(?:[^']|'')*'") + type = NAME + channel = ANTLR3::DEFAULT_CHANNEL + + # - - - - main rule block - - - - + # at line 360:7: '\\w[\\.\\w]*' + match("w[.w]*") + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 27) + end - def match_FUNC_IF() + # lexer rule quotename! (QUOTENAME) + # (in ExcelFormula.g) + def quotename! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 28) - @type = :FUNC_IF - @type_int = FUNC_IF - # 365:10: 'IF' - match("IF") + type = QUOTENAME + channel = ANTLR3::DEFAULT_CHANNEL + + # - - - - main rule block - - - - + # at line 361:12: '\\'(?:[^\\']|\\'\\')*\\'' + match("'(?:[^']|'')*'") + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 28) + end - def match_FUNC_CHOOSE() + # lexer rule func_if! (FUNC_IF) + # (in ExcelFormula.g) + def func_if! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 29) - @type = :FUNC_CHOOSE - @type_int = FUNC_CHOOSE - # 366:14: 'CHOOSE' - match("CHOOSE") + type = FUNC_IF + channel = ANTLR3::DEFAULT_CHANNEL + + # - - - - main rule block - - - - + # at line 362:10: 'IF' + match("IF") + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 29) + end - def match_Tokens() + # lexer rule func_choose! (FUNC_CHOOSE) + # (in ExcelFormula.g) + def func_choose! + # -> uncomment the next line to manually enable rule tracing + # trace_in(__method__, 30) - # 1:8: ( LT | GT | NE | LE | GE | ADD | SUB | MUL | DIV | COLON | SEMICOLON | COMMA | LP | RP | CONCAT | PERCENT | POWER | BANG | DIGIT | INT_CONST | NUM_CONST | STR_CONST | REF2D | TRUE_CONST | FALSE_CONST | NAME | QUOTENAME | FUNC_IF | FUNC_CHOOSE ) - alt11 = 29 - alt11 = DFA11.predict(self, @input) - case alt11 - when 1 - # 1:10: LT - match_LT() - when 2 - # 1:13: GT - match_GT() - when 3 - # 1:16: NE - match_NE() - when 4 - # 1:19: LE - match_LE() - when 5 - # 1:22: GE - match_GE() - when 6 - # 1:25: ADD - match_ADD() - when 7 - # 1:29: SUB - match_SUB() - when 8 - # 1:33: MUL - match_MUL() - when 9 - # 1:37: DIV - match_DIV() - when 10 - # 1:41: COLON - match_COLON() - when 11 - # 1:47: SEMICOLON - match_SEMICOLON() - when 12 - # 1:57: COMMA - match_COMMA() - when 13 - # 1:63: LP - match_LP() - when 14 - # 1:66: RP - match_RP() - when 15 - # 1:69: CONCAT - match_CONCAT() - when 16 - # 1:76: PERCENT - match_PERCENT() - when 17 - # 1:84: POWER - match_POWER() - when 18 - # 1:90: BANG - match_BANG() - when 19 - # 1:95: DIGIT - match_DIGIT() - when 20 - # 1:101: INT_CONST - match_INT_CONST() - when 21 - # 1:111: NUM_CONST - match_NUM_CONST() - when 22 - # 1:121: STR_CONST - match_STR_CONST() - when 23 - # 1:131: REF2D - match_REF2D() - when 24 - # 1:137: TRUE_CONST - match_TRUE_CONST() - when 25 - # 1:148: FALSE_CONST - match_FALSE_CONST() - when 26 - # 1:160: NAME - match_NAME() - when 27 - # 1:165: QUOTENAME - match_QUOTENAME() - when 28 - # 1:175: FUNC_IF - match_FUNC_IF() - when 29 - # 1:183: FUNC_CHOOSE - match_FUNC_CHOOSE() - end + type = FUNC_CHOOSE + channel = ANTLR3::DEFAULT_CHANNEL + + # - - - - main rule block - - - - + # at line 363:14: 'CHOOSE' + match("CHOOSE") + + + @state.type = type + @state.channel = channel + + ensure + # -> uncomment the next line to manually enable rule tracing + # trace_out(__method__, 30) + end + # main rule used to study the input at the current position, + # and choose the proper lexer rule to call in order to + # fetch the next token + # + # usually, you don't make direct calls to this method, + # but instead use the next_token method, which will + # build and emit the actual next token + def token! + # 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 | NAME | QUOTENAME | FUNC_IF | FUNC_CHOOSE ) + alt_12 = 29 + alt_12 = @dfa12.predict(@input) + case alt_12 + when 1 + # at line 1:10: EQ + eq! - class DFA - def initialize(eot, eof, min, max, accept, special, transition) - @eot = eot - @eof = eof - @min = min - @max = max - @accept = accept - @special = special - @transition = transition - end + when 2 + # at line 1:13: LT + lt! - def predict(parser, input) - mark = input.mark() - s = 0 # we always start at s0 - begin - loop do - special_state = @special[s] - if special_state >= 0 - s = parser.special_state_transition(special_state) - input.consume() - next - end + when 3 + # at line 1:16: GT + gt! - if @accept[s] >= 1 - return @accept[s] - end + when 4 + # at line 1:19: NE + ne! - # look for a normal char transition - c = input.look_ahead(1).to_i - if c != :EOF && c >= @min[s] && c <= @max[s] - next_state = @transition[s][c - @min[s]] # move to next state - if next_state < 0 - # was in range but not a normal transition - # must check EOT, which is like the else clause. - # eot[s]>=0 indicates that an EOT edge goes to another - # state. - if @eot[s] >= 0 # EOT Transition to accept state? - s = @eot[s] - input.consume() - next - end - raise "No viable alt" - end - s = next_state - input.consume() - next - end - if @eot[s] >= 0 # EOT Transition? - s = @eot[s] - input.consume() - next - end - if c == :EOF && @eof[s] >= 0 # EOF Transition to accept state? - return @accept[@eof[s]] - end + when 5 + # at line 1:22: LE + le! - # not in range and not EOF/EOT, must be invalid symbol - raise "No viable alt" - end - ensure - input.rewind(mark) - end - end - end + when 6 + # at line 1:25: GE + ge! - DFA11 = DFA.new( - [-1,30,32,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,33,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,38,-1,39,-1,-1,-1,-1], - [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], - [0,61,61,0,0,0,0,0,0,0,0,0,0,0,0,0,46,0,0,0,36,36,0,36,0,0,0,36, - 0,0,0,0,0,0,46,36,36,36,0,0,0], - [116,62,61,0,0,0,0,0,0,0,0,0,0,0,0,0,57,0,0,0,97,114,0,90,0,0,0, - 90,0,0,0,0,0,0,57,108,57,79,0,0,0], - [-1,-1,-1,6,7,8,9,10,11,12,13,14,15,16,17,18,-1,21,22,23,-1,-1,24, - -1,25,26,27,-1,3,4,1,5,2,19,-1,-1,-1,-1,20,28,29], - [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], - [ - [25,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,15,18,-1,19,13,12, - 26,10,11,5,3,9,4,17,6,16,16,16,16,16,16,16,16,16,16,7,8, - 1,-1,2,-1,-1,19,19,27,19,19,20,19,19,23,19,19,19,19,19, - 19,19,19,19,19,21,19,19,19,19,19,19,-1,-1,-1,14,-1,-1,-1, - -1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,22], - [29,28], - [31], - [], - [], - [], - [], - [], - [], - [], - [], - [], - [], - [], - [], - [], - [17,-1,34,34,34,34,34,34,34,34,34,34], - [], - [], - [], - [19,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,19,19,19,19,19,19,19,19, - 19,19,-1,-1,-1,-1,-1,-1,-1,35,19,19,19,19,19,19,19,19,19, - 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,-1,-1,-1, - -1,-1,-1,24], - [19,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,19,19,19,19,19,19,19,19, - 19,19,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,22,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,22], - [], - [19,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,19,19,19,19,19,19,19,19, - 19,19,-1,-1,-1,-1,-1,-1,-1,19,19,19,19,19,36,19,19,19,19, - 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19], - [], - [], - [], - [19,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,19,19,19,19,19,19,19,19, - 19,19,-1,-1,-1,-1,-1,-1,-1,19,19,19,19,19,19,19,37,19,19, - 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19], - [], - [], - [], - [], - [], - [], - [17,-1,34,34,34,34,34,34,34,34,34,34], - [19,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,19,19,19,19,19,19,19,19, - 19,19,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,24,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,24], - [19,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,19,19,19,19,19,19,19,19, - 19,19], - [19,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,19,19,19,19,19,19,19,19, - 19,19,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,40], - [], - [], - [] - ]) + when 7 + # at line 1:28: ADD + add! - def special_state_transition(s) - -1 + when 8 + # at line 1:32: SUB + sub! + + when 9 + # at line 1:36: MUL + mul! + + when 10 + # at line 1:40: DIV + div! + + when 11 + # at line 1:44: COLON + colon! + + when 12 + # at line 1:50: SEMICOLON + semicolon! + + when 13 + # at line 1:60: COMMA + comma! + + when 14 + # at line 1:66: LP + lp! + + when 15 + # at line 1:69: RP + rp! + + when 16 + # at line 1:72: CONCAT + concat! + + when 17 + # at line 1:79: PERCENT + percent! + + when 18 + # at line 1:87: POWER + power! + + when 19 + # at line 1:93: BANG + bang! + + when 20 + # at line 1:98: INT_CONST + int_const! + + when 21 + # at line 1:108: NUM_CONST + num_const! + + when 22 + # at line 1:118: STR_CONST + str_const! + + when 23 + # at line 1:128: REF2D + ref_2_d! + + when 24 + # at line 1:134: TRUE_CONST + true_const! + + when 25 + # at line 1:145: FALSE_CONST + false_const! + + when 26 + # at line 1:157: NAME + name! + + when 27 + # at line 1:162: QUOTENAME + quotename! + + when 28 + # at line 1:172: FUNC_IF + func_if! + + when 29 + # at line 1:180: FUNC_CHOOSE + func_choose! + + end end - public :special_state_transition -end \ No newline at end of file + + # - - - - - - - - - - DFA definitions - - - - - - - - - - - + class DFA12 < ANTLR3::DFA + EOT = unpack(2, -1, 1, 31, 1, 33, 13, -1, 1, 34, 18, -1, 1, 38, 3, + -1) + EOF = unpack(40, -1) + MIN = unpack(1, 0, 1, -1, 2, 61, 13, -1, 1, 46, 3, -1, 2, 36, 1, -1, + 1, 36, 3, -1, 1, 36, 6, -1, 3, 36, 2, -1) + MAX = unpack(1, 116, 1, -1, 1, 62, 1, 61, 13, -1, 1, 57, 3, -1, 1, + 97, 1, 114, 1, -1, 1, 90, 3, -1, 1, 90, 6, -1, 1, 108, + 1, 57, 1, 79, 2, -1) + ACCEPT = unpack(1, -1, 1, 1, 2, -1, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, + 1, 12, 1, 13, 1, 14, 1, 15, 1, 16, 1, 17, 1, 18, 1, + 19, 1, -1, 1, 21, 1, 22, 1, 23, 2, -1, 1, 24, 1, -1, + 1, 25, 1, 26, 1, 27, 1, -1, 1, 4, 1, 5, 1, 2, 1, 6, + 1, 3, 1, 20, 3, -1, 1, 28, 1, 29) + SPECIAL = unpack(40, -1) + TRANSITION = [ + unpack(1, 26, 32, -1, 1, 16, 1, 19, 1, -1, 1, 20, 1, 14, 1, 13, + 1, 27, 1, 11, 1, 12, 1, 6, 1, 4, 1, 10, 1, 5, 1, 18, 1, 7, + 10, 17, 1, 8, 1, 9, 1, 2, 1, 1, 1, 3, 2, -1, 2, 20, 1, 28, + 2, 20, 1, 21, 2, 20, 1, 24, 10, 20, 1, 22, 6, 20, 3, -1, + 1, 15, 7, -1, 1, 25, 13, -1, 1, 23), + unpack(), + unpack(1, 30, 1, 29), + unpack(1, 32), + unpack(), + unpack(), + unpack(), + unpack(), + unpack(), + unpack(), + unpack(), + unpack(), + unpack(), + unpack(), + unpack(), + unpack(), + unpack(), + unpack(1, 18, 1, -1, 10, 17), + unpack(), + unpack(), + unpack(), + unpack(1, 20, 11, -1, 10, 20, 7, -1, 1, 35, 25, 20, 6, -1, 1, 25), + unpack(1, 20, 11, -1, 10, 20, 24, -1, 1, 23, 31, -1, 1, 23), + unpack(), + unpack(1, 20, 11, -1, 10, 20, 7, -1, 5, 20, 1, 36, 20, 20), + unpack(), + unpack(), + unpack(), + unpack(1, 20, 11, -1, 10, 20, 7, -1, 7, 20, 1, 37, 18, 20), + unpack(), + unpack(), + unpack(), + unpack(), + unpack(), + unpack(), + unpack(1, 20, 11, -1, 10, 20, 18, -1, 1, 25, 31, -1, 1, 25), + unpack(1, 20, 11, -1, 10, 20), + unpack(1, 20, 11, -1, 10, 20, 21, -1, 1, 39), + unpack(), + unpack() + ].freeze + + ( 0 ... MIN.length ).zip( MIN, MAX ) do | i, a, z | + if a > 0 and z < 0 + MAX[ i ] %= 0x10000 + end + end + + @decision = 12 + + + def description + <<-'__dfa_description__'.strip! + 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 | NAME | QUOTENAME | FUNC_IF | FUNC_CHOOSE ); + __dfa_description__ + end + end + + + private + + def initialize_dfas + super rescue nil + @dfa12 = DFA12.new(self, 12) + + end + end # class Lexer < ANTLR3::Lexer + + at_exit { Lexer.main(ARGV) } if __FILE__ == $0 +end +