<gh_stars>0
#!/usr/bin/python
########################################################################
# This file was automatically generated by fpg version 1.0.0-alpha1
########################################################################

import sys

try:
  ParserException
except NameError,e:
  class ParserException(Exception): pass
try:
  ParserFatalException
except NameError,e:
  class ParserFatalException(ParserException): pass
try:
  ParserWarningException
except NameError,e:
  class ParserWarningException(ParserException): pass
try:
  ActionFailedException
except NameError,e:
  class ActionFailedException(ParserFatalException): pass
try:
  FPGExpressionTuple
except NameError,e:
  class FPGExpressionTuple(tuple):
    def __repr__(self):
      return 'FPGXP' + super(FPGExpressionTuple,self).__repr__()
  FPGXP = FPGExpressionTuple

class fpgParser(object):

  def __init__(self):
    pass

  def debug(self, rulenum, states, values, lookahead, action):
    pass

  def initializeParser(self):
    pass

  def finalizeParser(self, value):
    return value

  def parse(self, lexer):
    self.lexer = lexer
    states = [ self.tables[u'actions'][None] ]
    values = []
    seen = []
    lookahead = None
    self.initializeParser()
    while len(states) == 1 or states[-1] > 0:
      if lookahead is None:
        lookahead = lexer.next()
      #print >> sys.stderr, "* parser states %s values %s lookahead %s" % (repr(states), repr(values), repr(lookahead))
      a = self.tables[u'actions'].get( (states[-1],-lookahead.token), None )
      if a is None or (len(values) > 0 and values[-1] is None):
        self._error_recovery(states, values, seen, lookahead)
      elif a < 0:
        rule = self.tables[u'rules'][-a]
        self.debug(-a, states, values, lookahead, rule[2])
        rulevars = values[-len(rule[1]):]
        states[-len(rule[1]):] = []
        values[-len(rule[1]):] = []
        # special stuff to allow the action processor to change the input source:
        # tell the lexer to save the lookahead
        self.lexer.push(lookahead)
        lookahead = None
        try:
          val = self._eval_action(rule[2], rulevars)
        except ActionFailedException,e:
          print >> sys.stderr, "Production action raised error: " + str(e)
          val = None
        states.append(self.tables[u'actions'][(states[-1],rule[0])])
        values.append(val)
      else:
        seen = seen[-9:] + [lookahead]
        states.append(a)
        values.append(lookahead.value)
        lookahead = None
    return self.finalizeParser(values[0])

  def _eval_action(self, action, rulevars):
    if not isinstance(action,tuple):
      if action is None:
        action_evaluation = rulevars[0]
      elif isinstance(action, list):
        action_evaluation = [self._eval_action(listitem,rulevars) for listitem in action]
      elif isinstance(action, (int,str,unicode)):
        action_evaluation = action
      else:
        raise ActionFailedException( "Unknown action type " + repr(action) )
    elif action[0] == u'$':
      action_evaluation = rulevars[int(action[1])-1]
    elif action[0] == u'(':
      meth = getattr(self,action[1],None)
      if meth is None:
        raise ActionFailedException( "Unknown method call " + repr(action[1]) )
      action_evaluation = self._eval_action(action[2], rulevars)
      if not isinstance(action_evaluation, list):
        raise ActionFailedException( "Invalid function call argument type " + repr(action_evaluation) )
      action_evaluation = meth(*(tuple(action_evaluation)))
    elif action[0] == u'+':
      a1 = self._eval_action(action[1], rulevars)
      a2 = self._eval_action(action[2], rulevars)
      if isinstance(a1,list):
        if isinstance(a2,list):
          action_evaluation = a1 + a2
        else:
          action_evaluation = a1 + [a2]
      elif isinstance(a2,list):
        action_evaluation = [a1] + a2
      elif isinstance(a1,int) and isinstance(a2,int):
        action_evaluation = a1 + a2
      else:
        action_evaluation = unicode(a1) + unicode(a2)
    elif action[0] == u'-':
      a1 = self._eval_action(action[1], rulevars)
      a2 = self._eval_action(action[2], rulevars)
      if isinstance(a1,int) and isinstance(a2,int):
        action_evaluation = a1 - a2
      else:
        raise ActionFailedException("Invalid operand types to - operator: " + ",".join([repr(a) for a in action[1:]]))
    elif action[0] == u'*':
      a1 = self._eval_action(action[1], rulevars)
      a2 = self._eval_action(action[2], rulevars)
      if isinstance(a1,int) and isinstance(a2,int):
        action_evaluation = a1 * a2
      else:
        raise ActionFailedException("Invalid operand types to * operator: " + ",".join([repr(a) for a in action[1:]]))
    elif action[0] == u'/':
      a1 = self._eval_action(action[1], rulevars)
      a2 = self._eval_action(action[2], rulevars)
      if isinstance(a1,int) and isinstance(a2,int):
        action_evaluation = a1 / a2
      else:
        raise ActionFailedException("Invalid operand types to / operator: " + ",".join([repr(a) for a in action[1:]]))
    elif action[0] == u'%':
      a1 = self._eval_action(action[1], rulevars)
      a2 = self._eval_action(action[2], rulevars)
      if isinstance(a1,int) and isinstance(a2,int):
        action_evaluation = a1 % a2
      else:
        raise ActionFailedException("Invalid operand types to % operator: " + ",".join([repr(a) for a in action[1:]]))
    elif action[0] == u'=':
      return tuple([self._eval_action(a,rulevars) for a in action])
    else:
      raise ActionFailedException( "Unknown action list type " + repr(action) )
    return action_evaluation

  tables={
'actions':{
None:0,
(0,-2):6,
(0,-1):5,
(0,1):1,
(0,2):2,
(0,3):3,
(0,10):4,
(1,-2):6,
(1,-1):5,
(1,0):0,
(1,2):7,
(1,3):3,
(1,10):4,
(2,-2):-1,
(2,-1):-1,
(2,0):-1,
(3,-2):-3,
(3,-1):-3,
(3,0):-3,
(4,-2):-4,
(4,-1):-4,
(4,0):-4,
(5,-15):8,
(6,-7):14,
(6,-6):13,
(6,-5):16,
(6,-4):17,
(6,-1):15,
(6,4):9,
(6,5):10,
(6,6):11,
(6,7):12,
(7,-2):-2,
(7,-1):-2,
(7,0):-2,
(8,-1):21,
(8,11):18,
(8,12):19,
(8,13):20,
(9,-2):-5,
(9,-1):-5,
(9,0):-5,
(10,-11):23,
(10,-10):22,
(10,-2):-6,
(10,-1):-6,
(10,0):-6,
(11,-14):26,
(11,-13):24,
(11,-12):25,
(11,-11):-8,
(11,-10):-8,
(11,-2):-8,
(11,-1):-8,
(11,0):-8,
(12,-14):-11,
(12,-13):-11,
(12,-12):-11,
(12,-11):-11,
(12,-10):-11,
(12,-2):-11,
(12,-1):-11,
(12,0):-11,
(13,-14):-16,
(13,-13):-16,
(13,-12):-16,
(13,-11):-16,
(13,-10):-16,
(13,-2):-16,
(13,-1):-16,
(13,0):-16,
(14,-8):37,
(14,-7):34,
(14,-6):33,
(14,-5):36,
(14,-4):38,
(14,-1):35,
(14,4):27,
(14,5):28,
(14,6):29,
(14,7):30,
(14,8):31,
(14,9):32,
(15,-14):-15,
(15,-13):-15,
(15,-12):-15,
(15,-11):-15,
(15,-10):-15,
(15,-7):39,
(15,-3):40,
(15,-2):-15,
(15,-1):-15,
(15,0):-15,
(16,-14):-18,
(16,-13):-18,
(16,-12):-18,
(16,-11):-18,
(16,-10):-18,
(16,-2):-18,
(16,-1):-18,
(16,0):-18,
(17,-14):-17,
(17,-13):-17,
(17,-12):-17,
(17,-11):-17,
(17,-10):-17,
(17,-2):-17,
(17,-1):-17,
(17,0):-17,
(18,-18):42,
(18,-17):41,
(19,-18):-28,
(19,-17):-28,
(20,-18):-30,
(20,-17):-30,
(20,-16):44,
(20,-1):43,
(21,-18):-32,
(21,-17):-32,
(21,-16):-32,
(21,-1):-32,
(22,-7):48,
(22,-6):47,
(22,-5):50,
(22,-4):51,
(22,-1):49,
(22,6):45,
(22,7):46,
(23,-7):48,
(23,-6):47,
(23,-5):50,
(23,-4):51,
(23,-1):49,
(23,6):52,
(23,7):46,
(24,-7):14,
(24,-6):13,
(24,-5):16,
(24,-4):17,
(24,-1):54,
(24,7):53,
(25,-7):14,
(25,-6):13,
(25,-5):16,
(25,-4):17,
(25,-1):54,
(25,7):55,
(26,-7):14,
(26,-6):13,
(26,-5):16,
(26,-4):17,
(26,-1):54,
(26,7):56,
(27,-9):-25,
(27,-8):-25,
(28,-11):58,
(28,-10):57,
(28,-9):-6,
(28,-8):-6,
(29,-14):61,
(29,-13):59,
(29,-12):60,
(29,-11):-8,
(29,-10):-8,
(29,-9):-8,
(29,-8):-8,
(30,-14):-11,
(30,-13):-11,
(30,-12):-11,
(30,-11):-11,
(30,-10):-11,
(30,-9):-11,
(30,-8):-11,
(31,-8):62,
(32,-9):63,
(32,-8):-23,
(33,-14):-16,
(33,-13):-16,
(33,-12):-16,
(33,-11):-16,
(33,-10):-16,
(33,-9):-16,
(33,-8):-16,
(34,-8):65,
(34,-7):34,
(34,-6):33,
(34,-5):36,
(34,-4):38,
(34,-1):35,
(34,4):27,
(34,5):28,
(34,6):29,
(34,7):30,
(34,8):64,
(34,9):32,
(35,-14):-15,
(35,-13):-15,
(35,-12):-15,
(35,-11):-15,
(35,-10):-15,
(35,-9):-15,
(35,-8):-15,
(35,-7):66,
(35,-3):67,
(36,-14):-18,
(36,-13):-18,
(36,-12):-18,
(36,-11):-18,
(36,-10):-18,
(36,-9):-18,
(36,-8):-18,
(37,-14):-19,
(37,-13):-19,
(37,-12):-19,
(37,-11):-19,
(37,-10):-19,
(37,-2):-19,
(37,-1):-19,
(37,0):-19,
(38,-14):-17,
(38,-13):-17,
(38,-12):-17,
(38,-11):-17,
(38,-10):-17,
(38,-9):-17,
(38,-8):-17,
(39,-8):69,
(39,-7):34,
(39,-6):33,
(39,-5):36,
(39,-4):38,
(39,-1):35,
(39,4):27,
(39,5):28,
(39,6):29,
(39,7):30,
(39,8):68,
(39,9):32,
(40,-7):14,
(40,-6):13,
(40,-5):16,
(40,-4):17,
(40,-1):54,
(40,5):70,
(40,6):11,
(40,7):12,
(41,-1):73,
(41,12):71,
(41,13):72,
(42,-2):-27,
(42,-1):-27,
(42,0):-27,
(43,-18):-33,
(43,-17):-33,
(43,-16):-33,
(43,-1):-33,
(44,-7):79,
(44,-6):78,
(44,-5):81,
(44,-4):82,
(44,-1):80,
(44,4):74,
(44,5):75,
(44,6):76,
(44,7):77,
(45,-14):85,
(45,-13):83,
(45,-12):84,
(45,-11):-9,
(45,-10):-9,
(45,-2):-9,
(45,-1):-9,
(45,0):-9,
(46,-14):-11,
(46,-13):-11,
(46,-12):-11,
(46,-11):-11,
(46,-10):-11,
(46,-2):-11,
(46,-1):-11,
(46,0):-11,
(47,-14):-16,
(47,-13):-16,
(47,-12):-16,
(47,-11):-16,
(47,-10):-16,
(47,-2):-16,
(47,-1):-16,
(47,0):-16,
(48,-8):87,
(48,-7):34,
(48,-6):33,
(48,-5):36,
(48,-4):38,
(48,-1):35,
(48,4):27,
(48,5):28,
(48,6):29,
(48,7):30,
(48,8):86,
(48,9):32,
(49,-14):-15,
(49,-13):-15,
(49,-12):-15,
(49,-11):-15,
(49,-10):-15,
(49,-7):88,
(49,-2):-15,
(49,-1):-15,
(49,0):-15,
(50,-14):-18,
(50,-13):-18,
(50,-12):-18,
(50,-11):-18,
(50,-10):-18,
(50,-2):-18,
(50,-1):-18,
(50,0):-18,
(51,-14):-17,
(51,-13):-17,
(51,-12):-17,
(51,-11):-17,
(51,-10):-17,
(51,-2):-17,
(51,-1):-17,
(51,0):-17,
(52,-14):85,
(52,-13):83,
(52,-12):84,
(52,-11):-10,
(52,-10):-10,
(52,-2):-10,
(52,-1):-10,
(52,0):-10,
(53,-14):-13,
(53,-13):-13,
(53,-12):-13,
(53,-11):-13,
(53,-10):-13,
(53,-2):-13,
(53,-1):-13,
(53,0):-13,
(54,-14):-15,
(54,-13):-15,
(54,-12):-15,
(54,-11):-15,
(54,-10):-15,
(54,-7):39,
(54,-2):-15,
(54,-1):-15,
(54,0):-15,
(55,-14):-12,
(55,-13):-12,
(55,-12):-12,
(55,-11):-12,
(55,-10):-12,
(55,-2):-12,
(55,-1):-12,
(55,0):-12,
(56,-14):-14,
(56,-13):-14,
(56,-12):-14,
(56,-11):-14,
(56,-10):-14,
(56,-2):-14,
(56,-1):-14,
(56,0):-14,
(57,-7):92,
(57,-6):91,
(57,-5):94,
(57,-4):95,
(57,-1):93,
(57,6):89,
(57,7):90,
(58,-7):92,
(58,-6):91,
(58,-5):94,
(58,-4):95,
(58,-1):93,
(58,6):96,
(58,7):90,
(59,-7):34,
(59,-6):33,
(59,-5):36,
(59,-4):38,
(59,-1):98,
(59,7):97,
(60,-7):34,
(60,-6):33,
(60,-5):36,
(60,-4):38,
(60,-1):98,
(60,7):99,
(61,-7):34,
(61,-6):33,
(61,-5):36,
(61,-4):38,
(61,-1):98,
(61,7):100,
(62,-14):-20,
(62,-13):-20,
(62,-12):-20,
(62,-11):-20,
(62,-10):-20,
(62,-2):-20,
(62,-1):-20,
(62,0):-20,
(63,-8):-24,
(63,-7):34,
(63,-6):33,
(63,-5):36,
(63,-4):38,
(63,-1):35,
(63,4):101,
(63,5):28,
(63,6):29,
(63,7):30,
(64,-8):102,
(65,-14):-19,
(65,-13):-19,
(65,-12):-19,
(65,-11):-19,
(65,-10):-19,
(65,-9):-19,
(65,-8):-19,
(66,-8):104,
(66,-7):34,
(66,-6):33,
(66,-5):36,
(66,-4):38,
(66,-1):35,
(66,4):27,
(66,5):28,
(66,6):29,
(66,7):30,
(66,8):103,
(66,9):32,
(67,-7):34,
(67,-6):33,
(67,-5):36,
(67,-4):38,
(67,-1):98,
(67,5):105,
(67,6):29,
(67,7):30,
(68,-8):106,
(69,-14):-21,
(69,-13):-21,
(69,-12):-21,
(69,-11):-21,
(69,-10):-21,
(69,-2):-21,
(69,-1):-21,
(69,0):-21,
(70,-11):23,
(70,-10):22,
(70,-2):-7,
(70,-1):-7,
(70,0):-7,
(71,-18):-29,
(71,-17):-29,
(72,-18):-30,
(72,-17):-30,
(72,-16):44,
(72,-1):107,
(73,-18):-32,
(73,-17):-32,
(73,-16):-32,
(73,-1):-32,
(74,-18):-31,
(74,-17):-31,
(75,-18):-6,
(75,-17):-6,
(75,-11):109,
(75,-10):108,
(76,-18):-8,
(76,-17):-8,
(76,-14):112,
(76,-13):110,
(76,-12):111,
(76,-11):-8,
(76,-10):-8,
(77,-18):-11,
(77,-17):-11,
(77,-14):-11,
(77,-13):-11,
(77,-12):-11,
(77,-11):-11,
(77,-10):-11,
(78,-18):-16,
(78,-17):-16,
(78,-14):-16,
(78,-13):-16,
(78,-12):-16,
(78,-11):-16,
(78,-10):-16,
(79,-8):114,
(79,-7):34,
(79,-6):33,
(79,-5):36,
(79,-4):38,
(79,-1):35,
(79,4):27,
(79,5):28,
(79,6):29,
(79,7):30,
(79,8):113,
(79,9):32,
(80,-18):-15,
(80,-17):-15,
(80,-14):-15,
(80,-13):-15,
(80,-12):-15,
(80,-11):-15,
(80,-10):-15,
(80,-7):115,
(80,-3):116,
(81,-18):-18,
(81,-17):-18,
(81,-14):-18,
(81,-13):-18,
(81,-12):-18,
(81,-11):-18,
(81,-10):-18,
(82,-18):-17,
(82,-17):-17,
(82,-14):-17,
(82,-13):-17,
(82,-12):-17,
(82,-11):-17,
(82,-10):-17,
(83,-7):48,
(83,-6):47,
(83,-5):50,
(83,-4):51,
(83,-1):49,
(83,7):117,
(84,-7):48,
(84,-6):47,
(84,-5):50,
(84,-4):51,
(84,-1):49,
(84,7):118,
(85,-7):48,
(85,-6):47,
(85,-5):50,
(85,-4):51,
(85,-1):49,
(85,7):119,
(86,-8):120,
(87,-14):-19,
(87,-13):-19,
(87,-12):-19,
(87,-11):-19,
(87,-10):-19,
(87,-2):-19,
(87,-1):-19,
(87,0):-19,
(88,-8):122,
(88,-7):34,
(88,-6):33,
(88,-5):36,
(88,-4):38,
(88,-1):35,
(88,4):27,
(88,5):28,
(88,6):29,
(88,7):30,
(88,8):121,
(88,9):32,
(89,-14):125,
(89,-13):123,
(89,-12):124,
(89,-11):-9,
(89,-10):-9,
(89,-9):-9,
(89,-8):-9,
(90,-14):-11,
(90,-13):-11,
(90,-12):-11,
(90,-11):-11,
(90,-10):-11,
(90,-9):-11,
(90,-8):-11,
(91,-14):-16,
(91,-13):-16,
(91,-12):-16,
(91,-11):-16,
(91,-10):-16,
(91,-9):-16,
(91,-8):-16,
(92,-8):127,
(92,-7):34,
(92,-6):33,
(92,-5):36,
(92,-4):38,
(92,-1):35,
(92,4):27,
(92,5):28,
(92,6):29,
(92,7):30,
(92,8):126,
(92,9):32,
(93,-14):-15,
(93,-13):-15,
(93,-12):-15,
(93,-11):-15,
(93,-10):-15,
(93,-9):-15,
(93,-8):-15,
(93,-7):128,
(94,-14):-18,
(94,-13):-18,
(94,-12):-18,
(94,-11):-18,
(94,-10):-18,
(94,-9):-18,
(94,-8):-18,
(95,-14):-17,
(95,-13):-17,
(95,-12):-17,
(95,-11):-17,
(95,-10):-17,
(95,-9):-17,
(95,-8):-17,
(96,-14):125,
(96,-13):123,
(96,-12):124,
(96,-11):-10,
(96,-10):-10,
(96,-9):-10,
(96,-8):-10,
(97,-14):-13,
(97,-13):-13,
(97,-12):-13,
(97,-11):-13,
(97,-10):-13,
(97,-9):-13,
(97,-8):-13,
(98,-14):-15,
(98,-13):-15,
(98,-12):-15,
(98,-11):-15,
(98,-10):-15,
(98,-9):-15,
(98,-8):-15,
(98,-7):66,
(99,-14):-12,
(99,-13):-12,
(99,-12):-12,
(99,-11):-12,
(99,-10):-12,
(99,-9):-12,
(99,-8):-12,
(100,-14):-14,
(100,-13):-14,
(100,-12):-14,
(100,-11):-14,
(100,-10):-14,
(100,-9):-14,
(100,-8):-14,
(101,-9):-26,
(101,-8):-26,
(102,-14):-20,
(102,-13):-20,
(102,-12):-20,
(102,-11):-20,
(102,-10):-20,
(102,-9):-20,
(102,-8):-20,
(103,-8):129,
(104,-14):-21,
(104,-13):-21,
(104,-12):-21,
(104,-11):-21,
(104,-10):-21,
(104,-9):-21,
(104,-8):-21,
(105,-11):58,
(105,-10):57,
(105,-9):-7,
(105,-8):-7,
(106,-14):-22,
(106,-13):-22,
(106,-12):-22,
(106,-11):-22,
(106,-10):-22,
(106,-2):-22,
(106,-1):-22,
(106,0):-22,
(107,-18):-33,
(107,-17):-33,
(107,-16):-33,
(107,-1):-33,
(108,-7):133,
(108,-6):132,
(108,-5):135,
(108,-4):136,
(108,-1):134,
(108,6):130,
(108,7):131,
(109,-7):133,
(109,-6):132,
(109,-5):135,
(109,-4):136,
(109,-1):134,
(109,6):137,
(109,7):131,
(110,-7):79,
(110,-6):78,
(110,-5):81,
(110,-4):82,
(110,-1):139,
(110,7):138,
(111,-7):79,
(111,-6):78,
(111,-5):81,
(111,-4):82,
(111,-1):139,
(111,7):140,
(112,-7):79,
(112,-6):78,
(112,-5):81,
(112,-4):82,
(112,-1):139,
(112,7):141,
(113,-8):142,
(114,-18):-19,
(114,-17):-19,
(114,-14):-19,
(114,-13):-19,
(114,-12):-19,
(114,-11):-19,
(114,-10):-19,
(115,-8):144,
(115,-7):34,
(115,-6):33,
(115,-5):36,
(115,-4):38,
(115,-1):35,
(115,4):27,
(115,5):28,
(115,6):29,
(115,7):30,
(115,8):143,
(115,9):32,
(116,-7):79,
(116,-6):78,
(116,-5):81,
(116,-4):82,
(116,-1):139,
(116,5):145,
(116,6):76,
(116,7):77,
(117,-14):-13,
(117,-13):-13,
(117,-12):-13,
(117,-11):-13,
(117,-10):-13,
(117,-2):-13,
(117,-1):-13,
(117,0):-13,
(118,-14):-12,
(118,-13):-12,
(118,-12):-12,
(118,-11):-12,
(118,-10):-12,
(118,-2):-12,
(118,-1):-12,
(118,0):-12,
(119,-14):-14,
(119,-13):-14,
(119,-12):-14,
(119,-11):-14,
(119,-10):-14,
(119,-2):-14,
(119,-1):-14,
(119,0):-14,
(120,-14):-20,
(120,-13):-20,
(120,-12):-20,
(120,-11):-20,
(120,-10):-20,
(120,-2):-20,
(120,-1):-20,
(120,0):-20,
(121,-8):146,
(122,-14):-21,
(122,-13):-21,
(122,-12):-21,
(122,-11):-21,
(122,-10):-21,
(122,-2):-21,
(122,-1):-21,
(122,0):-21,
(123,-7):92,
(123,-6):91,
(123,-5):94,
(123,-4):95,
(123,-1):93,
(123,7):147,
(124,-7):92,
(124,-6):91,
(124,-5):94,
(124,-4):95,
(124,-1):93,
(124,7):148,
(125,-7):92,
(125,-6):91,
(125,-5):94,
(125,-4):95,
(125,-1):93,
(125,7):149,
(126,-8):150,
(127,-14):-19,
(127,-13):-19,
(127,-12):-19,
(127,-11):-19,
(127,-10):-19,
(127,-9):-19,
(127,-8):-19,
(128,-8):152,
(128,-7):34,
(128,-6):33,
(128,-5):36,
(128,-4):38,
(128,-1):35,
(128,4):27,
(128,5):28,
(128,6):29,
(128,7):30,
(128,8):151,
(128,9):32,
(129,-14):-22,
(129,-13):-22,
(129,-12):-22,
(129,-11):-22,
(129,-10):-22,
(129,-9):-22,
(129,-8):-22,
(130,-18):-9,
(130,-17):-9,
(130,-14):155,
(130,-13):153,
(130,-12):154,
(130,-11):-9,
(130,-10):-9,
(131,-18):-11,
(131,-17):-11,
(131,-14):-11,
(131,-13):-11,
(131,-12):-11,
(131,-11):-11,
(131,-10):-11,
(132,-18):-16,
(132,-17):-16,
(132,-14):-16,
(132,-13):-16,
(132,-12):-16,
(132,-11):-16,
(132,-10):-16,
(133,-8):157,
(133,-7):34,
(133,-6):33,
(133,-5):36,
(133,-4):38,
(133,-1):35,
(133,4):27,
(133,5):28,
(133,6):29,
(133,7):30,
(133,8):156,
(133,9):32,
(134,-18):-15,
(134,-17):-15,
(134,-14):-15,
(134,-13):-15,
(134,-12):-15,
(134,-11):-15,
(134,-10):-15,
(134,-7):158,
(135,-18):-18,
(135,-17):-18,
(135,-14):-18,
(135,-13):-18,
(135,-12):-18,
(135,-11):-18,
(135,-10):-18,
(136,-18):-17,
(136,-17):-17,
(136,-14):-17,
(136,-13):-17,
(136,-12):-17,
(136,-11):-17,
(136,-10):-17,
(137,-18):-10,
(137,-17):-10,
(137,-14):155,
(137,-13):153,
(137,-12):154,
(137,-11):-10,
(137,-10):-10,
(138,-18):-13,
(138,-17):-13,
(138,-14):-13,
(138,-13):-13,
(138,-12):-13,
(138,-11):-13,
(138,-10):-13,
(139,-18):-15,
(139,-17):-15,
(139,-14):-15,
(139,-13):-15,
(139,-12):-15,
(139,-11):-15,
(139,-10):-15,
(139,-7):115,
(140,-18):-12,
(140,-17):-12,
(140,-14):-12,
(140,-13):-12,
(140,-12):-12,
(140,-11):-12,
(140,-10):-12,
(141,-18):-14,
(141,-17):-14,
(141,-14):-14,
(141,-13):-14,
(141,-12):-14,
(141,-11):-14,
(141,-10):-14,
(142,-18):-20,
(142,-17):-20,
(142,-14):-20,
(142,-13):-20,
(142,-12):-20,
(142,-11):-20,
(142,-10):-20,
(143,-8):159,
(144,-18):-21,
(144,-17):-21,
(144,-14):-21,
(144,-13):-21,
(144,-12):-21,
(144,-11):-21,
(144,-10):-21,
(145,-18):-7,
(145,-17):-7,
(145,-11):109,
(145,-10):108,
(146,-14):-22,
(146,-13):-22,
(146,-12):-22,
(146,-11):-22,
(146,-10):-22,
(146,-2):-22,
(146,-1):-22,
(146,0):-22,
(147,-14):-13,
(147,-13):-13,
(147,-12):-13,
(147,-11):-13,
(147,-10):-13,
(147,-9):-13,
(147,-8):-13,
(148,-14):-12,
(148,-13):-12,
(148,-12):-12,
(148,-11):-12,
(148,-10):-12,
(148,-9):-12,
(148,-8):-12,
(149,-14):-14,
(149,-13):-14,
(149,-12):-14,
(149,-11):-14,
(149,-10):-14,
(149,-9):-14,
(149,-8):-14,
(150,-14):-20,
(150,-13):-20,
(150,-12):-20,
(150,-11):-20,
(150,-10):-20,
(150,-9):-20,
(150,-8):-20,
(151,-8):160,
(152,-14):-21,
(152,-13):-21,
(152,-12):-21,
(152,-11):-21,
(152,-10):-21,
(152,-9):-21,
(152,-8):-21,
(153,-7):133,
(153,-6):132,
(153,-5):135,
(153,-4):136,
(153,-1):134,
(153,7):161,
(154,-7):133,
(154,-6):132,
(154,-5):135,
(154,-4):136,
(154,-1):134,
(154,7):162,
(155,-7):133,
(155,-6):132,
(155,-5):135,
(155,-4):136,
(155,-1):134,
(155,7):163,
(156,-8):164,
(157,-18):-19,
(157,-17):-19,
(157,-14):-19,
(157,-13):-19,
(157,-12):-19,
(157,-11):-19,
(157,-10):-19,
(158,-8):166,
(158,-7):34,
(158,-6):33,
(158,-5):36,
(158,-4):38,
(158,-1):35,
(158,4):27,
(158,5):28,
(158,6):29,
(158,7):30,
(158,8):165,
(158,9):32,
(159,-18):-22,
(159,-17):-22,
(159,-14):-22,
(159,-13):-22,
(159,-12):-22,
(159,-11):-22,
(159,-10):-22,
(160,-14):-22,
(160,-13):-22,
(160,-12):-22,
(160,-11):-22,
(160,-10):-22,
(160,-9):-22,
(160,-8):-22,
(161,-18):-13,
(161,-17):-13,
(161,-14):-13,
(161,-13):-13,
(161,-12):-13,
(161,-11):-13,
(161,-10):-13,
(162,-18):-12,
(162,-17):-12,
(162,-14):-12,
(162,-13):-12,
(162,-12):-12,
(162,-11):-12,
(162,-10):-12,
(163,-18):-14,
(163,-17):-14,
(163,-14):-14,
(163,-13):-14,
(163,-12):-14,
(163,-11):-14,
(163,-10):-14,
(164,-18):-20,
(164,-17):-20,
(164,-14):-20,
(164,-13):-20,
(164,-12):-20,
(164,-11):-20,
(164,-10):-20,
(165,-8):167,
(166,-18):-21,
(166,-17):-21,
(166,-14):-21,
(166,-13):-21,
(166,-12):-21,
(166,-11):-21,
(166,-10):-21,
(167,-18):-22,
(167,-17):-22,
(167,-14):-22,
(167,-13):-22,
(167,-12):-22,
(167,-11):-22,
(167,-10):-22,
},
'nonterms':(
u'%start',
u'file',
u'line',
u'directive',
u'expression',
u'exp_plusminus',
u'exp_timesdivide',
u'exp_term',
u'expression_list_with_comma',
u'expression_list',
u'production',
u'productionAlternatives',
u'productionRule',
u'productionList',
),
'rules':[
(0,(1,),None),
(1,(2,),None),
(1,(1,2),None),
(2,(3,),None),
(2,(10,),None),
(3,(-2,4),(u'(',u'processDirective',[(u'$',1),(u'$',2)])),
(4,(5,),(u'$',1)),
(4,(-1,-3,5),(u'(',u'exprOper',[(u'$',2),(u'$',1),(u'$',3)])),
(5,(6,),(u'$',1)),
(5,(5,-10,6),(u'(',u'exprOper',[(u'$',2),(u'$',1),(u'$',3)])),
(5,(5,-11,6),(u'(',u'exprOper',[(u'$',2),(u'$',1),(u'$',3)])),
(6,(7,),(u'$',1)),
(6,(6,-12,7),(u'(',u'exprOper',[(u'$',2),(u'$',1),(u'$',3)])),
(6,(6,-13,7),(u'(',u'exprOper',[(u'$',2),(u'$',1),(u'$',3)])),
(6,(6,-14,7),(u'(',u'exprOper',[(u'$',2),(u'$',1),(u'$',3)])),
(7,(-1,),(u'(',u'exprToken',[(u'$',1)])),
(7,(-6,),(u'(',u'exprString',[(u'$',1)])),
(7,(-4,),(u'(',u'exprNumber',[(u'$',1)])),
(7,(-5,),(u'(',u'exprPosParam',[(u'$',1)])),
(7,(-7,-8),[]),
(7,(-7,8,-8),(u'$',2)),
(7,(-1,-7,-8),(u'(',u'exprFuncCall',[(u'(',u'exprToken',[(u'$',1)]),[]])),
(7,(-1,-7,8,-8),(u'(',u'exprFuncCall',[(u'(',u'exprToken',[(u'$',1)]),(u'$',3)])),
(8,(9,),(u'$',1)),
(8,(9,-9),(u'$',1)),
(9,(4,),[(u'$',1)]),
(9,(9,-9,4),(u'+',(u'$',1),[(u'$',3)])),
(10,(-1,-15,11,-18),(u'(',u'fpgAddToGrammar',[(u'$',1),(u'$',3)])),
(11,(12,),[(u'$',1)]),
(11,(11,-17,12),(u'+',(u'$',1),[(u'$',3)])),
(12,(13,),[(u'$',1)]),
(12,(13,-16,4),[(u'$',1),(u'$',3)]),
(13,(-1,),[(u'$',1)]),
(13,(13,-1),(u'+',(u'$',1),[(u'$',2)])),
],
'tokens':(
u'%eof',
u'C_TOKEN',
u'C_DIRECTIVE',
u'C_EQUALS',
u'C_NUMBER',
u'C_POS_PARAM',
u'C_QUOTEDSTR',
u'C_PAREN_OPEN',
u'C_PAREN_CLOSE',
u'C_COMMA',
u'C_PLUS',
u'C_MINUS',
u'C_TIMES',
u'C_DIVIDE',
u'C_MODULO',
u'C_DERIVES',
u'C_ACTION',
u'P_ALTERNATE',
u'P_END_PRODUCTION',
),
}

#!/usr/bin/python
########################################################################
# This file was automatically generated by fpg version 1.0.0-alpha1
########################################################################

import sys

try:
  ParserException
except NameError,e:
  class ParserException(Exception): pass
try:
  ParserFatalException
except NameError,e:
  class ParserFatalException(ParserException): pass
try:
  ParserWarningException
except NameError,e:
  class ParserWarningException(ParserException): pass
try:
  ActionFailedException
except NameError,e:
  class ActionFailedException(ParserFatalException): pass
try:
  FPGExpressionTuple
except NameError,e:
  class FPGExpressionTuple(tuple):
    def __repr__(self):
      return 'FPGXP' + super(FPGExpressionTuple,self).__repr__()
  FPGXP = FPGExpressionTuple

class fpgParser(object):

  def __init__(self):
    pass

  def debug(self, rulenum, states, values, lookahead, action):
    pass

  def initializeParser(self):
    pass

  def finalizeParser(self, value):
    return value

  def parse(self, lexer):
    self.lexer = lexer
    states = [ self.tables[u'actions'][None] ]
    values = []
    seen = []
    lookahead = None
    self.initializeParser()
    while len(states) == 1 or states[-1] > 0:
      if lookahead is None:
        lookahead = lexer.next()
      #print >> sys.stderr, "* parser states %s values %s lookahead %s" % (repr(states), repr(values), repr(lookahead))
      a = self.tables[u'actions'].get( (states[-1],-lookahead.token), None )
      if a is None or (len(values) > 0 and values[-1] is None):
        self._error_recovery(states, values, seen, lookahead)
      elif a < 0:
        rule = self.tables[u'rules'][-a]
        self.debug(-a, states, values, lookahead, rule[2])
        rulevars = values[-len(rule[1]):]
        states[-len(rule[1]):] = []
        values[-len(rule[1]):] = []
        # special stuff to allow the action processor to change the input source:
        # tell the lexer to save the lookahead
        self.lexer.push(lookahead)
        lookahead = None
        try:
          val = self._eval_action(rule[2], rulevars)
        except ActionFailedException,e:
          print >> sys.stderr, "Production action raised error: " + str(e)
          val = None
        states.append(self.tables[u'actions'][(states[-1],rule[0])])
        values.append(val)
      else:
        seen = seen[-9:] + [lookahead]
        states.append(a)
        values.append(lookahead.value)
        lookahead = None
    return self.finalizeParser(values[0])

  def _eval_action(self, action, rulevars):
    if not isinstance(action,tuple):
      if action is None:
        action_evaluation = rulevars[0]
      elif isinstance(action, list):
        action_evaluation = [self._eval_action(listitem,rulevars) for listitem in action]
      elif isinstance(action, (int,str,unicode)):
        action_evaluation = action
      else:
        raise ActionFailedException( "Unknown action type " + repr(action) )
    elif action[0] == u'$':
      action_evaluation = rulevars[int(action[1])-1]
    elif action[0] == u'(':
      meth = getattr(self,action[1],None)
      if meth is None:
        raise ActionFailedException( "Unknown method call " + repr(action[1]) )
      action_evaluation = self._eval_action(action[2], rulevars)
      if not isinstance(action_evaluation, list):
        raise ActionFailedException( "Invalid function call argument type " + repr(action_evaluation) )
      action_evaluation = meth(*(tuple(action_evaluation)))
    elif action[0] == u'+':
      a1 = self._eval_action(action[1], rulevars)
      a2 = self._eval_action(action[2], rulevars)
      if isinstance(a1,list):
        if isinstance(a2,list):
          action_evaluation = a1 + a2
        else:
          action_evaluation = a1 + [a2]
      elif isinstance(a2,list):
        action_evaluation = [a1] + a2
      elif isinstance(a1,int) and isinstance(a2,int):
        action_evaluation = a1 + a2
      else:
        action_evaluation = unicode(a1) + unicode(a2)
    elif action[0] == u'-':
      a1 = self._eval_action(action[1], rulevars)
      a2 = self._eval_action(action[2], rulevars)
      if isinstance(a1,int) and isinstance(a2,int):
        action_evaluation = a1 - a2
      else:
        raise ActionFailedException("Invalid operand types to - operator: " + ",".join([repr(a) for a in action[1:]]))
    elif action[0] == u'*':
      a1 = self._eval_action(action[1], rulevars)
      a2 = self._eval_action(action[2], rulevars)
      if isinstance(a1,int) and isinstance(a2,int):
        action_evaluation = a1 * a2
      else:
        raise ActionFailedException("Invalid operand types to * operator: " + ",".join([repr(a) for a in action[1:]]))
    elif action[0] == u'/':
      a1 = self._eval_action(action[1], rulevars)
      a2 = self._eval_action(action[2], rulevars)
      if isinstance(a1,int) and isinstance(a2,int):
        action_evaluation = a1 / a2
      else:
        raise ActionFailedException("Invalid operand types to / operator: " + ",".join([repr(a) for a in action[1:]]))
    elif action[0] == u'%':
      a1 = self._eval_action(action[1], rulevars)
      a2 = self._eval_action(action[2], rulevars)
      if isinstance(a1,int) and isinstance(a2,int):
        action_evaluation = a1 % a2
      else:
        raise ActionFailedException("Invalid operand types to % operator: " + ",".join([repr(a) for a in action[1:]]))
    elif action[0] == u'=':
      return tuple([self._eval_action(a,rulevars) for a in action])
    else:
      raise ActionFailedException( "Unknown action list type " + repr(action) )
    return action_evaluation

  tables={
'actions':{
None:0,
(0,-2):6,
(0,-1):5,
(0,1):1,
(0,2):2,
(0,3):3,
(0,10):4,
(1,-2):6,
(1,-1):5,
(1,0):0,
(1,2):7,
(1,3):3,
(1,10):4,
(2,-2):-1,
(2,-1):-1,
(2,0):-1,
(3,-2):-3,
(3,-1):-3,
(3,0):-3,
(4,-2):-4,
(4,-1):-4,
(4,0):-4,
(5,-15):8,
(6,-7):14,
(6,-6):13,
(6,-5):16,
(6,-4):17,
(6,-1):15,
(6,4):9,
(6,5):10,
(6,6):11,
(6,7):12,
(7,-2):-2,
(7,-1):-2,
(7,0):-2,
(8,-1):21,
(8,11):18,
(8,12):19,
(8,13):20,
(9,-2):-5,
(9,-1):-5,
(9,0):-5,
(10,-11):23,
(10,-10):22,
(10,-2):-6,
(10,-1):-6,
(10,0):-6,
(11,-14):26,
(11,-13):24,
(11,-12):25,
(11,-11):-8,
(11,-10):-8,
(11,-2):-8,
(11,-1):-8,
(11,0):-8,
(12,-14):-11,
(12,-13):-11,
(12,-12):-11,
(12,-11):-11,
(12,-10):-11,
(12,-2):-11,
(12,-1):-11,
(12,0):-11,
(13,-14):-16,
(13,-13):-16,
(13,-12):-16,
(13,-11):-16,
(13,-10):-16,
(13,-2):-16,
(13,-1):-16,
(13,0):-16,
(14,-8):37,
(14,-7):34,
(14,-6):33,
(14,-5):36,
(14,-4):38,
(14,-1):35,
(14,4):27,
(14,5):28,
(14,6):29,
(14,7):30,
(14,8):31,
(14,9):32,
(15,-14):-15,
(15,-13):-15,
(15,-12):-15,
(15,-11):-15,
(15,-10):-15,
(15,-7):39,
(15,-3):40,
(15,-2):-15,
(15,-1):-15,
(15,0):-15,
(16,-14):-18,
(16,-13):-18,
(16,-12):-18,
(16,-11):-18,
(16,-10):-18,
(16,-2):-18,
(16,-1):-18,
(16,0):-18,
(17,-14):-17,
(17,-13):-17,
(17,-12):-17,
(17,-11):-17,
(17,-10):-17,
(17,-2):-17,
(17,-1):-17,
(17,0):-17,
(18,-18):42,
(18,-17):41,
(19,-18):-28,
(19,-17):-28,
(20,-18):-30,
(20,-17):-30,
(20,-16):44,
(20,-1):43,
(21,-18):-32,
(21,-17):-32,
(21,-16):-32,
(21,-1):-32,
(22,-7):48,
(22,-6):47,
(22,-5):50,
(22,-4):51,
(22,-1):49,
(22,6):45,
(22,7):46,
(23,-7):48,
(23,-6):47,
(23,-5):50,
(23,-4):51,
(23,-1):49,
(23,6):52,
(23,7):46,
(24,-7):14,
(24,-6):13,
(24,-5):16,
(24,-4):17,
(24,-1):54,
(24,7):53,
(25,-7):14,
(25,-6):13,
(25,-5):16,
(25,-4):17,
(25,-1):54,
(25,7):55,
(26,-7):14,
(26,-6):13,
(26,-5):16,
(26,-4):17,
(26,-1):54,
(26,7):56,
(27,-9):-25,
(27,-8):-25,
(28,-11):58,
(28,-10):57,
(28,-9):-6,
(28,-8):-6,
(29,-14):61,
(29,-13):59,
(29,-12):60,
(29,-11):-8,
(29,-10):-8,
(29,-9):-8,
(29,-8):-8,
(30,-14):-11,
(30,-13):-11,
(30,-12):-11,
(30,-11):-11,
(30,-10):-11,
(30,-9):-11,
(30,-8):-11,
(31,-8):62,
(32,-9):63,
(32,-8):-23,
(33,-14):-16,
(33,-13):-16,
(33,-12):-16,
(33,-11):-16,
(33,-10):-16,
(33,-9):-16,
(33,-8):-16,
(34,-8):65,
(34,-7):34,
(34,-6):33,
(34,-5):36,
(34,-4):38,
(34,-1):35,
(34,4):27,
(34,5):28,
(34,6):29,
(34,7):30,
(34,8):64,
(34,9):32,
(35,-14):-15,
(35,-13):-15,
(35,-12):-15,
(35,-11):-15,
(35,-10):-15,
(35,-9):-15,
(35,-8):-15,
(35,-7):66,
(35,-3):67,
(36,-14):-18,
(36,-13):-18,
(36,-12):-18,
(36,-11):-18,
(36,-10):-18,
(36,-9):-18,
(36,-8):-18,
(37,-14):-19,
(37,-13):-19,
(37,-12):-19,
(37,-11):-19,
(37,-10):-19,
(37,-2):-19,
(37,-1):-19,
(37,0):-19,
(38,-14):-17,
(38,-13):-17,
(38,-12):-17,
(38,-11):-17,
(38,-10):-17,
(38,-9):-17,
(38,-8):-17,
(39,-8):69,
(39,-7):34,
(39,-6):33,
(39,-5):36,
(39,-4):38,
(39,-1):35,
(39,4):27,
(39,5):28,
(39,6):29,
(39,7):30,
(39,8):68,
(39,9):32,
(40,-7):14,
(40,-6):13,
(40,-5):16,
(40,-4):17,
(40,-1):54,
(40,5):70,
(40,6):11,
(40,7):12,
(41,-1):73,
(41,12):71,
(41,13):72,
(42,-2):-27,
(42,-1):-27,
(42,0):-27,
(43,-18):-33,
(43,-17):-33,
(43,-16):-33,
(43,-1):-33,
(44,-7):79,
(44,-6):78,
(44,-5):81,
(44,-4):82,
(44,-1):80,
(44,4):74,
(44,5):75,
(44,6):76,
(44,7):77,
(45,-14):85,
(45,-13):83,
(45,-12):84,
(45,-11):-9,
(45,-10):-9,
(45,-2):-9,
(45,-1):-9,
(45,0):-9,
(46,-14):-11,
(46,-13):-11,
(46,-12):-11,
(46,-11):-11,
(46,-10):-11,
(46,-2):-11,
(46,-1):-11,
(46,0):-11,
(47,-14):-16,
(47,-13):-16,
(47,-12):-16,
(47,-11):-16,
(47,-10):-16,
(47,-2):-16,
(47,-1):-16,
(47,0):-16,
(48,-8):87,
(48,-7):34,
(48,-6):33,
(48,-5):36,
(48,-4):38,
(48,-1):35,
(48,4):27,
(48,5):28,
(48,6):29,
(48,7):30,
(48,8):86,
(48,9):32,
(49,-14):-15,
(49,-13):-15,
(49,-12):-15,
(49,-11):-15,
(49,-10):-15,
(49,-7):88,
(49,-2):-15,
(49,-1):-15,
(49,0):-15,
(50,-14):-18,
(50,-13):-18,
(50,-12):-18,
(50,-11):-18,
(50,-10):-18,
(50,-2):-18,
(50,-1):-18,
(50,0):-18,
(51,-14):-17,
(51,-13):-17,
(51,-12):-17,
(51,-11):-17,
(51,-10):-17,
(51,-2):-17,
(51,-1):-17,
(51,0):-17,
(52,-14):85,
(52,-13):83,
(52,-12):84,
(52,-11):-10,
(52,-10):-10,
(52,-2):-10,
(52,-1):-10,
(52,0):-10,
(53,-14):-13,
(53,-13):-13,
(53,-12):-13,
(53,-11):-13,
(53,-10):-13,
(53,-2):-13,
(53,-1):-13,
(53,0):-13,
(54,-14):-15,
(54,-13):-15,
(54,-12):-15,
(54,-11):-15,
(54,-10):-15,
(54,-7):39,
(54,-2):-15,
(54,-1):-15,
(54,0):-15,
(55,-14):-12,
(55,-13):-12,
(55,-12):-12,
(55,-11):-12,
(55,-10):-12,
(55,-2):-12,
(55,-1):-12,
(55,0):-12,
(56,-14):-14,
(56,-13):-14,
(56,-12):-14,
(56,-11):-14,
(56,-10):-14,
(56,-2):-14,
(56,-1):-14,
(56,0):-14,
(57,-7):92,
(57,-6):91,
(57,-5):94,
(57,-4):95,
(57,-1):93,
(57,6):89,
(57,7):90,
(58,-7):92,
(58,-6):91,
(58,-5):94,
(58,-4):95,
(58,-1):93,
(58,6):96,
(58,7):90,
(59,-7):34,
(59,-6):33,
(59,-5):36,
(59,-4):38,
(59,-1):98,
(59,7):97,
(60,-7):34,
(60,-6):33,
(60,-5):36,
(60,-4):38,
(60,-1):98,
(60,7):99,
(61,-7):34,
(61,-6):33,
(61,-5):36,
(61,-4):38,
(61,-1):98,
(61,7):100,
(62,-14):-20,
(62,-13):-20,
(62,-12):-20,
(62,-11):-20,
(62,-10):-20,
(62,-2):-20,
(62,-1):-20,
(62,0):-20,
(63,-8):-24,
(63,-7):34,
(63,-6):33,
(63,-5):36,
(63,-4):38,
(63,-1):35,
(63,4):101,
(63,5):28,
(63,6):29,
(63,7):30,
(64,-8):102,
(65,-14):-19,
(65,-13):-19,
(65,-12):-19,
(65,-11):-19,
(65,-10):-19,
(65,-9):-19,
(65,-8):-19,
(66,-8):104,
(66,-7):34,
(66,-6):33,
(66,-5):36,
(66,-4):38,
(66,-1):35,
(66,4):27,
(66,5):28,
(66,6):29,
(66,7):30,
(66,8):103,
(66,9):32,
(67,-7):34,
(67,-6):33,
(67,-5):36,
(67,-4):38,
(67,-1):98,
(67,5):105,
(67,6):29,
(67,7):30,
(68,-8):106,
(69,-14):-21,
(69,-13):-21,
(69,-12):-21,
(69,-11):-21,
(69,-10):-21,
(69,-2):-21,
(69,-1):-21,
(69,0):-21,
(70,-11):23,
(70,-10):22,
(70,-2):-7,
(70,-1):-7,
(70,0):-7,
(71,-18):-29,
(71,-17):-29,
(72,-18):-30,
(72,-17):-30,
(72,-16):44,
(72,-1):107,
(73,-18):-32,
(73,-17):-32,
(73,-16):-32,
(73,-1):-32,
(74,-18):-31,
(74,-17):-31,
(75,-18):-6,
(75,-17):-6,
(75,-11):109,
(75,-10):108,
(76,-18):-8,
(76,-17):-8,
(76,-14):112,
(76,-13):110,
(76,-12):111,
(76,-11):-8,
(76,-10):-8,
(77,-18):-11,
(77,-17):-11,
(77,-14):-11,
(77,-13):-11,
(77,-12):-11,
(77,-11):-11,
(77,-10):-11,
(78,-18):-16,
(78,-17):-16,
(78,-14):-16,
(78,-13):-16,
(78,-12):-16,
(78,-11):-16,
(78,-10):-16,
(79,-8):114,
(79,-7):34,
(79,-6):33,
(79,-5):36,
(79,-4):38,
(79,-1):35,
(79,4):27,
(79,5):28,
(79,6):29,
(79,7):30,
(79,8):113,
(79,9):32,
(80,-18):-15,
(80,-17):-15,
(80,-14):-15,
(80,-13):-15,
(80,-12):-15,
(80,-11):-15,
(80,-10):-15,
(80,-7):115,
(80,-3):116,
(81,-18):-18,
(81,-17):-18,
(81,-14):-18,
(81,-13):-18,
(81,-12):-18,
(81,-11):-18,
(81,-10):-18,
(82,-18):-17,
(82,-17):-17,
(82,-14):-17,
(82,-13):-17,
(82,-12):-17,
(82,-11):-17,
(82,-10):-17,
(83,-7):48,
(83,-6):47,
(83,-5):50,
(83,-4):51,
(83,-1):49,
(83,7):117,
(84,-7):48,
(84,-6):47,
(84,-5):50,
(84,-4):51,
(84,-1):49,
(84,7):118,
(85,-7):48,
(85,-6):47,
(85,-5):50,
(85,-4):51,
(85,-1):49,
(85,7):119,
(86,-8):120,
(87,-14):-19,
(87,-13):-19,
(87,-12):-19,
(87,-11):-19,
(87,-10):-19,
(87,-2):-19,
(87,-1):-19,
(87,0):-19,
(88,-8):122,
(88,-7):34,
(88,-6):33,
(88,-5):36,
(88,-4):38,
(88,-1):35,
(88,4):27,
(88,5):28,
(88,6):29,
(88,7):30,
(88,8):121,
(88,9):32,
(89,-14):125,
(89,-13):123,
(89,-12):124,
(89,-11):-9,
(89,-10):-9,
(89,-9):-9,
(89,-8):-9,
(90,-14):-11,
(90,-13):-11,
(90,-12):-11,
(90,-11):-11,
(90,-10):-11,
(90,-9):-11,
(90,-8):-11,
(91,-14):-16,
(91,-13):-16,
(91,-12):-16,
(91,-11):-16,
(91,-10):-16,
(91,-9):-16,
(91,-8):-16,
(92,-8):127,
(92,-7):34,
(92,-6):33,
(92,-5):36,
(92,-4):38,
(92,-1):35,
(92,4):27,
(92,5):28,
(92,6):29,
(92,7):30,
(92,8):126,
(92,9):32,
(93,-14):-15,
(93,-13):-15,
(93,-12):-15,
(93,-11):-15,
(93,-10):-15,
(93,-9):-15,
(93,-8):-15,
(93,-7):128,
(94,-14):-18,
(94,-13):-18,
(94,-12):-18,
(94,-11):-18,
(94,-10):-18,
(94,-9):-18,
(94,-8):-18,
(95,-14):-17,
(95,-13):-17,
(95,-12):-17,
(95,-11):-17,
(95,-10):-17,
(95,-9):-17,
(95,-8):-17,
(96,-14):125,
(96,-13):123,
(96,-12):124,
(96,-11):-10,
(96,-10):-10,
(96,-9):-10,
(96,-8):-10,
(97,-14):-13,
(97,-13):-13,
(97,-12):-13,
(97,-11):-13,
(97,-10):-13,
(97,-9):-13,
(97,-8):-13,
(98,-14):-15,
(98,-13):-15,
(98,-12):-15,
(98,-11):-15,
(98,-10):-15,
(98,-9):-15,
(98,-8):-15,
(98,-7):66,
(99,-14):-12,
(99,-13):-12,
(99,-12):-12,
(99,-11):-12,
(99,-10):-12,
(99,-9):-12,
(99,-8):-12,
(100,-14):-14,
(100,-13):-14,
(100,-12):-14,
(100,-11):-14,
(100,-10):-14,
(100,-9):-14,
(100,-8):-14,
(101,-9):-26,
(101,-8):-26,
(102,-14):-20,
(102,-13):-20,
(102,-12):-20,
(102,-11):-20,
(102,-10):-20,
(102,-9):-20,
(102,-8):-20,
(103,-8):129,
(104,-14):-21,
(104,-13):-21,
(104,-12):-21,
(104,-11):-21,
(104,-10):-21,
(104,-9):-21,
(104,-8):-21,
(105,-11):58,
(105,-10):57,
(105,-9):-7,
(105,-8):-7,
(106,-14):-22,
(106,-13):-22,
(106,-12):-22,
(106,-11):-22,
(106,-10):-22,
(106,-2):-22,
(106,-1):-22,
(106,0):-22,
(107,-18):-33,
(107,-17):-33,
(107,-16):-33,
(107,-1):-33,
(108,-7):133,
(108,-6):132,
(108,-5):135,
(108,-4):136,
(108,-1):134,
(108,6):130,
(108,7):131,
(109,-7):133,
(109,-6):132,
(109,-5):135,
(109,-4):136,
(109,-1):134,
(109,6):137,
(109,7):131,
(110,-7):79,
(110,-6):78,
(110,-5):81,
(110,-4):82,
(110,-1):139,
(110,7):138,
(111,-7):79,
(111,-6):78,
(111,-5):81,
(111,-4):82,
(111,-1):139,
(111,7):140,
(112,-7):79,
(112,-6):78,
(112,-5):81,
(112,-4):82,
(112,-1):139,
(112,7):141,
(113,-8):142,
(114,-18):-19,
(114,-17):-19,
(114,-14):-19,
(114,-13):-19,
(114,-12):-19,
(114,-11):-19,
(114,-10):-19,
(115,-8):144,
(115,-7):34,
(115,-6):33,
(115,-5):36,
(115,-4):38,
(115,-1):35,
(115,4):27,
(115,5):28,
(115,6):29,
(115,7):30,
(115,8):143,
(115,9):32,
(116,-7):79,
(116,-6):78,
(116,-5):81,
(116,-4):82,
(116,-1):139,
(116,5):145,
(116,6):76,
(116,7):77,
(117,-14):-13,
(117,-13):-13,
(117,-12):-13,
(117,-11):-13,
(117,-10):-13,
(117,-2):-13,
(117,-1):-13,
(117,0):-13,
(118,-14):-12,
(118,-13):-12,
(118,-12):-12,
(118,-11):-12,
(118,-10):-12,
(118,-2):-12,
(118,-1):-12,
(118,0):-12,
(119,-14):-14,
(119,-13):-14,
(119,-12):-14,
(119,-11):-14,
(119,-10):-14,
(119,-2):-14,
(119,-1):-14,
(119,0):-14,
(120,-14):-20,
(120,-13):-20,
(120,-12):-20,
(120,-11):-20,
(120,-10):-20,
(120,-2):-20,
(120,-1):-20,
(120,0):-20,
(121,-8):146,
(122,-14):-21,
(122,-13):-21,
(122,-12):-21,
(122,-11):-21,
(122,-10):-21,
(122,-2):-21,
(122,-1):-21,
(122,0):-21,
(123,-7):92,
(123,-6):91,
(123,-5):94,
(123,-4):95,
(123,-1):93,
(123,7):147,
(124,-7):92,
(124,-6):91,
(124,-5):94,
(124,-4):95,
(124,-1):93,
(124,7):148,
(125,-7):92,
(125,-6):91,
(125,-5):94,
(125,-4):95,
(125,-1):93,
(125,7):149,
(126,-8):150,
(127,-14):-19,
(127,-13):-19,
(127,-12):-19,
(127,-11):-19,
(127,-10):-19,
(127,-9):-19,
(127,-8):-19,
(128,-8):152,
(128,-7):34,
(128,-6):33,
(128,-5):36,
(128,-4):38,
(128,-1):35,
(128,4):27,
(128,5):28,
(128,6):29,
(128,7):30,
(128,8):151,
(128,9):32,
(129,-14):-22,
(129,-13):-22,
(129,-12):-22,
(129,-11):-22,
(129,-10):-22,
(129,-9):-22,
(129,-8):-22,
(130,-18):-9,
(130,-17):-9,
(130,-14):155,
(130,-13):153,
(130,-12):154,
(130,-11):-9,
(130,-10):-9,
(131,-18):-11,
(131,-17):-11,
(131,-14):-11,
(131,-13):-11,
(131,-12):-11,
(131,-11):-11,
(131,-10):-11,
(132,-18):-16,
(132,-17):-16,
(132,-14):-16,
(132,-13):-16,
(132,-12):-16,
(132,-11):-16,
(132,-10):-16,
(133,-8):157,
(133,-7):34,
(133,-6):33,
(133,-5):36,
(133,-4):38,
(133,-1):35,
(133,4):27,
(133,5):28,
(133,6):29,
(133,7):30,
(133,8):156,
(133,9):32,
(134,-18):-15,
(134,-17):-15,
(134,-14):-15,
(134,-13):-15,
(134,-12):-15,
(134,-11):-15,
(134,-10):-15,
(134,-7):158,
(135,-18):-18,
(135,-17):-18,
(135,-14):-18,
(135,-13):-18,
(135,-12):-18,
(135,-11):-18,
(135,-10):-18,
(136,-18):-17,
(136,-17):-17,
(136,-14):-17,
(136,-13):-17,
(136,-12):-17,
(136,-11):-17,
(136,-10):-17,
(137,-18):-10,
(137,-17):-10,
(137,-14):155,
(137,-13):153,
(137,-12):154,
(137,-11):-10,
(137,-10):-10,
(138,-18):-13,
(138,-17):-13,
(138,-14):-13,
(138,-13):-13,
(138,-12):-13,
(138,-11):-13,
(138,-10):-13,
(139,-18):-15,
(139,-17):-15,
(139,-14):-15,
(139,-13):-15,
(139,-12):-15,
(139,-11):-15,
(139,-10):-15,
(139,-7):115,
(140,-18):-12,
(140,-17):-12,
(140,-14):-12,
(140,-13):-12,
(140,-12):-12,
(140,-11):-12,
(140,-10):-12,
(141,-18):-14,
(141,-17):-14,
(141,-14):-14,
(141,-13):-14,
(141,-12):-14,
(141,-11):-14,
(141,-10):-14,
(142,-18):-20,
(142,-17):-20,
(142,-14):-20,
(142,-13):-20,
(142,-12):-20,
(142,-11):-20,
(142,-10):-20,
(143,-8):159,
(144,-18):-21,
(144,-17):-21,
(144,-14):-21,
(144,-13):-21,
(144,-12):-21,
(144,-11):-21,
(144,-10):-21,
(145,-18):-7,
(145,-17):-7,
(145,-11):109,
(145,-10):108,
(146,-14):-22,
(146,-13):-22,
(146,-12):-22,
(146,-11):-22,
(146,-10):-22,
(146,-2):-22,
(146,-1):-22,
(146,0):-22,
(147,-14):-13,
(147,-13):-13,
(147,-12):-13,
(147,-11):-13,
(147,-10):-13,
(147,-9):-13,
(147,-8):-13,
(148,-14):-12,
(148,-13):-12,
(148,-12):-12,
(148,-11):-12,
(148,-10):-12,
(148,-9):-12,
(148,-8):-12,
(149,-14):-14,
(149,-13):-14,
(149,-12):-14,
(149,-11):-14,
(149,-10):-14,
(149,-9):-14,
(149,-8):-14,
(150,-14):-20,
(150,-13):-20,
(150,-12):-20,
(150,-11):-20,
(150,-10):-20,
(150,-9):-20,
(150,-8):-20,
(151,-8):160,
(152,-14):-21,
(152,-13):-21,
(152,-12):-21,
(152,-11):-21,
(152,-10):-21,
(152,-9):-21,
(152,-8):-21,
(153,-7):133,
(153,-6):132,
(153,-5):135,
(153,-4):136,
(153,-1):134,
(153,7):161,
(154,-7):133,
(154,-6):132,
(154,-5):135,
(154,-4):136,
(154,-1):134,
(154,7):162,
(155,-7):133,
(155,-6):132,
(155,-5):135,
(155,-4):136,
(155,-1):134,
(155,7):163,
(156,-8):164,
(157,-18):-19,
(157,-17):-19,
(157,-14):-19,
(157,-13):-19,
(157,-12):-19,
(157,-11):-19,
(157,-10):-19,
(158,-8):166,
(158,-7):34,
(158,-6):33,
(158,-5):36,
(158,-4):38,
(158,-1):35,
(158,4):27,
(158,5):28,
(158,6):29,
(158,7):30,
(158,8):165,
(158,9):32,
(159,-18):-22,
(159,-17):-22,
(159,-14):-22,
(159,-13):-22,
(159,-12):-22,
(159,-11):-22,
(159,-10):-22,
(160,-14):-22,
(160,-13):-22,
(160,-12):-22,
(160,-11):-22,
(160,-10):-22,
(160,-9):-22,
(160,-8):-22,
(161,-18):-13,
(161,-17):-13,
(161,-14):-13,
(161,-13):-13,
(161,-12):-13,
(161,-11):-13,
(161,-10):-13,
(162,-18):-12,
(162,-17):-12,
(162,-14):-12,
(162,-13):-12,
(162,-12):-12,
(162,-11):-12,
(162,-10):-12,
(163,-18):-14,
(163,-17):-14,
(163,-14):-14,
(163,-13):-14,
(163,-12):-14,
(163,-11):-14,
(163,-10):-14,
(164,-18):-20,
(164,-17):-20,
(164,-14):-20,
(164,-13):-20,
(164,-12):-20,
(164,-11):-20,
(164,-10):-20,
(165,-8):167,
(166,-18):-21,
(166,-17):-21,
(166,-14):-21,
(166,-13):-21,
(166,-12):-21,
(166,-11):-21,
(166,-10):-21,
(167,-18):-22,
(167,-17):-22,
(167,-14):-22,
(167,-13):-22,
(167,-12):-22,
(167,-11):-22,
(167,-10):-22,
},
'nonterms':(
u'%start',
u'file',
u'line',
u'directive',
u'expression',
u'exp_plusminus',
u'exp_timesdivide',
u'exp_term',
u'expression_list_with_comma',
u'expression_list',
u'production',
u'productionAlternatives',
u'productionRule',
u'productionList',
),
'rules':[
(0,(1,),None),
(1,(2,),None),
(1,(1,2),None),
(2,(3,),None),
(2,(10,),None),
(3,(-2,4),(u'(',u'processDirective',[(u'$',1),(u'$',2)])),
(4,(5,),(u'$',1)),
(4,(-1,-3,5),(u'(',u'exprOper',[(u'$',2),(u'$',1),(u'$',3)])),
(5,(6,),(u'$',1)),
(5,(5,-10,6),(u'(',u'exprOper',[(u'$',2),(u'$',1),(u'$',3)])),
(5,(5,-11,6),(u'(',u'exprOper',[(u'$',2),(u'$',1),(u'$',3)])),
(6,(7,),(u'$',1)),
(6,(6,-12,7),(u'(',u'exprOper',[(u'$',2),(u'$',1),(u'$',3)])),
(6,(6,-13,7),(u'(',u'exprOper',[(u'$',2),(u'$',1),(u'$',3)])),
(6,(6,-14,7),(u'(',u'exprOper',[(u'$',2),(u'$',1),(u'$',3)])),
(7,(-1,),(u'(',u'exprToken',[(u'$',1)])),
(7,(-6,),(u'(',u'exprString',[(u'$',1)])),
(7,(-4,),(u'(',u'exprNumber',[(u'$',1)])),
(7,(-5,),(u'(',u'exprPosParam',[(u'$',1)])),
(7,(-7,-8),[]),
(7,(-7,8,-8),(u'$',2)),
(7,(-1,-7,-8),(u'(',u'exprFuncCall',[(u'(',u'exprToken',[(u'$',1)]),[]])),
(7,(-1,-7,8,-8),(u'(',u'exprFuncCall',[(u'(',u'exprToken',[(u'$',1)]),(u'$',3)])),
(8,(9,),(u'$',1)),
(8,(9,-9),(u'$',1)),
(9,(4,),[(u'$',1)]),
(9,(9,-9,4),(u'+',(u'$',1),[(u'$',3)])),
(10,(-1,-15,11,-18),(u'(',u'fpgAddToGrammar',[(u'$',1),(u'$',3)])),
(11,(12,),[(u'$',1)]),
(11,(11,-17,12),(u'+',(u'$',1),[(u'$',3)])),
(12,(13,),[(u'$',1)]),
(12,(13,-16,4),[(u'$',1),(u'$',3)]),
(13,(-1,),[(u'$',1)]),
(13,(13,-1),(u'+',(u'$',1),[(u'$',2)])),
],
'tokens':(
u'%eof',
u'C_TOKEN',
u'C_DIRECTIVE',
u'C_EQUALS',
u'C_NUMBER',
u'C_POS_PARAM',
u'C_QUOTEDSTR',
u'C_PAREN_OPEN',
u'C_PAREN_CLOSE',
u'C_COMMA',
u'C_PLUS',
u'C_MINUS',
u'C_TIMES',
u'C_DIVIDE',
u'C_MODULO',
u'C_DERIVES',
u'C_ACTION',
u'P_ALTERNATE',
u'P_END_PRODUCTION',
),
}
#!/usr/bin/python ######################################################################## # This file was automatically generated by fpg version 1.0.0-alpha1 ######################################################################## #print >> sys.stderr, "* parser states %s values %s lookahead %s" % (repr(states), repr(values), repr(lookahead)) # special stuff to allow the action processor to change the input source: # tell the lexer to save the lookahead