Re: Combining different rules in ocamllex

"[email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
That works, thank you. I corrected the last two parts of my code as follows :

rule usual = parse
  | '"'  { quoted_string lexbuf;}
  | _ as c {add_to_list (CHAR c); usual lexbuf}
  | eof { List.rev(!list_accu) }
and quoted_string=parse
  | "\\\"" {add_to_string '\''; quoted_string lexbuf}
  | "\\\\" {add_to_string '\\'; quoted_string lexbuf}
  | '"' {finish_quote(); usual lexbuf}
  | _ as c {add_to_string c; quoted_string lexbuf}
  |eof { List.rev(!list_accu)}     
  
{

let parse_all s =
          let _=(list_accu:=[];string_accu:="") in
          usual (Lexing.from_string s)   
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.