2 module EP = RecommParser
29 let str c = String.make 1 c
31 let nl lexbuf = Lexing.new_line lexbuf
33 let is_uppercase_ascii s =
35 if i < 0 then true else
36 if 'a' <= s.[i] && s.[i] <= 'z' then false else
39 aux (String.length s - 1)
41 let disambiguate_word s =
42 if Array.mem s keys then EP.KW s else
43 if Array.mem s heads then EP.HW s else
44 if is_uppercase_ascii s then EP.CW s else
48 if !debug then Printf.eprintf "lezer: %s\n" s
51 if !debug then Printf.eprintf "lexer: %S\n" s
54 if !debug then Printf.eprintf "lexer: %C\n" c
64 let WF = ['A'-'Z' 'a'-'z']
65 let WB = ['A'-'Z' 'a'-'z' '_' '-']*
68 rule src_token = parse
69 | CR { src_token lexbuf }
70 | NL as c { log "NL"; nl lexbuf; EP.NL (str c) }
71 | SP+ as s { log "SP"; EP.SP s }
72 | PP as s { log "PP"; EP.PP s }
73 | OP as s { log "OP"; EP.OP s }
74 | CP as s { log "CP"; EP.CP s }
75 | SR as c { log "SR"; EP.SR (str c) }
76 | WD as s { log_s s ; disambiguate_word s }
77 | _ as c { log_c c ; EP.OT (str c) }
78 | eof { log "EF"; EP.EF }