Assuming a simple Camlp4 parser that uses a ocamllex lexer wrapped in a stream,

let rec parse_primary = parser

  | [< 'INT n >] -> Int n
  | [< 'FLOAT n >] -> Float n
  | [< 'STRING n >] -> Str n
  | [< 'TRUE >] -> Bool true
  | [< 'FALSE >] -> Bool false

| [< >] -> raise (Stream.Error "unknown token when expecting an expression.")

How do I report the error location?

Do I need to pass loc in with every token?

Then what happens in the error case where there's no token available?

        Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml



_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to