# 1 "lispin.mll" (* * Copyright (c) 2002 by Laboratoire Spécification et Vérification (LSV), * CNRS UMR 8643 & ENS Cachan. * Written by Jean Goubault-Larrecq. Not derived from licensed software. * * Permission is granted to anyone to use this software for any * purpose on any computer system, and to redistribute it freely, * subject to the following restrictions: * * 1. Neither the author nor its employer is responsible for the consequences of use of * this software, no matter how awful, even if they arise * from defects in it. * * 2. The origin of this software must not be misrepresented, either * by explicit claim or by omission. * * 3. Altered versions must be plainly marked as such, and must not * be misrepresented as being the original software. * * 4. This software is restricted to non-commercial use only. Commercial * use is subject to a specific license, obtainable from LSV. * This was developed as part of the EVA project; as such, access * to this software by partners of the RNTL EVA Project (Trusted * Logic S.A., Verimag) is defined by the intellectual property * agreement signed as part of this project. *) open Lisptoken let read_octal s i = let n = String.length s in let ir = ref i in let acc = ref 0 in (while !ir ( # 49 "lispin.mll" lisptoken lexbuf ) | 1 -> ( # 50 "lispin.mll" LISP_LPAREN ) | 2 -> ( # 51 "lispin.mll" LISP_RPAREN ) | 3 -> ( # 52 "lispin.mll" LISP_INT (int_of_string (Lexing.lexeme lexbuf)) ) | 4 -> ( # 53 "lispin.mll" LISP_ID (Lexing.lexeme lexbuf) ) | 5 -> ( # 55 "lispin.mll" Buffer.reset string_buf; string lexbuf; LISP_STRING (Buffer.contents string_buf) ) | 6 -> ( # 59 "lispin.mll" raise LispEof ) | 7 -> ( # 60 "lispin.mll" raise (LispInvalidChar (Lexing.lexeme lexbuf)) ) | n -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_lisptoken_rec lexbuf n and string lexbuf = __ocaml_lex_string_rec lexbuf 1 and __ocaml_lex_string_rec lexbuf state = match Lexing.engine lex_tables state lexbuf with 0 -> ( # 62 "lispin.mll" () ) | 1 -> ( # 63 "lispin.mll" string lexbuf ) | 2 -> ( # 64 "lispin.mll" Buffer.add_char string_buf (Char.chr (read_octal (Lexing.lexeme lexbuf) 1)) ) | 3 -> ( # 65 "lispin.mll" raise (LispBadEscape (Lexing.lexeme lexbuf)) ) | 4 -> ( # 66 "lispin.mll" Buffer.add_char string_buf '\n'; string lexbuf ) | 5 -> ( # 67 "lispin.mll" Buffer.add_char string_buf '\t'; string lexbuf ) | 6 -> ( # 68 "lispin.mll" Buffer.add_char string_buf '\r'; string lexbuf ) | 7 -> ( # 69 "lispin.mll" Buffer.add_char string_buf '\b'; string lexbuf ) | 8 -> ( # 70 "lispin.mll" Buffer.add_char string_buf '\014'; string lexbuf ) | 9 -> ( # 71 "lispin.mll" Buffer.add_char string_buf (Lexing.lexeme_char lexbuf 1); string lexbuf ) | 10 -> ( # 72 "lispin.mll" Buffer.add_string string_buf (Lexing.lexeme lexbuf); string lexbuf ) | 11 -> ( # 73 "lispin.mll" Buffer.add_char string_buf (Lexing.lexeme_char lexbuf 0); string lexbuf ) | 12 -> ( # 74 "lispin.mll" raise LispEofInString ) | n -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_string_rec lexbuf n ;;