Method: ExcelFormula::Parser#prec5_expr

Defined in:
lib/surpass/ExcelFormulaParser.rb

#prec5_expr(arg_type) ⇒ Object

parser rule prec5_expr

(in ExcelFormula.g) 94:1: prec5_expr : ( primary | SUB primary );



565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
# File 'lib/surpass/ExcelFormulaParser.rb', line 565

def prec5_expr(arg_type)
  # -> uncomment the next line to manually enable rule tracing
  # trace_in(__method__, 8)

  begin
    # at line 95:5: ( primary[arg_type] | SUB primary[arg_type] )
    alt_10 = 2
    alt_10 = @dfa10.predict(@input)
    case alt_10
    when 1
      # at line 95:7: primary[arg_type]
      @state.following.push(TOKENS_FOLLOWING_primary_IN_prec5_expr_818)
      primary(arg_type)
      @state.following.pop

    when 2
      # at line 96:7: SUB primary[arg_type]
      match(SUB, TOKENS_FOLLOWING_SUB_IN_prec5_expr_827)
      @state.following.push(TOKENS_FOLLOWING_primary_IN_prec5_expr_829)
      primary(arg_type)
      @state.following.pop
      # --> action
       @rpn += [PTGUMINUS].pack('C') 
      # <-- action

    end
  rescue ANTLR3::Error::RecognitionError => re
    report_error(re)
    recover(re)

  ensure
    # -> uncomment the next line to manually enable rule tracing
    # trace_out(__method__, 8)

  end
  
  return 
end