[Git][monnier/typer][master] * src/sexp.ml (sexp_parse_all): Fail more gracefully when encountering
Stefan pushed to branch master at Stefan / Typer Commits: c39bd687 by Stefan Monnier at 2018-07-12T16:17:12Z * src/sexp.ml (sexp_parse_all): Fail more gracefully when encountering a stray closing token. - - - - - 1 changed file: - src/sexp.ml Changes: ===================================== src/sexp.ml ===================================== @@ -1,6 +1,6 @@ (* sexp.ml --- The Lisp-style Sexp abstract syntax tree. -Copyright (C) 2011-2017 Free Software Foundation, Inc. +Copyright (C) 2011-2018 Free Software Foundation, Inc. Author: Stefan Monnier <monnier@iro.umontreal.ca> Keywords: languages, lisp, dependent types. @@ -209,7 +209,10 @@ let sexp_parse_all grm tokens limit : sexp * token list = | _ -> (internal_error "Didn't find a toplevel") in match rest with | [] -> (se,rest) - | Symbol (_,t) :: rest when Some t = limit -> (se,rest) + | Symbol (l,t) :: rest + -> if not (Some t = limit) + then sexp_error l ("Stray closing token: \"" ^ t ^ "\""); + (se,rest) | _ -> (internal_error "Stopped parsing before the end!") (* "sexp_p" is for "parsing" and "sexp_u" is for "unparsing". *) View it on GitLab: https://gitlab.com/monnier/typer/commit/c39bd687de2aeb72f43de3d531118b321c7e... -- View it on GitLab: https://gitlab.com/monnier/typer/commit/c39bd687de2aeb72f43de3d531118b321c7e... You're receiving this email because of your account on gitlab.com.
Afficher les réponses par date
participants (1)
-
Stefan