camlspotter avatar camlspotter committed 5f6fb4d

port to ocaml 4

Comments (0)

Files changed (16)

 OCAML_BYTE_LINK_FLAGS +=
 OCAML_NATIVE_LINK_FLAGS +=
 
-CAMLP4PACKS[]= sexplib
+CAMLP4PACKS[]= sexplib compiler-libs.common
 
-OCAMLPACKS[]= sexplib
+OCAMLPACKS[]= sexplib compiler-libs.common
 
 OCAMLDEPFLAGS= -syntax camlp4o -package sexplib.syntax
 OCAMLPPFLAGS= -syntax camlp4o -package sexplib.syntax
 
 FILES[] =
-    misc
-    linenum
-    location
     pos
-    parser
-    lexer
     reader
     tokenstr
+    xparser
     machine
     args
     main
 
-lexer.cmi: parser.cmi
-
 PROGRAM = ocaml-indent
 
 OCAML_LIBS +=
 #   Subdirs()
 #
 # It includes "findlib" by default. If you want to build findlib in OMy framework, you have to remove it from the list.
-OCAML_PREINSTALLED_PACKS[]= bigarray camlp4 dbm dynlink graphics num num-top stdlib str threads unix findlib
+OCAML_PREINSTALLED_PACKS[]= bigarray camlp4 dbm dynlink graphics num num-top stdlib str threads unix findlib compiler-libs
 
 # byte/nat
 NATIVE_ENABLED = $(OCAMLOPT_EXISTS)

lexer.mli

-(***********************************************************************)
-(*                                                                     *)
-(*                           Objective Caml                            *)
-(*                                                                     *)
-(*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         *)
-(*                                                                     *)
-(*  Copyright 1996 Institut National de Recherche en Informatique et   *)
-(*  en Automatique.  All rights reserved.  This file is distributed    *)
-(*  under the terms of the Q Public License version 1.0.               *)
-(*                                                                     *)
-(***********************************************************************)
-
-(* $Id: lexer.mli 5961 2003-11-21 16:01:13Z xleroy $ *)
-
-(* The lexical analyzer *)
-
-val token: Lexing.lexbuf -> Parser.token
-val skip_sharp_bang: Lexing.lexbuf -> unit
-
-type error =
-  | Illegal_character of char
-  | Illegal_escape of string
-  | Unterminated_comment
-  | Unterminated_string
-  | Unterminated_string_in_comment
-  | Keyword_as_label of string
-  | Literal_overflow of string
-;;
-
-exception Error of error * Location.t
-
-open Format
-
-val report_error: formatter -> error -> unit
-
-val in_comment : unit -> bool;;

lexer.mll

-(***********************************************************************)
-(*                                                                     *)
-(*                           Objective Caml                            *)
-(*                                                                     *)
-(*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         *)
-(*                                                                     *)
-(*  Copyright 1996 Institut National de Recherche en Informatique et   *)
-(*  en Automatique.  All rights reserved.  This file is distributed    *)
-(*  under the terms of the Q Public License version 1.0.               *)
-(*                                                                     *)
-(***********************************************************************)
-
-(* $Id: lexer.mll 10250 2010-04-08 03:58:41Z garrigue $ *)
-
-(* The lexer definition *)
-
-{
-open Lexing
-open Misc
-open Parser
-
-type error =
-  | Illegal_character of char
-  | Illegal_escape of string
-  | Unterminated_comment
-  | Unterminated_string
-  | Unterminated_string_in_comment
-  | Keyword_as_label of string
-  | Literal_overflow of string
-;;
-
-exception Error of error * Location.t;;
-
-(* The table of keywords *)
-
-let keyword_table =
-  create_hashtable 149 [
-    "and", AND;
-    "as", AS;
-    "assert", ASSERT;
-    "begin", BEGIN;
-    "class", CLASS;
-    "constraint", CONSTRAINT;
-    "do", DO;
-    "done", DONE;
-    "downto", DOWNTO;
-    "else", ELSE;
-    "end", END;
-    "exception", EXCEPTION;
-    "external", EXTERNAL;
-    "false", FALSE;
-    "for", FOR;
-    "fun", FUN;
-    "function", FUNCTION;
-    "functor", FUNCTOR;
-    "if", IF;
-    "in", IN;
-    "include", INCLUDE;
-    "inherit", INHERIT;
-    "initializer", INITIALIZER;
-    "lazy", LAZY;
-    "let", LET;
-    "match", MATCH;
-    "method", METHOD;
-    "module", MODULE;
-    "mutable", MUTABLE;
-    "new", NEW;
-    "object", OBJECT;
-    "of", OF;
-    "open", OPEN;
-    "or", OR;
-(*  "parser", PARSER; *)
-    "private", PRIVATE;
-    "rec", REC;
-    "sig", SIG;
-    "struct", STRUCT;
-    "then", THEN;
-    "to", TO;
-    "true", TRUE;
-    "try", TRY;
-    "type", TYPE;
-    "val", VAL;
-    "virtual", VIRTUAL;
-    "when", WHEN;
-    "while", WHILE;
-    "with", WITH;
-
-    "mod", INFIXOP3("mod");
-    "land", INFIXOP3("land");
-    "lor", INFIXOP3("lor");
-    "lxor", INFIXOP3("lxor");
-    "lsl", INFIXOP4("lsl");
-    "lsr", INFIXOP4("lsr");
-    "asr", INFIXOP4("asr")
-]
-
-(* To buffer string literals *)
-
-let initial_string_buffer = String.create 256
-let string_buff = ref initial_string_buffer
-let string_index = ref 0
-
-let reset_string_buffer () =
-  string_buff := initial_string_buffer;
-  string_index := 0
-
-let store_string_char c =
-  if !string_index >= String.length (!string_buff) then begin
-    let new_buff = String.create (String.length (!string_buff) * 2) in
-      String.blit (!string_buff) 0 new_buff 0 (String.length (!string_buff));
-      string_buff := new_buff
-  end;
-  String.unsafe_set (!string_buff) (!string_index) c;
-  incr string_index
-
-let get_stored_string () =
-  let s = String.sub (!string_buff) 0 (!string_index) in
-  string_buff := initial_string_buffer;
-  s
-
-(* To store the position of the beginning of a string and comment *)
-let string_start_loc = ref Location.none;;
-let comment_start_loc = ref [];;
-let in_comment () = !comment_start_loc <> [];;
-
-(* To translate escape sequences *)
-
-let char_for_backslash = function
-  | 'n' -> '\010'
-  | 'r' -> '\013'
-  | 'b' -> '\008'
-  | 't' -> '\009'
-  | c   -> c
-
-let char_for_decimal_code lexbuf i =
-  let c = 100 * (Char.code(Lexing.lexeme_char lexbuf i) - 48) +
-           10 * (Char.code(Lexing.lexeme_char lexbuf (i+1)) - 48) +
-                (Char.code(Lexing.lexeme_char lexbuf (i+2)) - 48) in
-  if (c < 0 || c > 255) then
-    if in_comment ()
-    then 'x'
-    else raise (Error(Illegal_escape (Lexing.lexeme lexbuf),
-                      Location.curr lexbuf))
-  else Char.chr c
-
-let char_for_hexadecimal_code lexbuf i =
-  let d1 = Char.code (Lexing.lexeme_char lexbuf i) in
-  let val1 = if d1 >= 97 then d1 - 87
-             else if d1 >= 65 then d1 - 55
-             else d1 - 48
-  in
-  let d2 = Char.code (Lexing.lexeme_char lexbuf (i+1)) in
-  let val2 = if d2 >= 97 then d2 - 87
-             else if d2 >= 65 then d2 - 55
-             else d2 - 48
-  in
-  Char.chr (val1 * 16 + val2)
-
-(* To convert integer literals, allowing max_int + 1 (PR#4210) *)
-
-let cvt_int_literal s =
-  - int_of_string ("-" ^ s)
-let cvt_int32_literal s =
-  Int32.neg (Int32.of_string ("-" ^ String.sub s 0 (String.length s - 1)))
-let cvt_int64_literal s =
-  Int64.neg (Int64.of_string ("-" ^ String.sub s 0 (String.length s - 1)))
-let cvt_nativeint_literal s =
-  Nativeint.neg (Nativeint.of_string ("-" ^ String.sub s 0 (String.length s - 1)))
-
-(* Remove underscores from float literals *)
-
-let remove_underscores s =
-  let l = String.length s in
-  let rec remove src dst =
-    if src >= l then
-      if dst >= l then s else String.sub s 0 dst
-    else
-      match s.[src] with
-        '_' -> remove (src + 1) dst
-      |  c  -> s.[dst] <- c; remove (src + 1) (dst + 1)
-  in remove 0 0
-
-(* Update the current location with file name and line number. *)
-
-let update_loc lexbuf file line absolute chars =
-  let pos = lexbuf.lex_curr_p in
-  let new_file = match file with
-                 | None -> pos.pos_fname
-                 | Some s -> s
-  in
-  lexbuf.lex_curr_p <- { pos with
-    pos_fname = new_file;
-    pos_lnum = if absolute then line else pos.pos_lnum + line;
-    pos_bol = pos.pos_cnum - chars;
-  }
-;;
-
-(* Error report *)
-
-open Format
-
-let report_error ppf = function
-  | Illegal_character c ->
-      fprintf ppf "Illegal character (%s)" (Char.escaped c)
-  | Illegal_escape s ->
-      fprintf ppf "Illegal backslash escape in string or character (%s)" s
-  | Unterminated_comment ->
-      fprintf ppf "Comment not terminated"
-  | Unterminated_string ->
-      fprintf ppf "String literal not terminated"
-  | Unterminated_string_in_comment ->
-      fprintf ppf "This comment contains an unterminated string literal"
-  | Keyword_as_label kwd ->
-      fprintf ppf "`%s' is a keyword, it cannot be used as label name" kwd
-  | Literal_overflow ty ->
-      fprintf ppf "Integer literal exceeds the range of representable integers of type %s" ty
-;;
-
-}
-
-let newline = ('\010' | '\013' | "\013\010")
-let blank = [' ' '\009' '\012']
-let lowercase = ['a'-'z' '\223'-'\246' '\248'-'\255' '_']
-let uppercase = ['A'-'Z' '\192'-'\214' '\216'-'\222']
-let identchar =
-  ['A'-'Z' 'a'-'z' '_' '\192'-'\214' '\216'-'\246' '\248'-'\255' '\'' '0'-'9']
-let symbolchar =
-  ['!' '$' '%' '&' '*' '+' '-' '.' '/' ':' '<' '=' '>' '?' '@' '^' '|' '~']
-let decimal_literal =
-  ['0'-'9'] ['0'-'9' '_']*
-let hex_literal =
-  '0' ['x' 'X'] ['0'-'9' 'A'-'F' 'a'-'f']['0'-'9' 'A'-'F' 'a'-'f' '_']*
-let oct_literal =
-  '0' ['o' 'O'] ['0'-'7'] ['0'-'7' '_']*
-let bin_literal =
-  '0' ['b' 'B'] ['0'-'1'] ['0'-'1' '_']*
-let int_literal =
-  decimal_literal | hex_literal | oct_literal | bin_literal
-let float_literal =
-  ['0'-'9'] ['0'-'9' '_']*
-  ('.' ['0'-'9' '_']* )?
-  (['e' 'E'] ['+' '-']? ['0'-'9'] ['0'-'9' '_']*)?
-
-rule token = parse
-  | newline
-      { update_loc lexbuf None 1 false 0;
-        token lexbuf
-      }
-  | blank +
-      { token lexbuf }
-  | "_"
-      { UNDERSCORE }
-  | "~"
-      { TILDE }
-  | "~" lowercase identchar * ':'
-      { let s = Lexing.lexeme lexbuf in
-        let name = String.sub s 1 (String.length s - 2) in
-        if Hashtbl.mem keyword_table name then
-          raise (Error(Keyword_as_label name, Location.curr lexbuf));
-        LABEL name }
-  | "?"  { QUESTION }
-  | "??" { QUESTIONQUESTION }
-  | "?" lowercase identchar * ':'
-      { let s = Lexing.lexeme lexbuf in
-        let name = String.sub s 1 (String.length s - 2) in
-        if Hashtbl.mem keyword_table name then
-          raise (Error(Keyword_as_label name, Location.curr lexbuf));
-        OPTLABEL name }
-  | lowercase identchar *
-      { let s = Lexing.lexeme lexbuf in
-          try
-            Hashtbl.find keyword_table s
-          with Not_found ->
-            LIDENT s }
-  | uppercase identchar *
-      { UIDENT(Lexing.lexeme lexbuf) }       (* No capitalized keywords *)
-  | int_literal
-      { try
-          INT (cvt_int_literal (Lexing.lexeme lexbuf))
-        with Failure _ ->
-          raise (Error(Literal_overflow "int", Location.curr lexbuf))
-      }
-  | float_literal
-      { FLOAT (remove_underscores(Lexing.lexeme lexbuf)) }
-  | int_literal "l"
-      { try
-          INT32 (cvt_int32_literal (Lexing.lexeme lexbuf))
-        with Failure _ ->
-          raise (Error(Literal_overflow "int32", Location.curr lexbuf)) }
-  | int_literal "L"
-      { try
-          INT64 (cvt_int64_literal (Lexing.lexeme lexbuf))
-        with Failure _ ->
-          raise (Error(Literal_overflow "int64", Location.curr lexbuf)) }
-  | int_literal "n"
-      { try
-          NATIVEINT (cvt_nativeint_literal (Lexing.lexeme lexbuf))
-        with Failure _ ->
-          raise (Error(Literal_overflow "nativeint", Location.curr lexbuf)) }
-  | "\""
-      { reset_string_buffer();
-        let string_start = lexbuf.lex_start_p in
-        string_start_loc := Location.curr lexbuf;
-        string lexbuf;
-        lexbuf.lex_start_p <- string_start;
-        STRING (get_stored_string()) }
-  | "'" newline "'"
-      { update_loc lexbuf None 1 false 1;
-        CHAR (Lexing.lexeme_char lexbuf 1) }
-  | "'" [^ '\\' '\'' '\010' '\013'] "'"
-      { CHAR(Lexing.lexeme_char lexbuf 1) }
-  | "'\\" ['\\' '\'' '"' 'n' 't' 'b' 'r' ' '] "'"
-      { CHAR(char_for_backslash (Lexing.lexeme_char lexbuf 2)) }
-  | "'\\" ['0'-'9'] ['0'-'9'] ['0'-'9'] "'"
-      { CHAR(char_for_decimal_code lexbuf 2) }
-  | "'\\" 'x' ['0'-'9' 'a'-'f' 'A'-'F'] ['0'-'9' 'a'-'f' 'A'-'F'] "'"
-      { CHAR(char_for_hexadecimal_code lexbuf 3) }
-  | "'\\" _
-      { let l = Lexing.lexeme lexbuf in
-        let esc = String.sub l 1 (String.length l - 1) in
-        raise (Error(Illegal_escape esc, Location.curr lexbuf))
-      }
-  | "(*"
-      { comment_start_loc := [Location.curr lexbuf];
-        comment lexbuf;
-        (* token lexbuf *) }
-  | "(*)"
-      { (* let loc = Location.curr lexbuf in
-           Location.prerr_warning loc Warnings.Comment_start; *)
-        comment_start_loc := [Location.curr lexbuf];
-        comment lexbuf;
-        (* token lexbuf *)
-      }
-  | "*)"
-      { (* let loc = Location.curr lexbuf in
-           Location.prerr_warning loc Warnings.Comment_not_end; *)
-        lexbuf.Lexing.lex_curr_pos <- lexbuf.Lexing.lex_curr_pos - 1;
-        let curpos = lexbuf.lex_curr_p in
-        lexbuf.lex_curr_p <- { curpos with pos_cnum = curpos.pos_cnum - 1 };
-        STAR
-      }
-  | "#" [' ' '\t']* (['0'-'9']+ as num) [' ' '\t']*
-        ("\"" ([^ '\010' '\013' '"' ] * as name) "\"")?
-        [^ '\010' '\013'] * newline
-      { update_loc lexbuf name (int_of_string num) true 0;
-        token lexbuf
-      }
-  | "#"  { SHARP }
-  | "&"  { AMPERSAND }
-  | "&&" { AMPERAMPER }
-  | "`"  { BACKQUOTE }
-  | "'"  { QUOTE }
-  | "("  { LPAREN }
-  | ")"  { RPAREN }
-  | "*"  { STAR }
-  | ","  { COMMA }
-  | "->" { MINUSGREATER }
-  | "."  { DOT }
-  | ".." { DOTDOT }
-  | ":"  { COLON }
-  | "::" { COLONCOLON }
-  | ":=" { COLONEQUAL }
-  | ":>" { COLONGREATER }
-  | ";"  { SEMI }
-  | ";;" { SEMISEMI }
-  | "<"  { LESS }
-  | "<-" { LESSMINUS }
-  | "="  { EQUAL }
-  | "["  { LBRACKET }
-  | "[|" { LBRACKETBAR }
-  | "[<" { LBRACKETLESS }
-  | "[>" { LBRACKETGREATER }
-  | "]"  { RBRACKET }
-  | "{"  { LBRACE }
-  | "{<" { LBRACELESS }
-  | "|"  { BAR }
-  | "||" { BARBAR }
-  | "|]" { BARRBRACKET }
-  | ">"  { GREATER }
-  | ">]" { GREATERRBRACKET }
-  | "}"  { RBRACE }
-  | ">}" { GREATERRBRACE }
-  | "!"  { BANG }
-
-  | "!=" { INFIXOP0 "!=" }
-  | "+"  { PLUS }
-  | "+." { PLUSDOT }
-  | "-"  { MINUS }
-  | "-." { MINUSDOT }
-
-  | "!" symbolchar +
-            { PREFIXOP(Lexing.lexeme lexbuf) }
-  | ['~' '?'] symbolchar +
-            { PREFIXOP(Lexing.lexeme lexbuf) }
-  | ['=' '<' '>' '|' '&' '$'] symbolchar *
-            { INFIXOP0(Lexing.lexeme lexbuf) }
-  | ['@' '^'] symbolchar *
-            { INFIXOP1(Lexing.lexeme lexbuf) }
-  | ['+' '-'] symbolchar *
-            { INFIXOP2(Lexing.lexeme lexbuf) }
-  | "**" symbolchar *
-            { INFIXOP4(Lexing.lexeme lexbuf) }
-  | ['*' '/' '%'] symbolchar *
-            { INFIXOP3(Lexing.lexeme lexbuf) }
-  | eof { EOF }
-  | _
-      { raise (Error(Illegal_character (Lexing.lexeme_char lexbuf 0),
-                     Location.curr lexbuf))
-      }
-
-and comment = parse
-    "(*"
-      { comment_start_loc := (Location.curr lexbuf) :: !comment_start_loc;
-        comment lexbuf;
-      }
-  | "*)"
-      { match !comment_start_loc with
-        | [] -> assert false
-        | [x] -> comment_start_loc := []; lexbuf.lex_start_p <- x.Location.loc_start; COMMENT
-        | _ :: l -> comment_start_loc := l;
-                    comment lexbuf;
-       }
-  | "\""
-      { reset_string_buffer();
-        string_start_loc := Location.curr lexbuf;
-        begin try string lexbuf
-        with Error (Unterminated_string, _) ->
-          match !comment_start_loc with
-          | [] -> assert false
-          | loc :: _ -> comment_start_loc := [];
-                        raise (Error (Unterminated_string_in_comment, loc))
-        end;
-        reset_string_buffer ();
-        comment lexbuf }
-  | "''"
-      { comment lexbuf }
-  | "'" newline "'"
-      { update_loc lexbuf None 1 false 1;
-        comment lexbuf
-      }
-  | "'" [^ '\\' '\'' '\010' '\013' ] "'"
-      { comment lexbuf }
-  | "'\\" ['\\' '"' '\'' 'n' 't' 'b' 'r' ' '] "'"
-      { comment lexbuf }
-  | "'\\" ['0'-'9'] ['0'-'9'] ['0'-'9'] "'"
-      { comment lexbuf }
-  | "'\\" 'x' ['0'-'9' 'a'-'f' 'A'-'F'] ['0'-'9' 'a'-'f' 'A'-'F'] "'"
-      { comment lexbuf }
-  | eof
-      { match !comment_start_loc with
-        | [] -> assert false
-        | loc :: _ -> comment_start_loc := [];
-                      raise (Error (Unterminated_comment, loc))
-      }
-  | newline
-      { update_loc lexbuf None 1 false 0;
-        comment lexbuf
-      }
-  | _
-      { comment lexbuf }
-
-and string = parse
-    '"'
-      { () }
-  | '\\' newline ([' ' '\t'] * as space)
-      { update_loc lexbuf None 1 false (String.length space);
-        string lexbuf
-      }
-  | '\\' ['\\' '\'' '"' 'n' 't' 'b' 'r' ' ']
-      { store_string_char(char_for_backslash(Lexing.lexeme_char lexbuf 1));
-        string lexbuf }
-  | '\\' ['0'-'9'] ['0'-'9'] ['0'-'9']
-      { store_string_char(char_for_decimal_code lexbuf 1);
-         string lexbuf }
-  | '\\' 'x' ['0'-'9' 'a'-'f' 'A'-'F'] ['0'-'9' 'a'-'f' 'A'-'F']
-      { store_string_char(char_for_hexadecimal_code lexbuf 2);
-         string lexbuf }
-  | '\\' _
-      { if in_comment ()
-        then string lexbuf
-        else begin
-(*  Should be an error, but we are very lax.
-          raise (Error (Illegal_escape (Lexing.lexeme lexbuf),
-                        Location.curr lexbuf))
-*)
-          (* let loc = Location.curr lexbuf in
-             Location.prerr_warning loc Warnings.Illegal_backslash; *)
-          store_string_char (Lexing.lexeme_char lexbuf 0);
-          store_string_char (Lexing.lexeme_char lexbuf 1);
-          string lexbuf
-        end
-      }
-  | newline
-      { (* if not (in_comment ()) then
-           Location.prerr_warning (Location.curr lexbuf) Warnings.Eol_in_string; *)
-        update_loc lexbuf None 1 false 0;
-        let s = Lexing.lexeme lexbuf in
-        for i = 0 to String.length s - 1 do
-          store_string_char s.[i];
-        done;
-        string lexbuf
-      }
-  | eof
-      { raise (Error (Unterminated_string, !string_start_loc)) }
-  | _
-      { store_string_char(Lexing.lexeme_char lexbuf 0);
-        string lexbuf }
-
-and skip_sharp_bang = parse
-  | "#!" [^ '\n']* '\n' [^ '\n']* "\n!#\n"
-       { update_loc lexbuf None 3 false 0 }
-  | "#!" [^ '\n']* '\n'
-       { update_loc lexbuf None 1 false 0 }
-  | "" { () }

linenum.mli

-(***********************************************************************)
-(*                                                                     *)
-(*                           Objective Caml                            *)
-(*                                                                     *)
-(*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         *)
-(*                                                                     *)
-(*  Copyright 1997 Institut National de Recherche en Informatique et   *)
-(*  en Automatique.  All rights reserved.  This file is distributed    *)
-(*  under the terms of the Q Public License version 1.0.               *)
-(*                                                                     *)
-(***********************************************************************)
-
-(* $Id: linenum.mli 2553 1999-11-17 18:59:06Z xleroy $ *)
-
-(* An auxiliary lexer for determining the line number corresponding to
-   a file position, honoring the directives # linenum "filename" *)
-
-val for_position: string -> int -> string * int * int
-        (* [Linenum.for_position file loc] returns a triple describing
-           the location [loc] in the file named [file].
-           First result is name of actual source file.
-           Second result is line number in that source file.
-           Third result is position of beginning of that line in [file]. *)

linenum.mll

-(***********************************************************************)
-(*                                                                     *)
-(*                           Objective Caml                            *)
-(*                                                                     *)
-(*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         *)
-(*                                                                     *)
-(*  Copyright 1997 Institut National de Recherche en Informatique et   *)
-(*  en Automatique.  All rights reserved.  This file is distributed    *)
-(*  under the terms of the Q Public License version 1.0.               *)
-(*                                                                     *)
-(***********************************************************************)
-
-(* $Id: linenum.mll 9547 2010-01-22 12:48:24Z doligez $ *)
-
-(* An auxiliary lexer for determining the line number corresponding to
-   a file position, honoring the directives # linenum "filename" *)
-
-{
-let filename = ref ""
-let linenum = ref 0
-let linebeg = ref 0
-
-let parse_sharp_line s =
-  try
-    (* Update the line number and file name *)
-    let l1 = ref 0 in
-    while let c = s.[!l1] in c < '0' || c > '9' do incr l1 done;
-    let l2 = ref (!l1 + 1) in
-    while let c = s.[!l2] in c >= '0' && c <= '9' do incr l2 done;
-    linenum := int_of_string(String.sub s !l1 (!l2 - !l1));
-    let f1 = ref (!l2 + 1) in
-    while !f1 < String.length s && s.[!f1] <> '"' do incr f1 done;
-    let f2 = ref (!f1 + 1) in
-    while !f2 < String.length s && s.[!f2] <> '"' do incr f2 done;
-    if !f1 < String.length s then
-      filename := String.sub s (!f1 + 1) (!f2 - !f1 - 1)
-  with Failure _ | Invalid_argument _ ->
-    Misc.fatal_error "Linenum.parse_sharp_line"
-}
-
-rule skip_line = parse
-    "#" [' ' '\t']* ['0'-'9']+ [' ' '\t']*
-    ("\"" [^ '\n' '\r' '"' (* '"' *) ] * "\"")?
-    [^ '\n' '\r'] *
-    ('\n' | '\r' | "\r\n")
-      { parse_sharp_line(Lexing.lexeme lexbuf);
-        linebeg := Lexing.lexeme_start lexbuf;
-        Lexing.lexeme_end lexbuf }
-  | [^ '\n' '\r'] *
-    ('\n' | '\r' | "\r\n")
-      { incr linenum;
-        linebeg := Lexing.lexeme_start lexbuf;
-        Lexing.lexeme_end lexbuf }
-  | [^ '\n' '\r'] * eof
-      { incr linenum;
-        linebeg := Lexing.lexeme_start lexbuf;
-        raise End_of_file }
-
-{
-
-let for_position file loc =
-  let ic = open_in_bin file in
-  let lb = Lexing.from_channel ic in
-  filename := file;
-  linenum := 1;
-  linebeg := 0;
-  begin try
-    while skip_line lb <= loc do () done
-  with End_of_file -> ()
-  end;
-  close_in ic;
-  (!filename, !linenum - 1, !linebeg)
-
-}

location.ml

-(***********************************************************************)
-(*                                                                     *)
-(*                           Objective Caml                            *)
-(*                                                                     *)
-(*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         *)
-(*                                                                     *)
-(*  Copyright 1996 Institut National de Recherche en Informatique et   *)
-(*  en Automatique.  All rights reserved.  This file is distributed    *)
-(*  under the terms of the Q Public License version 1.0.               *)
-(*                                                                     *)
-(***********************************************************************)
-
-(* $Id: location.ml 11050 2011-05-17 16:14:39Z doligez $ *)
-
-open Lexing
-
-type t = { loc_start: position; loc_end: position; loc_ghost: bool };;
-
-let none = { loc_start = dummy_pos; loc_end = dummy_pos; loc_ghost = true };;
-
-let in_file name =
-  let loc = {
-    pos_fname = name;
-    pos_lnum = 1;
-    pos_bol = 0;
-    pos_cnum = -1;
-  } in
-  { loc_start = loc; loc_end = loc; loc_ghost = true }
-;;
-
-let curr lexbuf = {
-  loc_start = lexbuf.lex_start_p;
-  loc_end = lexbuf.lex_curr_p;
-  loc_ghost = false
-};;
-
-let init lexbuf fname =
-  lexbuf.lex_curr_p <- {
-    pos_fname = fname;
-    pos_lnum = 1;
-    pos_bol = 0;
-    pos_cnum = 0;
-  }
-;;
-
-let symbol_rloc () = {
-  loc_start = Parsing.symbol_start_pos ();
-  loc_end = Parsing.symbol_end_pos ();
-  loc_ghost = false;
-};;
-
-let symbol_gloc () = {
-  loc_start = Parsing.symbol_start_pos ();
-  loc_end = Parsing.symbol_end_pos ();
-  loc_ghost = true;
-};;
-
-let rhs_loc n = {
-  loc_start = Parsing.rhs_start_pos n;
-  loc_end = Parsing.rhs_end_pos n;
-  loc_ghost = false;
-};;
-
-let input_name = ref "_none_"
-let input_lexbuf = ref (None : lexbuf option)
-
-(*
-(* Terminal info *)
-
-let status = ref Terminfo.Uninitialised
-
-let num_loc_lines = ref 0 (* number of lines already printed after input *)
-
-(* Highlight the locations using standout mode. *)
-
-let highlight_terminfo ppf num_lines lb loc1 loc2 =
-  Format.pp_print_flush ppf ();  (* avoid mixing Format and normal output *)
-  (* Char 0 is at offset -lb.lex_abs_pos in lb.lex_buffer. *)
-  let pos0 = -lb.lex_abs_pos in
-  (* Do nothing if the buffer does not contain the whole phrase. *)
-  if pos0 < 0 then raise Exit;
-  (* Count number of lines in phrase *)
-  let lines = ref !num_loc_lines in
-  for i = pos0 to lb.lex_buffer_len - 1 do
-    if lb.lex_buffer.[i] = '\n' then incr lines
-  done;
-  (* If too many lines, give up *)
-  if !lines >= num_lines - 2 then raise Exit;
-  (* Move cursor up that number of lines *)
-  flush stdout; Terminfo.backup !lines;
-  (* Print the input, switching to standout for the location *)
-  let bol = ref false in
-  print_string "# ";
-  for pos = 0 to lb.lex_buffer_len - pos0 - 1 do
-    if !bol then (print_string "  "; bol := false);
-    if pos = loc1.loc_start.pos_cnum || pos = loc2.loc_start.pos_cnum then
-      Terminfo.standout true;
-    if pos = loc1.loc_end.pos_cnum || pos = loc2.loc_end.pos_cnum then
-      Terminfo.standout false;
-    let c = lb.lex_buffer.[pos + pos0] in
-    print_char c;
-    bol := (c = '\n')
-  done;
-  (* Make sure standout mode is over *)
-  Terminfo.standout false;
-  (* Position cursor back to original location *)
-  Terminfo.resume !num_loc_lines;
-  flush stdout
-
-(* Highlight the location by printing it again. *)
-
-let highlight_dumb ppf lb loc =
-  (* Char 0 is at offset -lb.lex_abs_pos in lb.lex_buffer. *)
-  let pos0 = -lb.lex_abs_pos in
-  (* Do nothing if the buffer does not contain the whole phrase. *)
-  if pos0 < 0 then raise Exit;
-  let end_pos = lb.lex_buffer_len - pos0 - 1 in
-  (* Determine line numbers for the start and end points *)
-  let line_start = ref 0 and line_end = ref 0 in
-  for pos = 0 to end_pos do
-    if lb.lex_buffer.[pos + pos0] = '\n' then begin
-      if loc.loc_start.pos_cnum > pos then incr line_start;
-      if loc.loc_end.pos_cnum   > pos then incr line_end;
-    end
-  done;
-  (* Print character location (useful for Emacs) *)
-  Format.fprintf ppf "Characters %i-%i:@."
-                 loc.loc_start.pos_cnum loc.loc_end.pos_cnum;
-  (* Print the input, underlining the location *)
-  Format.pp_print_string ppf "  ";
-  let line = ref 0 in
-  let pos_at_bol = ref 0 in
-  for pos = 0 to end_pos do
-    let c = lb.lex_buffer.[pos + pos0] in
-    if c <> '\n' then begin
-      if !line = !line_start && !line = !line_end then
-        (* loc is on one line: print whole line *)
-        Format.pp_print_char ppf c
-      else if !line = !line_start then
-        (* first line of multiline loc: print ... before loc_start *)
-        if pos < loc.loc_start.pos_cnum
-        then Format.pp_print_char ppf '.'
-        else Format.pp_print_char ppf c
-      else if !line = !line_end then
-        (* last line of multiline loc: print ... after loc_end *)
-        if pos < loc.loc_end.pos_cnum
-        then Format.pp_print_char ppf c
-        else Format.pp_print_char ppf '.'
-      else if !line > !line_start && !line < !line_end then
-        (* intermediate line of multiline loc: print whole line *)
-        Format.pp_print_char ppf c
-    end else begin
-      if !line = !line_start && !line = !line_end then begin
-        (* loc is on one line: underline location *)
-        Format.fprintf ppf "@.  ";
-        for i = !pos_at_bol to loc.loc_start.pos_cnum - 1 do
-          Format.pp_print_char ppf ' '
-        done;
-        for i = loc.loc_start.pos_cnum to loc.loc_end.pos_cnum - 1 do
-          Format.pp_print_char ppf '^'
-        done
-      end;
-      if !line >= !line_start && !line <= !line_end then begin
-        Format.fprintf ppf "@.";
-        if pos < loc.loc_end.pos_cnum then Format.pp_print_string ppf "  "
-      end;
-      incr line;
-      pos_at_bol := pos + 1;
-    end
-  done
-
-(* Highlight the location using one of the supported modes. *)
-
-let rec highlight_locations ppf loc1 loc2 =
-  match !status with
-    Terminfo.Uninitialised ->
-      status := Terminfo.setup stdout; highlight_locations ppf loc1 loc2
-  | Terminfo.Bad_term ->
-      begin match !input_lexbuf with
-        None -> false
-      | Some lb ->
-          let norepeat =
-            try Sys.getenv "TERM" = "norepeat" with Not_found -> false in
-          if norepeat then false else
-            try highlight_dumb ppf lb loc1; true
-            with Exit -> false
-      end
-  | Terminfo.Good_term num_lines ->
-      begin match !input_lexbuf with
-        None -> false
-      | Some lb ->
-          try highlight_terminfo ppf num_lines lb loc1 loc2; true
-          with Exit -> false
-      end
-*)
-
-(* Print the location in some way or another *)
-
-open Format
-
-(*
-let reset () =
-  num_loc_lines := 0
-*)
-
-let (msg_file, msg_line, msg_chars, msg_to, msg_colon, msg_head) =
-  ("File \"", "\", line ", ", characters ", "-", ":", "")
-
-(* return file, line, char from the given position *)
-let get_pos_info pos =
-  let (filename, linenum, linebeg) =
-    if pos.pos_fname = "" && !input_name = "" then
-      ("", -1, 0)
-    else if pos.pos_fname = "" then
-      Linenum.for_position !input_name pos.pos_cnum
-    else
-      (pos.pos_fname, pos.pos_lnum, pos.pos_bol)
-  in
-  (filename, linenum, pos.pos_cnum - linebeg)
-;;
-
-let print ppf loc =
-  let (file, line, startchar) = get_pos_info loc.loc_start in
-  let endchar = loc.loc_end.pos_cnum - loc.loc_start.pos_cnum + startchar in
-  let (startchar, endchar) =
-    if startchar < 0 then (0, 1) else (startchar, endchar)
-  in
-  if file = "" then begin
-(*
-    if highlight_locations ppf loc none then () else
-*)
-      fprintf ppf "Characters %i-%i:@."
-              loc.loc_start.pos_cnum loc.loc_end.pos_cnum
-  end else begin
-    fprintf ppf "%s%s%s%i" msg_file file msg_line line;
-    fprintf ppf "%s%i" msg_chars startchar;
-    fprintf ppf "%s%i%s@.%s" msg_to endchar msg_colon msg_head;
-  end
-;;
-
-let print_error ppf loc =
-  print ppf loc;
-  fprintf ppf "Error: ";
-;;
-
-let print_error_cur_file ppf = print_error ppf (in_file !input_name);;
-
-(*
-let print_warning loc ppf w =
-  if Warnings.is_active w then begin
-    let printw ppf w =
-      let _n = Warnings.print ppf w in
-(*
-      num_loc_lines := !num_loc_lines + n
-*)
-      ()
-    in
-    fprintf ppf "%a" print loc;
-    fprintf ppf "Warning %a@." printw w;
-    pp_print_flush ppf ();
-(*
-    incr num_loc_lines;
-*)
-  end
-;;
-
-let prerr_warning loc w = print_warning loc err_formatter w;;
-*)
-
-let echo_eof () =
-  print_newline ();
-(*
-  incr num_loc_lines
-*)

location.mli

-(***********************************************************************)
-(*                                                                     *)
-(*                           Objective Caml                            *)
-(*                                                                     *)
-(*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         *)
-(*                                                                     *)
-(*  Copyright 1996 Institut National de Recherche en Informatique et   *)
-(*  en Automatique.  All rights reserved.  This file is distributed    *)
-(*  under the terms of the Q Public License version 1.0.               *)
-(*                                                                     *)
-(***********************************************************************)
-
-(* $Id: location.mli 8705 2007-12-04 13:38:58Z doligez $ *)
-
-(* Source code locations (ranges of positions), used in parsetree. *)
-
-open Format
-
-type t = {
-  loc_start: Lexing.position;
-  loc_end: Lexing.position;
-  loc_ghost: bool;
-}
-
-(* Note on the use of Lexing.position in this module.
-   If [pos_fname = ""], then use [!input_name] instead.
-   If [pos_lnum = -1], then [pos_bol = 0]. Use [pos_cnum] and
-     re-parse the file to get the line and character numbers.
-   Else all fields are correct.
-*)
-
-val none : t
-(** An arbitrary value of type [t]; describes an empty ghost range. *)
-val in_file : string -> t;;
-(** Return an empty ghost range located in a given file. *)
-val init : Lexing.lexbuf -> string -> unit
-(** Set the file name and line number of the [lexbuf] to be the start
-    of the named file. *)
-val curr : Lexing.lexbuf -> t
-(** Get the location of the current token from the [lexbuf]. *)
-
-val symbol_rloc: unit -> t
-val symbol_gloc: unit -> t
-val rhs_loc: int -> t
-
-val input_name: string ref
-val input_lexbuf: Lexing.lexbuf option ref
-
-val get_pos_info : Lexing.position -> string * int * int (* file, line, char *)
-val print: formatter -> t -> unit
-val print_error: formatter -> t -> unit
-val print_error_cur_file: formatter -> unit
-(*
-val print_warning: t -> formatter -> Warnings.t -> unit
-val prerr_warning: t -> Warnings.t -> unit
-*)
-val echo_eof: unit -> unit
-(* val reset: unit -> unit *)
-
-(* val highlight_locations: formatter -> t -> t -> bool *)
 open Sexplib.Conv
 open Pos
 
+module Parser = Xparser
+
 module Stack = struct
 
   type k =
   | None -> true
   | Some t ->
       match t with
-      | COMMENT -> assert false (* COMMENT must be skipped *)
+      | COMMENT _ -> assert false (* COMMENT must be skipped *)
       | STRUCT | SEMISEMI
 
       | UIDENT _|STRING _|OPTLABEL _|NATIVEINT _|LIDENT _|LABEL _|INT64 _|INT32 _
   | Some (i, _) when Region.lnum i.Tokenstr.region <> lnum -> false
   | Some (i, str) ->
       match i.Tokenstr.token with
-      | COMMENT -> lparen_read_ahead lnum str
+      | COMMENT _ -> lparen_read_ahead lnum str
       | FUN -> false
       | FUNCTION -> false
       | _ -> true
   | Some (i, _) when Region.lnum i.Tokenstr.region <> lnum -> false
   | Some (i, str) ->
       match i.Tokenstr.token with
-      | COMMENT -> lparen_read_ahead lnum str
+      | COMMENT _ -> lparen_read_ahead lnum str
       | _ -> true
 
 let lbracket_read_ahead = lbrace_read_ahead
         in
         f bases0
 
-    | COMMENT ->
+    | COMMENT _ ->
         (* Comments are tricky. It is:
 
            - sometimes affected by the previous line's indentation
             (* Now move to the next token *)
             (* CR jfuruse: last_token thing seems strange. The state machine should be able to
                access previous tokens freely. (But with risk of memory leak) *)
-            let last_token = if t <> Parser.COMMENT then Some t else state.State.last_token in
+            let last_token = match t with Parser.COMMENT _ -> Some t | _ -> state.State.last_token in
             let post = 
               { post with 
                 State.last_token = last_token; 

misc.ml

-(***********************************************************************)
-(*                                                                     *)
-(*                           Objective Caml                            *)
-(*                                                                     *)
-(*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         *)
-(*                                                                     *)
-(*  Copyright 1996 Institut National de Recherche en Informatique et   *)
-(*  en Automatique.  All rights reserved.  This file is distributed    *)
-(*  under the terms of the Q Public License version 1.0.               *)
-(*                                                                     *)
-(***********************************************************************)
-
-(* $Id: misc.ml 7909 2007-02-23 13:44:51Z ertai $ *)
-
-(* Errors *)
-
-exception Fatal_error
-
-let fatal_error msg =
-  prerr_string ">> Fatal error: "; prerr_endline msg; raise Fatal_error
-
-(* Hashtable functions *)
-
-let create_hashtable size init =
-  let tbl = Hashtbl.create size in
-  List.iter (fun (key, data) -> Hashtbl.add tbl key data) init;
-  tbl

misc.mli

-(***********************************************************************)
-(*                                                                     *)
-(*                           Objective Caml                            *)
-(*                                                                     *)
-(*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         *)
-(*                                                                     *)
-(*  Copyright 1996 Institut National de Recherche en Informatique et   *)
-(*  en Automatique.  All rights reserved.  This file is distributed    *)
-(*  under the terms of the Q Public License version 1.0.               *)
-(*                                                                     *)
-(***********************************************************************)
-
-(* $Id: misc.mli 9547 2010-01-22 12:48:24Z doligez $ *)
-
-(* Miscellaneous useful types and functions *)
-
-val fatal_error: string -> 'a
-exception Fatal_error
-
-val create_hashtable: int -> ('a * 'b) list -> ('a, 'b) Hashtbl.t
-        (* Create a hashtable of the given size and fills it with the
-           given bindings. *)

parser.ml

-open Sexplib.Conv
-
-type token =
-  | AMPERAMPER
-  | AMPERSAND
-  | AND
-  | AS
-  | ASSERT
-  | BACKQUOTE
-  | BANG
-  | BAR
-  | BARBAR
-  | BARRBRACKET
-  | BEGIN
-  | CHAR of (char)
-  | CLASS
-  | COLON
-  | COLONCOLON
-  | COLONEQUAL
-  | COLONGREATER
-  | COMMA
-  | CONSTRAINT
-  | DO
-  | DONE
-  | DOT
-  | DOTDOT
-  | DOWNTO
-  | ELSE
-  | END
-  | EOF
-  | EQUAL
-  | EXCEPTION
-  | EXTERNAL
-  | FALSE
-  | FLOAT of (string)
-  | FOR
-  | FUN
-  | FUNCTION
-  | FUNCTOR
-  | GREATER
-  | GREATERRBRACE
-  | GREATERRBRACKET
-  | IF
-  | IN
-  | INCLUDE
-  | INFIXOP0 of (string)
-  | INFIXOP1 of (string)
-  | INFIXOP2 of (string)
-  | INFIXOP3 of (string)
-  | INFIXOP4 of (string)
-  | INHERIT
-  | INITIALIZER
-  | INT of (int)
-  | INT32 of (int32)
-  | INT64 of (int64)
-  | LABEL of (string)
-  | LAZY
-  | LBRACE
-  | LBRACELESS
-  | LBRACKET
-  | LBRACKETBAR
-  | LBRACKETLESS
-  | LBRACKETGREATER
-  | LESS
-  | LESSMINUS
-  | LET
-  | LIDENT of (string)
-  | LPAREN
-  | MATCH
-  | METHOD
-  | MINUS
-  | MINUSDOT
-  | MINUSGREATER
-  | MODULE
-  | MUTABLE
-  | NATIVEINT of (nativeint)
-  | NEW
-  | OBJECT
-  | OF
-  | OPEN
-  | OPTLABEL of (string)
-  | OR
-  | PLUS
-  | PLUSDOT
-  | PREFIXOP of (string)
-  | PRIVATE
-  | QUESTION
-  | QUESTIONQUESTION
-  | QUOTE
-  | RBRACE
-  | RBRACKET
-  | REC
-  | RPAREN
-  | SEMI
-  | SEMISEMI
-  | SHARP
-  | SIG
-  | STAR
-  | STRING of (string)
-  | STRUCT
-  | THEN
-  | TILDE
-  | TO
-  | TRUE
-  | TRY
-  | TYPE
-  | UIDENT of (string)
-  | UNDERSCORE
-  | VAL
-  | VIRTUAL
-  | WHEN
-  | WHILE
-  | WITH
-  | COMMENT
-
-with sexp

parser.mli

-type token =
-  | AMPERAMPER
-  | AMPERSAND
-  | AND
-  | AS
-  | ASSERT
-  | BACKQUOTE
-  | BANG
-  | BAR
-  | BARBAR
-  | BARRBRACKET
-  | BEGIN
-  | CHAR of (char)
-  | CLASS
-  | COLON
-  | COLONCOLON
-  | COLONEQUAL
-  | COLONGREATER
-  | COMMA
-  | CONSTRAINT
-  | DO
-  | DONE
-  | DOT
-  | DOTDOT
-  | DOWNTO
-  | ELSE
-  | END
-  | EOF
-  | EQUAL
-  | EXCEPTION
-  | EXTERNAL
-  | FALSE
-  | FLOAT of (string)
-  | FOR
-  | FUN
-  | FUNCTION
-  | FUNCTOR
-  | GREATER
-  | GREATERRBRACE
-  | GREATERRBRACKET
-  | IF
-  | IN
-  | INCLUDE
-  | INFIXOP0 of (string)
-  | INFIXOP1 of (string)
-  | INFIXOP2 of (string)
-  | INFIXOP3 of (string)
-  | INFIXOP4 of (string)
-  | INHERIT
-  | INITIALIZER
-  | INT of (int)
-  | INT32 of (int32)
-  | INT64 of (int64)
-  | LABEL of (string)
-  | LAZY
-  | LBRACE
-  | LBRACELESS
-  | LBRACKET
-  | LBRACKETBAR
-  | LBRACKETLESS
-  | LBRACKETGREATER
-  | LESS
-  | LESSMINUS
-  | LET
-  | LIDENT of (string)
-  | LPAREN
-  | MATCH
-  | METHOD
-  | MINUS
-  | MINUSDOT
-  | MINUSGREATER
-  | MODULE
-  | MUTABLE
-  | NATIVEINT of (nativeint)
-  | NEW
-  | OBJECT
-  | OF
-  | OPEN
-  | OPTLABEL of (string)
-  | OR
-  | PLUS
-  | PLUSDOT
-  | PREFIXOP of (string)
-  | PRIVATE
-  | QUESTION
-  | QUESTIONQUESTION
-  | QUOTE
-  | RBRACE
-  | RBRACKET
-  | REC
-  | RPAREN
-  | SEMI
-  | SEMISEMI
-  | SHARP
-  | SIG
-  | STAR
-  | STRING of (string)
-  | STRUCT
-  | THEN
-  | TILDE
-  | TO
-  | TRUE
-  | TRY
-  | TYPE
-  | UIDENT of (string)
-  | UNDERSCORE
-  | VAL
-  | VIRTUAL
-  | WHEN
-  | WHILE
-  | WITH
-  | COMMENT
-
-with sexp
 open Pos
 open Reader
+module Parser = Xparser
 open Parser
 
 type 'a desc = 
+open Sexplib.Conv
+
+module Location = struct
+  include Location
+  let sexp_of_t _t = Sexplib.Sexp.List []
+end
+
+type token = Parser.token =
+  | AMPERAMPER
+  | AMPERSAND
+  | AND
+  | AS
+  | ASSERT
+  | BACKQUOTE
+  | BANG
+  | BAR
+  | BARBAR
+  | BARRBRACKET
+  | BEGIN
+  | CHAR of (char)
+  | CLASS
+  | COLON
+  | COLONCOLON
+  | COLONEQUAL
+  | COLONGREATER
+  | COMMA
+  | CONSTRAINT
+  | DO
+  | DONE
+  | DOT
+  | DOTDOT
+  | DOWNTO
+  | ELSE
+  | END
+  | EOF
+  | EQUAL
+  | EXCEPTION
+  | EXTERNAL
+  | FALSE
+  | FLOAT of (string)
+  | FOR
+  | FUN
+  | FUNCTION
+  | FUNCTOR
+  | GREATER
+  | GREATERRBRACE
+  | GREATERRBRACKET
+  | IF
+  | IN
+  | INCLUDE
+  | INFIXOP0 of (string)
+  | INFIXOP1 of (string)
+  | INFIXOP2 of (string)
+  | INFIXOP3 of (string)
+  | INFIXOP4 of (string)
+  | INHERIT
+  | INITIALIZER
+  | INT of (int)
+  | INT32 of (int32)
+  | INT64 of (int64)
+  | LABEL of (string)
+  | LAZY
+  | LBRACE
+  | LBRACELESS
+  | LBRACKET
+  | LBRACKETBAR
+  | LBRACKETLESS
+  | LBRACKETGREATER
+  | LESS
+  | LESSMINUS
+  | LET
+  | LIDENT of (string)
+  | LPAREN
+  | MATCH
+  | METHOD
+  | MINUS
+  | MINUSDOT
+  | MINUSGREATER
+  | MODULE
+  | MUTABLE
+  | NATIVEINT of (nativeint)
+  | NEW
+  | OBJECT
+  | OF
+  | OPEN
+  | OPTLABEL of (string)
+  | OR
+  | PLUS
+  | PLUSDOT
+  | PREFIXOP of (string)
+  | PRIVATE
+  | QUESTION
+  | QUESTIONQUESTION
+  | QUOTE
+  | RBRACE
+  | RBRACKET
+  | REC
+  | RPAREN
+  | SEMI
+  | SEMISEMI
+  | SHARP
+  | SIG
+  | STAR
+  | STRING of (string)
+  | STRUCT
+  | THEN
+  | TILDE
+  | TO
+  | TRUE
+  | TRY
+  | TYPE
+  | UIDENT of (string)
+  | UNDERSCORE
+  | VAL
+  | VIRTUAL
+  | WHEN
+  | WHILE
+  | WITH
+  | COMMENT of (string * Location.t)
+
+with sexp_of
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.