anchor.diff:      rule String: TSTRING {{ return eval(TSTRING) }}
               | STRING {{ return eval(STRING) }}
   
  -    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 OptSimpleArray: "\[" NUMBER "\]" {{ return int(NUMBER) }}
               | {{ return 0 }}
  -    rule OptArray: "\[" NUMBER OptArrayPersonality "\]" {{ return OptArrayPersonality and (int(NUMBER), OptArrayPersonality) or int(NUMBER) }}
  +
  +    rule OptArray: "\[" NUMBER "\]" {{ return int(NUMBER) }}
               | {{ return 0 }}
  -    rule OptArrayPersonality: ":" Personality {{ return Personality }}
  +
  +    rule OptArrayIndex: "\[" SValue "\]" {{ return SValue }}
               | {{ return None }}
  +
       rule OptString: TSTRING {{ return eval(TSTRING) }}
               | STRING {{ return eval(STRING) }}
               | {{ return '' }}
  +
       rule OptAssign: "=" Value {{ return Value; }}
                   | {{ return None }}
  +
       rule OptSAssign: "=" SValue {{ return SValue; }}
                   | {{ return None }}
  +
       rule OptFP: "fp" {{ return 1 }} | "nofp" {{ return 0 }} | {{ return 1 }}
  +
       rule Value: "yes" {{ return 1 }} | "no" {{ return 0 }}
                   | "true" {{ return 1 }} | "false" {{ return 0 }}
                   | "TRUE" {{ return 1 }} | "FALSE" {{ return 0 }}
                   | NAME {{ return NAME }}
                   | FPNUMBER {{ return float(FPNUMBER.rstrip("f")) }}
                   | NUMBER {{ return int(NUMBER,0) }}
  +
       rule SValue: "yes" {{ return "yes" }} | "no" {{ return "no" }}
                   | "true" {{ return "true" }} | "false" {{ return "false" }}
                   | "TRUE" {{ return "TRUE" }} | "FALSE" {{ return "FALSE" }}
                   | NAME {{ return NAME }}
                   | FPNUMBER {{ return FPNUMBER }}
                   | NUMBER {{ return NUMBER }}
  +                | STRING {{ return STRING}}
  +
       rule OptValue: Value {{ return Value }}
                   | {{ return 1 }}
  +
       rule OptSValue: SValue {{ return SValue }}
                   | {{ return 1 }}
   %%
  
positive.code:     lead = ".TP"
      if params:
          print >>f, ".SH PARAMETERS"
          for _, name, type, array, dir, doc, value, personality in finddocs('param'):
              print >>f, lead
              print >>f, ".B %s\\fR" % to_hal_man(name),
              print >>f, type, dir,
              if array:
                  sz = name.count("#")
                  if isinstance(array, tuple):
                      print >>f, " (%s=%0*d..%s)" % ("M" * sz, sz, 0, array[1]),
                  else:
                      print >>f, " (%s=%0*d..%0*d)" % ("M" * sz, sz, 0, sz, array-1),
              if personality:
                  print >>f, " [if %s]" % personality,
              if value:
                  print >>f, "\\fR(default: \\fI%s\\fR)" % value
              else:
  
negative.code:                 tempdir = tempfile.mkdtemp()
                  try:
                      shutil.copy(f, tempdir)
                      build_rt(tempdir, os.path.join(tempdir, os.path.basename(f)), mode, f)
                  finally:
                      shutil.rmtree(tempdir)
              else:
  