(* standard parse error function. Copyright (C) 2004 Jean Goubault-Larrecq and LSV, CNRS UMR 8643 & ENS Cachan. This file is part of ispi. ispi is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ispi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ispi; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. *) open "yyerror_h"; fun print_yyloc (f as |[put, ...]|) yyloc = (print f (pack (isub (yyloc, 0)+1)); put "("; print f (pack (isub (yyloc, 1))); put ")"; put "-"; print f (pack (isub (yyloc, 2)+1)); put "("; print f (pack (isub (yyloc, 3))); put ")"); fun yyerror yyloc tokens = (#put stderr "Parse error, line "; print_yyloc stderr yyloc; let val sep = ref ", expected: " in iterate (#put stderr (!sep); sep := " or "; #put stderr token) | token in list tokens end; #put stderr ".\n"; #flush stderr () end);