type token = | Tident of (string * Lex_syntax.location) | Tchar of (int) | Tstring of (string) | Taction of (Lex_syntax.location) | Trule | Tparse | Tand | Tequal | Tend | Tor | Tunderscore | Teof | Tlbracket | Trbracket | Tstar | Tmaybe | Tplus | Tlparen | Trparen | Tcaret | Tdash | Tlet open Parsing;; # 18 "ocamllex-parser/lex_parser.mly" open Lex_syntax (* Auxiliaries for the parser. *) let named_regexps = (Hashtbl.create 13 : (string, regular_expression) Hashtbl.t) let regexp_for_string s = let rec re_string n = if n >= String.length s then Epsilon else if succ n = String.length s then Characters([Char.code (s.[n])]) else Sequence(Characters([Char.code (s.[n])]), re_string (succ n)) in re_string 0 let char_class c1 c2 = let rec cl n = if n > c2 then [] else n :: cl(succ n) in cl c1 let all_chars = char_class 0 255 let rec subtract l1 l2 = match l1 with [] -> [] | a::r -> if List.mem a l2 then subtract r l2 else a :: subtract r l2 # 55 "ocamllex-parser/lex_parser.ml" let yytransl_const = [| 261 (* Trule *); 262 (* Tparse *); 263 (* Tand *); 264 (* Tequal *); 265 (* Tend *); 266 (* Tor *); 267 (* Tunderscore *); 268 (* Teof *); 269 (* Tlbracket *); 270 (* Trbracket *); 271 (* Tstar *); 272 (* Tmaybe *); 273 (* Tplus *); 274 (* Tlparen *); 275 (* Trparen *); 276 (* Tcaret *); 277 (* Tdash *); 278 (* Tlet *); 0|] let yytransl_block = [| 257 (* Tident *); 258 (* Tchar *); 259 (* Tstring *); 260 (* Taction *); 0|] let yylhs = "\255\255\ \001\000\002\000\002\000\003\000\003\000\005\000\005\000\004\000\ \007\000\007\000\009\000\009\000\008\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\010\000\010\000\011\000\011\000\011\000\000\000" let yylen = "\002\000\ \007\000\001\000\000\000\005\000\000\000\003\000\000\000\003\000\ \003\000\002\000\003\000\000\000\002\000\001\000\001\000\001\000\ \001\000\003\000\002\000\002\000\002\000\003\000\002\000\003\000\ \001\000\002\000\001\000\003\000\001\000\002\000\002\000" let yydefred = "\000\000\ \000\000\000\000\002\000\031\000\005\000\000\000\000\000\000\000\ \000\000\007\000\000\000\000\000\000\000\000\000\000\000\008\000\ \000\000\000\000\025\000\016\000\017\000\014\000\015\000\000\000\ \000\000\000\000\000\000\012\000\000\000\006\000\001\000\000\000\ \000\000\000\000\000\000\000\000\000\000\019\000\020\000\021\000\ \000\000\013\000\000\000\000\000\000\000\000\000\018\000\000\000\ \024\000\000\000\011\000\028\000" let yydgoto = "\002\000\ \004\000\005\000\006\000\010\000\013\000\041\000\016\000\028\000\ \029\000\034\000\048\000" let yysindex = "\001\000\ \005\255\000\000\000\000\000\000\000\000\017\255\007\255\009\255\ \024\255\000\000\028\255\031\255\046\255\099\255\099\255\000\000\ \007\255\035\255\000\000\000\000\000\000\000\000\000\000\004\255\ \099\255\063\255\045\255\000\000\044\255\000\000\000\000\038\255\ \036\255\053\255\036\255\002\255\099\255\000\000\000\000\000\000\ \081\255\000\000\044\255\099\255\066\255\036\255\000\000\036\255\ \000\000\081\255\000\000\000\000" let yyrindex = "\000\000\ \029\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\060\255\000\000\109\255\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\030\255\000\000\000\000\082\255\000\000\000\000\027\255\ \000\000\000\000\056\255\000\000\000\000\000\000\000\000\000\000\ \021\255\000\000\100\255\000\000\000\000\057\255\000\000\058\255\ \000\000\023\255\000\000\000\000" let yygindex = "\000\000\ \000\000\064\000\000\000\068\000\000\000\242\255\000\000\043\000\ \060\000\000\000\239\255" let yytablesize = 119 let yytable = "\026\000\ \027\000\001\000\019\000\020\000\021\000\032\000\035\000\009\000\ \003\000\011\000\036\000\037\000\022\000\023\000\024\000\046\000\ \038\000\039\000\040\000\025\000\049\000\007\000\050\000\033\000\ \023\000\023\000\022\000\022\000\029\000\027\000\023\000\012\000\ \022\000\003\000\004\000\014\000\015\000\032\000\008\000\023\000\ \029\000\022\000\023\000\031\000\022\000\019\000\020\000\021\000\ \042\000\003\000\003\000\004\000\017\000\044\000\037\000\022\000\ \023\000\024\000\045\000\038\000\039\000\040\000\025\000\019\000\ \020\000\021\000\047\000\052\000\003\000\027\000\026\000\030\000\ \037\000\022\000\023\000\024\000\018\000\038\000\039\000\040\000\ \025\000\019\000\020\000\021\000\030\000\010\000\051\000\043\000\ \010\000\000\000\010\000\022\000\023\000\024\000\000\000\038\000\ \039\000\040\000\025\000\019\000\020\000\021\000\000\000\009\000\ \000\000\000\000\009\000\000\000\009\000\022\000\023\000\024\000\ \012\000\000\000\000\000\012\000\025\000\012\000\012\000" let yycheck = "\014\000\ \015\000\001\000\001\001\002\001\003\001\002\001\024\000\001\001\ \004\001\001\001\025\000\010\001\011\001\012\001\013\001\033\000\ \015\001\016\001\017\001\018\001\019\001\005\001\037\000\020\001\ \004\001\005\001\004\001\005\001\002\001\044\000\010\001\008\001\ \010\001\005\001\005\001\008\001\006\001\002\001\022\001\019\001\ \014\001\019\001\022\001\009\001\022\001\001\001\002\001\003\001\ \004\001\004\001\022\001\022\001\007\001\010\001\010\001\011\001\ \012\001\013\001\021\001\015\001\016\001\017\001\018\001\001\001\ \002\001\003\001\014\001\002\001\009\001\014\001\014\001\014\001\ \010\001\011\001\012\001\013\001\013\000\015\001\016\001\017\001\ \018\001\001\001\002\001\003\001\017\000\004\001\044\000\028\000\ \007\001\255\255\009\001\011\001\012\001\013\001\255\255\015\001\ \016\001\017\001\018\001\001\001\002\001\003\001\255\255\004\001\ \255\255\255\255\007\001\255\255\009\001\011\001\012\001\013\001\ \004\001\255\255\255\255\007\001\018\001\009\001\010\001" let yynames_const = "\ Trule\000\ Tparse\000\ Tand\000\ Tequal\000\ Tend\000\ Tor\000\ Tunderscore\000\ Teof\000\ Tlbracket\000\ Trbracket\000\ Tstar\000\ Tmaybe\000\ Tplus\000\ Tlparen\000\ Trparen\000\ Tcaret\000\ Tdash\000\ Tlet\000\ " let yynames_block = "\ Tident\000\ Tchar\000\ Tstring\000\ Taction\000\ " let yyact = [| (fun _ -> failwith "parser") ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 6 : 'header) in let _2 = (Parsing.peek_val __caml_parser_env 5 : 'named_regexps) in let _4 = (Parsing.peek_val __caml_parser_env 3 : 'definition) in let _5 = (Parsing.peek_val __caml_parser_env 2 : 'other_definitions) in let _6 = (Parsing.peek_val __caml_parser_env 1 : 'header) in Obj.repr( # 67 "ocamllex-parser/lex_parser.mly" ( {header = _1; named_regexps = List.rev _2; entrypoints = _4 :: List.rev _5; trailer = _6} ) # 208 "ocamllex-parser/lex_parser.ml" : Lex_syntax.lexer_definition)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : Lex_syntax.location) in Obj.repr( # 74 "ocamllex-parser/lex_parser.mly" ( _1 ) # 215 "ocamllex-parser/lex_parser.ml" : 'header)) ; (fun __caml_parser_env -> Obj.repr( # 76 "ocamllex-parser/lex_parser.mly" ( { start_pos = 0; end_pos = 0; start_line = 1; start_col = 0 } ) # 221 "ocamllex-parser/lex_parser.ml" : 'header)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 4 : 'named_regexps) in let _3 = (Parsing.peek_val __caml_parser_env 2 : string * Lex_syntax.location) in let _5 = (Parsing.peek_val __caml_parser_env 0 : 'regexp) in Obj.repr( # 80 "ocamllex-parser/lex_parser.mly" ( let (s,l) = _3 in (s,l,_5)::_1 ) # 230 "ocamllex-parser/lex_parser.ml" : 'named_regexps)) ; (fun __caml_parser_env -> Obj.repr( # 82 "ocamllex-parser/lex_parser.mly" ( [] ) # 236 "ocamllex-parser/lex_parser.ml" : 'named_regexps)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'other_definitions) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'definition) in Obj.repr( # 86 "ocamllex-parser/lex_parser.mly" ( _3::_1 ) # 244 "ocamllex-parser/lex_parser.ml" : 'other_definitions)) ; (fun __caml_parser_env -> Obj.repr( # 88 "ocamllex-parser/lex_parser.mly" ( [] ) # 250 "ocamllex-parser/lex_parser.ml" : 'other_definitions)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : string * Lex_syntax.location) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'entry) in Obj.repr( # 92 "ocamllex-parser/lex_parser.mly" ( let(s,l)=_1 in (s,l,_3) ) # 258 "ocamllex-parser/lex_parser.ml" : 'definition)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 1 : 'case) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'rest_of_entry) in Obj.repr( # 96 "ocamllex-parser/lex_parser.mly" ( _2::List.rev _3 ) # 266 "ocamllex-parser/lex_parser.ml" : 'entry)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 0 : 'rest_of_entry) in Obj.repr( # 98 "ocamllex-parser/lex_parser.mly" ( List.rev _2 ) # 273 "ocamllex-parser/lex_parser.ml" : 'entry)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'rest_of_entry) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'case) in Obj.repr( # 102 "ocamllex-parser/lex_parser.mly" ( _3::_1 ) # 281 "ocamllex-parser/lex_parser.ml" : 'rest_of_entry)) ; (fun __caml_parser_env -> Obj.repr( # 104 "ocamllex-parser/lex_parser.mly" ( [] ) # 287 "ocamllex-parser/lex_parser.ml" : 'rest_of_entry)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : 'regexp) in let _2 = (Parsing.peek_val __caml_parser_env 0 : Lex_syntax.location) in Obj.repr( # 108 "ocamllex-parser/lex_parser.mly" ( (_1,_2) ) # 295 "ocamllex-parser/lex_parser.ml" : 'case)) ; (fun __caml_parser_env -> Obj.repr( # 112 "ocamllex-parser/lex_parser.mly" ( Characters all_chars ) # 301 "ocamllex-parser/lex_parser.ml" : 'regexp)) ; (fun __caml_parser_env -> Obj.repr( # 114 "ocamllex-parser/lex_parser.mly" ( Characters [256] ) # 307 "ocamllex-parser/lex_parser.ml" : 'regexp)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : int) in Obj.repr( # 116 "ocamllex-parser/lex_parser.mly" ( Characters [_1] ) # 314 "ocamllex-parser/lex_parser.ml" : 'regexp)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 118 "ocamllex-parser/lex_parser.mly" ( regexp_for_string _1 ) # 321 "ocamllex-parser/lex_parser.ml" : 'regexp)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 1 : 'char_class) in Obj.repr( # 120 "ocamllex-parser/lex_parser.mly" ( Characters _2 ) # 328 "ocamllex-parser/lex_parser.ml" : 'regexp)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : 'regexp) in Obj.repr( # 122 "ocamllex-parser/lex_parser.mly" ( Repetition _1 ) # 335 "ocamllex-parser/lex_parser.ml" : 'regexp)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : 'regexp) in Obj.repr( # 124 "ocamllex-parser/lex_parser.mly" ( Alternative(_1, Epsilon) ) # 342 "ocamllex-parser/lex_parser.ml" : 'regexp)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : 'regexp) in Obj.repr( # 126 "ocamllex-parser/lex_parser.mly" ( Sequence(_1, Repetition _1) ) # 349 "ocamllex-parser/lex_parser.ml" : 'regexp)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'regexp) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'regexp) in Obj.repr( # 128 "ocamllex-parser/lex_parser.mly" ( Alternative(_1,_3) ) # 357 "ocamllex-parser/lex_parser.ml" : 'regexp)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : 'regexp) in let _2 = (Parsing.peek_val __caml_parser_env 0 : 'regexp) in Obj.repr( # 130 "ocamllex-parser/lex_parser.mly" ( Sequence(_1,_2) ) # 365 "ocamllex-parser/lex_parser.ml" : 'regexp)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 1 : 'regexp) in Obj.repr( # 132 "ocamllex-parser/lex_parser.mly" ( _2 ) # 372 "ocamllex-parser/lex_parser.ml" : 'regexp)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string * Lex_syntax.location) in Obj.repr( # 134 "ocamllex-parser/lex_parser.mly" ( let (s,l)=_1 in Ident(s,l) ) # 379 "ocamllex-parser/lex_parser.ml" : 'regexp)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 0 : 'char_class1) in Obj.repr( # 138 "ocamllex-parser/lex_parser.mly" ( subtract all_chars _2 ) # 386 "ocamllex-parser/lex_parser.ml" : 'char_class)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'char_class1) in Obj.repr( # 140 "ocamllex-parser/lex_parser.mly" ( _1 ) # 393 "ocamllex-parser/lex_parser.ml" : 'char_class)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : int) in let _3 = (Parsing.peek_val __caml_parser_env 0 : int) in Obj.repr( # 144 "ocamllex-parser/lex_parser.mly" ( char_class _1 _3 ) # 401 "ocamllex-parser/lex_parser.ml" : 'char_class1)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : int) in Obj.repr( # 146 "ocamllex-parser/lex_parser.mly" ( [_1] ) # 408 "ocamllex-parser/lex_parser.ml" : 'char_class1)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : 'char_class1) in let _2 = (Parsing.peek_val __caml_parser_env 0 : 'char_class1) in Obj.repr( # 148 "ocamllex-parser/lex_parser.mly" ( _1 @ _2 ) # 416 "ocamllex-parser/lex_parser.ml" : 'char_class1)) (* Entry lexer_definition *) ; (fun __caml_parser_env -> raise (Parsing.YYexit (Parsing.peek_val __caml_parser_env 0))) |] let yytables = { Parsing.actions=yyact; Parsing.transl_const=yytransl_const; Parsing.transl_block=yytransl_block; Parsing.lhs=yylhs; Parsing.len=yylen; Parsing.defred=yydefred; Parsing.dgoto=yydgoto; Parsing.sindex=yysindex; Parsing.rindex=yyrindex; Parsing.gindex=yygindex; Parsing.tablesize=yytablesize; Parsing.table=yytable; Parsing.check=yycheck; Parsing.error_function=parse_error; Parsing.names_const=yynames_const; Parsing.names_block=yynames_block } let lexer_definition (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) = (Parsing.yyparse yytables 1 lexfun lexbuf : Lex_syntax.lexer_definition) ;; # 152 "ocamllex-parser/lex_parser.mly" # 443 "ocamllex-parser/lex_parser.ml"