let rec token lexbuf =
  lexbuf.Lexing.lex_mem <- Array.create 8 (-1) ;   __ocaml_lex_token_rec lexbuf 0
and __ocaml_lex_token_rec lexbuf __ocaml_lex_state =
  match Lexing.new_engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 935 "editor/ed_ocaml_lexer.mll"
      ( update_loc lexbuf None 1 false 0;
        (* increment only if this is not an empty line *)
        if (not !next_token_is_first) then
          if !next_line_is_more_indented > 0 &&
            (!cur_indent <= last_block_inner_indent ())
          then
            cur_indent := !cur_indent + !cst_indent.ind_newline
          else
            incr next_line_is_more_indented;
        if_first_token_on_line 0;
        next_token_is_first := true;
        token lexbuf
      )
# 1785 "editor/ed_ocaml_lexer.ml"

  | 1 ->
# 949 "editor/ed_ocaml_lexer.mll"
      ( token lexbuf )
# 1790 "editor/ed_ocaml_lexer.ml"

  | 2 ->
# 951 "editor/ed_ocaml_lexer.mll"
      ( if_first_token_on_line !cur_indent; token lexbuf )
# 1795 "editor/ed_ocaml_lexer.ml"

  | 3 ->
# 952 "editor/ed_ocaml_lexer.mll"
        ( if_first_token_on_line !cur_indent; token lexbuf )
# 1800 "editor/ed_ocaml_lexer.ml"

  | 4 ->
# 954 "editor/ed_ocaml_lexer.mll"
      ( if_first_token_on_line !cur_indent;
        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, curr_loc lexbuf));
        token lexbuf )
# 1810 "editor/ed_ocaml_lexer.ml"

  | 5 ->
# 960 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent; token lexbuf )
# 1815 "editor/ed_ocaml_lexer.ml"

  | 6 ->
# 961 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent; token lexbuf )
# 1820 "editor/ed_ocaml_lexer.ml"

  | 7 ->
# 963 "editor/ed_ocaml_lexer.mll"
      (
        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, curr_loc lexbuf));
        if_first_token_on_line !cur_indent;
        token lexbuf )
# 1831 "editor/ed_ocaml_lexer.ml"

  | 8 ->
# 971 "editor/ed_ocaml_lexer.mll"
      (
        let s = Lexing.lexeme lexbuf in
        try
          let kw = Hashtbl.find keyword_table s in
          on_keyword lexbuf kw;
          token lexbuf
        with Not_found ->
          if_first_token_on_line !cur_indent;
          token lexbuf
      )
# 1845 "editor/ed_ocaml_lexer.ml"

  | 9 ->
# 982 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        token lexbuf)
# 1852 "editor/ed_ocaml_lexer.ml"

  | 10 ->
# 986 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        token lexbuf
      )
# 1860 "editor/ed_ocaml_lexer.ml"

  | 11 ->
# 991 "editor/ed_ocaml_lexer.mll"
      ( if_first_token_on_line !cur_indent;
        token lexbuf
      )
# 1867 "editor/ed_ocaml_lexer.ml"

  | 12 ->
# 995 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        token lexbuf
      )
# 1875 "editor/ed_ocaml_lexer.ml"

  | 13 ->
# 1000 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        token lexbuf
      )
# 1883 "editor/ed_ocaml_lexer.ml"

  | 14 ->
# 1005 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        token lexbuf
      )
# 1891 "editor/ed_ocaml_lexer.ml"

  | 15 ->
# 1010 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        string lexbuf;
        token lexbuf
      )
# 1900 "editor/ed_ocaml_lexer.ml"

  | 16 ->
# 1016 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        next_token_is_first := true;
        if_first_token_on_line 0;
        update_loc lexbuf None 1 false 1;
        token lexbuf
      )
# 1911 "editor/ed_ocaml_lexer.ml"

  | 17 ->
# 1024 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        token lexbuf
      )
# 1919 "editor/ed_ocaml_lexer.ml"

  | 18 ->
# 1029 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        token lexbuf
      )
# 1927 "editor/ed_ocaml_lexer.ml"

  | 19 ->
# 1034 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        token lexbuf
      )
# 1935 "editor/ed_ocaml_lexer.ml"

  | 20 ->
# 1039 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        token lexbuf
      )
# 1943 "editor/ed_ocaml_lexer.ml"

  | 21 ->
# 1044 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        let l = Lexing.lexeme lexbuf in
        let esc = String.sub l 1 (String.length l - 1) in
        raise (Error(Illegal_escape esc, curr_loc lexbuf))
      )
# 1953 "editor/ed_ocaml_lexer.ml"

  | 22 ->
# 1051 "editor/ed_ocaml_lexer.mll"
      (
        begin_comment_indentation := (!cur_indent, !next_line_is_more_indented);
        if_first_token_on_line !cur_indent;
        comment lexbuf;
        token lexbuf )
# 1962 "editor/ed_ocaml_lexer.ml"

  | 23 ->
# 1057 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        comment lexbuf;
        token lexbuf
      )
# 1971 "editor/ed_ocaml_lexer.ml"

  | 24 ->
# 1063 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        let curpos = lexbuf.lex_curr_p in
        lexbuf.lex_curr_p <- { curpos with pos_cnum = curpos.pos_cnum - 1 };
        token lexbuf
      )
# 1981 "editor/ed_ocaml_lexer.ml"

  | 25 ->
let
# 1069 "editor/ed_ocaml_lexer.mll"
                                   num
# 1987 "editor/ed_ocaml_lexer.ml"
Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_mem.(0) lexbuf.Lexing.lex_mem.(1)
and
# 1070 "editor/ed_ocaml_lexer.mll"
                                           name
# 1992 "editor/ed_ocaml_lexer.ml"
Lexing.sub_lexeme_opt lexbuf lexbuf.Lexing.lex_mem.(3) lexbuf.Lexing.lex_mem.(2) in
# 1072 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line 0;
        update_loc lexbuf name (int_of_string num) true 0;
        token lexbuf
      )
# 2000 "editor/ed_ocaml_lexer.ml"

  | 26 ->
# 1077 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent; token lexbuf )
# 2005 "editor/ed_ocaml_lexer.ml"

  | 27 ->
# 1078 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent; token lexbuf )
# 2010 "editor/ed_ocaml_lexer.ml"

  | 28 ->
# 1079 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent; token lexbuf )
# 2015 "editor/ed_ocaml_lexer.ml"

  | 29 ->
# 1080 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent; token lexbuf )
# 2020 "editor/ed_ocaml_lexer.ml"

  | 30 ->
# 1081 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent; token lexbuf )
# 2025 "editor/ed_ocaml_lexer.ml"

  | 31 ->
# 1082 "editor/ed_ocaml_lexer.mll"
         (
           on_par_open LPAREN lexbuf;
           token lexbuf
         )
# 2033 "editor/ed_ocaml_lexer.ml"

  | 32 ->
# 1086 "editor/ed_ocaml_lexer.mll"
         (
           on_par_close lexbuf RPAREN ")";
           token lexbuf )
# 2040 "editor/ed_ocaml_lexer.ml"

  | 33 ->
# 1089 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2046 "editor/ed_ocaml_lexer.ml"

  | 34 ->
# 1091 "editor/ed_ocaml_lexer.mll"
         ( on_keyword lexbuf COMMA;
           token lexbuf )
# 2052 "editor/ed_ocaml_lexer.ml"

  | 35 ->
# 1093 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           on_keyword lexbuf MINUSGREATER;
           token lexbuf )
# 2059 "editor/ed_ocaml_lexer.ml"

  | 36 ->
# 1096 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2065 "editor/ed_ocaml_lexer.ml"

  | 37 ->
# 1098 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2071 "editor/ed_ocaml_lexer.ml"

  | 38 ->
# 1100 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2077 "editor/ed_ocaml_lexer.ml"

  | 39 ->
# 1102 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2083 "editor/ed_ocaml_lexer.ml"

  | 40 ->
# 1104 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2089 "editor/ed_ocaml_lexer.ml"

  | 41 ->
# 1106 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2095 "editor/ed_ocaml_lexer.ml"

  | 42 ->
# 1108 "editor/ed_ocaml_lexer.mll"
         ( on_keyword lexbuf SEMI;
           token lexbuf )
# 2101 "editor/ed_ocaml_lexer.ml"

  | 43 ->
# 1110 "editor/ed_ocaml_lexer.mll"
         (
           set_indent 0;
           if_first_token_on_line !cur_indent;
           token lexbuf )
# 2109 "editor/ed_ocaml_lexer.ml"

  | 44 ->
# 1114 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2115 "editor/ed_ocaml_lexer.ml"

  | 45 ->
# 1116 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2121 "editor/ed_ocaml_lexer.ml"

  | 46 ->
# 1118 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2127 "editor/ed_ocaml_lexer.ml"

  | 47 ->
# 1120 "editor/ed_ocaml_lexer.mll"
         ( on_par_open LBRACKET lexbuf;
           token lexbuf )
# 2133 "editor/ed_ocaml_lexer.ml"

  | 48 ->
# 1122 "editor/ed_ocaml_lexer.mll"
         ( on_par_open LBRACKETBAR lexbuf ;
           token lexbuf )
# 2139 "editor/ed_ocaml_lexer.ml"

  | 49 ->
# 1124 "editor/ed_ocaml_lexer.mll"
         ( on_par_open LBRACKETLESS lexbuf ;
           token lexbuf )
# 2145 "editor/ed_ocaml_lexer.ml"

  | 50 ->
# 1126 "editor/ed_ocaml_lexer.mll"
         ( on_par_open LBRACKETGREATER lexbuf;
           token lexbuf )
# 2151 "editor/ed_ocaml_lexer.ml"

  | 51 ->
# 1128 "editor/ed_ocaml_lexer.mll"
         ( on_par_close lexbuf RBRACKET "]";
           token lexbuf )
# 2157 "editor/ed_ocaml_lexer.ml"

  | 52 ->
# 1130 "editor/ed_ocaml_lexer.mll"
         ( on_par_open LBRACE lexbuf ;
           token lexbuf )
# 2163 "editor/ed_ocaml_lexer.ml"

  | 53 ->
# 1132 "editor/ed_ocaml_lexer.mll"
         ( on_par_open LBRACELESS lexbuf ;
           token lexbuf )
# 2169 "editor/ed_ocaml_lexer.ml"

  | 54 ->
# 1134 "editor/ed_ocaml_lexer.mll"
         (
           on_keyword lexbuf BAR;
           token lexbuf )
# 2176 "editor/ed_ocaml_lexer.ml"

  | 55 ->
# 1137 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2182 "editor/ed_ocaml_lexer.ml"

  | 56 ->
# 1139 "editor/ed_ocaml_lexer.mll"
         ( on_par_close lexbuf BARRBRACKET "|]";
           token lexbuf )
# 2188 "editor/ed_ocaml_lexer.ml"

  | 57 ->
# 1141 "editor/ed_ocaml_lexer.mll"
         ( token lexbuf )
# 2193 "editor/ed_ocaml_lexer.ml"

  | 58 ->
# 1142 "editor/ed_ocaml_lexer.mll"
         ( on_par_close lexbuf GREATERRBRACKET ">]";
           token lexbuf )
# 2199 "editor/ed_ocaml_lexer.ml"

  | 59 ->
# 1144 "editor/ed_ocaml_lexer.mll"
         ( on_par_close lexbuf RBRACE "}";
           token lexbuf )
# 2205 "editor/ed_ocaml_lexer.ml"

  | 60 ->
# 1146 "editor/ed_ocaml_lexer.mll"
         ( on_par_close lexbuf GREATERRBRACE ">}";
           token lexbuf )
# 2211 "editor/ed_ocaml_lexer.ml"

  | 61 ->
# 1148 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2217 "editor/ed_ocaml_lexer.ml"

  | 62 ->
# 1150 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2223 "editor/ed_ocaml_lexer.ml"

  | 63 ->
# 1152 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2229 "editor/ed_ocaml_lexer.ml"

  | 64 ->
# 1154 "editor/ed_ocaml_lexer.mll"
         ( if_first_token_on_line !cur_indent;
           token lexbuf )
# 2235 "editor/ed_ocaml_lexer.ml"

  | 65 ->
# 1158 "editor/ed_ocaml_lexer.mll"
            ( if_first_token_on_line !cur_indent;
              token lexbuf )
# 2241 "editor/ed_ocaml_lexer.ml"

  | 66 ->
# 1161 "editor/ed_ocaml_lexer.mll"
            ( if_first_token_on_line !cur_indent;
              token lexbuf )
# 2247 "editor/ed_ocaml_lexer.ml"

  | 67 ->
# 1164 "editor/ed_ocaml_lexer.mll"
            ( if_first_token_on_line !cur_indent;
              token lexbuf )
# 2253 "editor/ed_ocaml_lexer.ml"

  | 68 ->
# 1167 "editor/ed_ocaml_lexer.mll"
            ( if_first_token_on_line !cur_indent;
              token lexbuf )
# 2259 "editor/ed_ocaml_lexer.ml"

  | 69 ->
# 1170 "editor/ed_ocaml_lexer.mll"
            ( if_first_token_on_line !cur_indent;
              token lexbuf )
# 2265 "editor/ed_ocaml_lexer.ml"

  | 70 ->
# 1173 "editor/ed_ocaml_lexer.mll"
            ( if_first_token_on_line !cur_indent;
              token lexbuf )
# 2271 "editor/ed_ocaml_lexer.ml"

  | 71 ->
# 1176 "editor/ed_ocaml_lexer.mll"
            ( if_first_token_on_line !cur_indent;
              token lexbuf )
# 2277 "editor/ed_ocaml_lexer.ml"

  | 72 ->
# 1178 "editor/ed_ocaml_lexer.mll"
        ( EOF )
# 2282 "editor/ed_ocaml_lexer.ml"

  | 73 ->
# 1180 "editor/ed_ocaml_lexer.mll"
      ( raise (Error(Illegal_character (Lexing.lexeme_char lexbuf 0),
                     curr_loc lexbuf))
      )
# 2289 "editor/ed_ocaml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_token_rec lexbuf __ocaml_lex_state

and comment lexbuf =
    __ocaml_lex_comment_rec lexbuf 109
and __ocaml_lex_comment_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 1186 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line !cur_indent;
        let indent, next_indented = !begin_comment_indentation in
        cur_indent := indent;
        next_line_is_more_indented := next_indented - 1
          (* usually, non-debug comments end a line *)
      )
# 2306 "editor/ed_ocaml_lexer.ml"

  | 1 ->
# 1194 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line 0;
        next_token_is_first := true;
        update_loc lexbuf None 1 false 1;
        comment lexbuf
      )
# 2316 "editor/ed_ocaml_lexer.ml"

  | 2 ->
# 1201 "editor/ed_ocaml_lexer.mll"
      ( raise (Error (Unterminated_comment, curr_loc lexbuf)) )
# 2321 "editor/ed_ocaml_lexer.ml"

  | 3 ->
# 1203 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line (!cur_indent + !cst_indent.ind_comment);
        comment lexbuf )
# 2328 "editor/ed_ocaml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_comment_rec lexbuf __ocaml_lex_state

and string lexbuf =
    __ocaml_lex_string_rec lexbuf 115
and __ocaml_lex_string_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 1209 "editor/ed_ocaml_lexer.mll"
      ( if_first_token_on_line_set_none () ;
        string lexbuf
      )
# 2341 "editor/ed_ocaml_lexer.ml"

  | 1 ->
# 1213 "editor/ed_ocaml_lexer.mll"
      ( if_first_token_on_line_set_none () )
# 2346 "editor/ed_ocaml_lexer.ml"

  | 2 ->
# 1215 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line_set_none () ;
        next_token_is_first := true;
        update_loc lexbuf None 1 false 1;
        string lexbuf
      )
# 2356 "editor/ed_ocaml_lexer.ml"

  | 3 ->
# 1222 "editor/ed_ocaml_lexer.mll"
      ( raise (Error (Unterminated_string, curr_loc lexbuf)) )
# 2361 "editor/ed_ocaml_lexer.ml"

  | 4 ->
# 1224 "editor/ed_ocaml_lexer.mll"
      (
        if_first_token_on_line_set_none ();
        string lexbuf )
# 2368 "editor/ed_ocaml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_string_rec lexbuf __ocaml_lex_state

and skip_sharp_bang lexbuf =
    __ocaml_lex_skip_sharp_bang_rec lexbuf 118
and __ocaml_lex_skip_sharp_bang_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 1230 "editor/ed_ocaml_lexer.mll"
       ( update_loc lexbuf None 3 false 0 )
# 2379 "editor/ed_ocaml_lexer.ml"

  | 1 ->
# 1232 "editor/ed_ocaml_lexer.mll"
       ( update_loc lexbuf None 1 false 0 )
# 2384 "editor/ed_ocaml_lexer.ml"

  | 2 ->
# 1233 "editor/ed_ocaml_lexer.mll"
       ( () )
# 2389 "editor/ed_ocaml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_skip_sharp_bang_rec lexbuf __ocaml_lex_state