let rec main buf lexbuf =
    __ocaml_lex_main_rec buf lexbuf 0
and __ocaml_lex_main_rec buf lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 75 "lib/lexer.mll"
            ( found_newline lexbuf 1; main buf lexbuf )
# 204 "lib/lexer.ml"

  | 1 ->
# 76 "lib/lexer.mll"
                                ( main buf lexbuf )
# 209 "lib/lexer.ml"

  | 2 ->
# 77 "lib/lexer.mll"
        ( LPAREN )
# 214 "lib/lexer.ml"

  | 3 ->
# 78 "lib/lexer.mll"
        ( RPAREN )
# 219 "lib/lexer.ml"

  | 4 ->
# 80 "lib/lexer.mll"
      (
        scan_string buf lexbuf;
        let str = Buffer.contents buf in
        Buffer.clear buf;
        STRING str
      )
# 229 "lib/lexer.ml"

  | 5 ->
let
# 86 "lib/lexer.mll"
                                           str
# 235 "lib/lexer.ml"
Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 86 "lib/lexer.mll"
                                               ( STRING str )
# 239 "lib/lexer.ml"

  | 6 ->
# 87 "lib/lexer.mll"
        ( EOF )
# 244 "lib/lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_main_rec buf lexbuf __ocaml_lex_state

and scan_string buf lexbuf =
    __ocaml_lex_scan_string_rec buf lexbuf 10
and __ocaml_lex_scan_string_rec buf lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 90 "lib/lexer.mll"
        ( () )
# 255 "lib/lexer.ml"

  | 1 ->
# 92 "lib/lexer.mll"
      (
        let len = get_lexeme_len lexbuf in
        found_newline lexbuf (len - 2);
        scan_string buf lexbuf
      )
# 264 "lib/lexer.ml"

  | 2 ->
# 98 "lib/lexer.mll"
      (
        let len = get_lexeme_len lexbuf in
        found_newline lexbuf (len - 3);
        scan_string buf lexbuf
      )
# 273 "lib/lexer.ml"

  | 3 ->
let
# 103 "lib/lexer.mll"
                               c
# 279 "lib/lexer.ml"
Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 1) in
# 104 "lib/lexer.mll"
      (
        Buffer.add_char buf (char_for_backslash c);
        scan_string buf lexbuf
      )
# 286 "lib/lexer.ml"

  | 4 ->
let
# 108 "lib/lexer.mll"
                       c1
# 292 "lib/lexer.ml"
Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 1)
and
# 108 "lib/lexer.mll"
                                         c2
# 297 "lib/lexer.ml"
Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 2)
and
# 108 "lib/lexer.mll"
                                                            c3
# 302 "lib/lexer.ml"
Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 3) in
# 109 "lib/lexer.mll"
      (
        let v = dec_code c1 c2 c3 in
        if v > 255 then (
          let pos = lexbuf.lex_curr_p in
          let msg =
            sprintf
              "Sexplib.Lexer.scan_string: illegal escape at line %d char %d: `\\%c%c%c'"
              pos.pos_lnum (pos.pos_cnum - pos.pos_bol - 3)
              c1 c2 c3 in
          failwith msg);
        Buffer.add_char buf (Char.chr v);
        scan_string buf lexbuf
      )
# 319 "lib/lexer.ml"

  | 5 ->
let
# 123 "lib/lexer.mll"
                                           c1
# 325 "lib/lexer.ml"
Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 2)
and
# 123 "lib/lexer.mll"
                                                                             c2
# 330 "lib/lexer.ml"
Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 3) in
# 124 "lib/lexer.mll"
      (
        let v = hex_code c1 c2 in
        if v > 255 then (
          let pos = lexbuf.lex_curr_p in
          let msg =
            sprintf
              "Sexplib.Lexer.scan_string: illegal escape at line %d char %d: `\\x%c%c'"
              pos.pos_lnum (pos.pos_cnum - pos.pos_bol - 3)
              c1 c2 in
          failwith msg);
        Buffer.add_char buf (Char.chr v);
        scan_string buf lexbuf
      )
# 347 "lib/lexer.ml"

  | 6 ->
let
# 138 "lib/lexer.mll"
               c
# 353 "lib/lexer.ml"
Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 1) in
# 139 "lib/lexer.mll"
      (
        Buffer.add_char buf '\\';
        Buffer.add_char buf c;
        scan_string buf lexbuf
      )
# 361 "lib/lexer.ml"

  | 7 ->
let
# 144 "lib/lexer.mll"
                       c
# 367 "lib/lexer.ml"
Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
# 145 "lib/lexer.mll"
      (
        found_newline lexbuf 1;
        Buffer.add_char buf c;
        scan_string buf lexbuf
      )
# 375 "lib/lexer.ml"

  | 8 ->
# 151 "lib/lexer.mll"
      (
        found_newline lexbuf 2;
        Buffer.add_string buf double_nl;
        scan_string buf lexbuf
      )
# 384 "lib/lexer.ml"

  | 9 ->
# 157 "lib/lexer.mll"
      (
        let ofs = lexbuf.lex_start_pos in
        let len = lexbuf.lex_curr_pos - ofs in
        Buffer.add_substring buf lexbuf.lex_buffer ofs len;
        scan_string buf lexbuf
      )
# 394 "lib/lexer.ml"

  | 10 ->
# 163 "lib/lexer.mll"
        ( failwith "Sexplib.Lexer.scan_string: unterminated string" )
# 399 "lib/lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_scan_string_rec buf lexbuf __ocaml_lex_state