anchor.diff:      rule String: TSTRING {{ return eval(TSTRING) }} 
               | STRING {{ return eval(STRING) }}
    
  -    rule OptArray: '\[' NUMBER '\]' {{ return int(NUMBER) }}
  -            | {{ return 0 }} 
  +    rule OptPersonality: "if" Personality {{ return Personality }}
  +            | {{ return None }}
  +    rule Personality: {{ pp = [] }} (PersonalityPart {{ pp.append(PersonalityPart) }} )* {{ return " ".join(pp) }}
  +    rule PersonalityPart: NUMBER {{ return NUMBER }}
  +            | POP {{ return POP }}
  +    rule OptArray: "\[" NUMBER OptArrayPersonality "\]" {{ return OptArrayPersonality and (int(NUMBER), OptArrayPersonality) or int(NUMBER) }}
  +            | {{ return 0 }}
  +    rule OptArrayPersonality: ":" Personality {{ return Personality }}
  +            | {{ return None }} 
       rule OptString: TSTRING {{ return eval(TSTRING) }} 
               | STRING {{ return eval(STRING) }}
               | {{ return '' }}
  
positive.code:     if options.get("extra_cleanup"):
          print >>f, "static void extra_cleanup(void);"
  
      has_array = False
      for name, type, array, dir, value in pins:
          if array: has_array = True
      for name, type, array, dir, value in params:
          if array: has_array = True
  
      print >>f
      print >>f, "static int export(char *prefix, long extra_arg) {"
      print >>f, "    char buf[HAL_NAME_LEN + 2];"
      print >>f, "    int r = 0;"
      if has_array:
  
negative.code:     token NAME: "[a-zA-Z_][a-zA-Z0-9_]*"
      token HALNAME: "[#a-zA-Z_][-#a-zA-Z0-9_.]*"
      token FPNUMBER: "-?([0-9]*\.[0-9]+|[0-9]+\.?)([Ee][+-]?[0-9]+)?f?"
      token NUMBER: "0x[0-9a-fA-F]+|[+-]?[0-9]+"
      token STRING: "\"(\\.|[^\\\"])*\""
      token POP: "[-()+*/]|&&|\\|\\||personality|==|&|!=|<|<=|>|>="
      token TSTRING: "\"\"\"(\\.|\\\n|[^\\\"]|\"(?!\"\")|\n)*\"\"\""
  
      rule File: Declaration* "$" {{ return True }}
      rule Declaration:
          "component" NAME OptString";" {{ comp(NAME, OptString); }}
        | "pin" PINDIRECTION TYPE HALNAME OptArray OptAssign OptPersonality OptString ";"  {{ pin(HALNAME, TYPE, OptArray, PINDIRECTION, OptString, OptAssign, OptPersonality) }}
        | "param" PARAMDIRECTION TYPE HALNAME OptArray OptAssign OptPersonality OptString ";" {{ param(HALNAME, TYPE, OptArray, PARAMDIRECTION, OptString, OptAssign, OptPersonality) }}
        | "function" NAME OptFP OptString ";"       {{ function(NAME, OptFP, OptString) }}
        | "option" NAME OptValue ";"   {{ option(NAME, OptValue) }}
        | "see_also" String ";"   {{ see_also(String) }}
  