let to_string =
function
| KEYWORD s -> sprintf "KEYWORD %S" s
| SYMBOL s -> sprintf "SYMBOL %S" s
| LIDENT s -> sprintf "LIDENT %S" s
| UIDENT s -> sprintf "UIDENT %S" s
| INT (_, s) -> sprintf "INT %s" s
| INT32 (_, s) -> sprintf "INT32 %sd" s
| INT64 (_, s) -> sprintf "INT64 %sd" s
| NATIVEINT (_, s) -> sprintf "NATIVEINT %sd" s
| FLOAT (_, s) -> sprintf "FLOAT %s" s
| CHAR (_, s) -> sprintf "CHAR '%s'" s
| STRING (_, s) -> sprintf "STRING \"%s\"" s
| LABEL s -> sprintf "LABEL %S" s
| OPTLABEL s -> sprintf "OPTLABEL %S" s
| ANTIQUOT (n, s) -> sprintf "ANTIQUOT %s: %S" n s
| QUOTATION x ->
sprintf
"QUOTATION { q_name=%S; q_loc=%S; q_shift=%d; q_contents=%S }"
x.q_name x.q_loc x.q_shift x.q_contents
| COMMENT s -> sprintf "COMMENT %S" s
| BLANKS s -> sprintf "BLANKS %S" s
| NEWLINE -> sprintf "NEWLINE"
| EOI -> sprintf "EOI"
| ESCAPED_IDENT s -> sprintf "ESCAPED_IDENT %S" s
| LINE_DIRECTIVE (i, None) -> sprintf "LINE_DIRECTIVE %d" i
| LINE_DIRECTIVE (i, (Some s)) ->
sprintf "LINE_DIRECTIVE %d %S" i s