diff --git a/src/ltlparse/ltlscan.ll b/src/ltlparse/ltlscan.ll index 912d0dabe..8322ae307 100644 --- a/src/ltlparse/ltlscan.ll +++ b/src/ltlparse/ltlscan.ll @@ -26,8 +26,9 @@ %option stack %{ +#include #include -#include + #include "ltlparse/parsedecl.hh" #include "misc/escape.hh" @@ -197,20 +198,21 @@ BOXDARROW {BOX}{DARROWL}|"|"{DARROWL}|"⤇" "["{ARROWL} BEGIN(sqbracket); return token::OP_GOTO_OPEN; "]" BEGIN(0); return token::OP_SQBKT_CLOSE; [0-9]+ { - unsigned num = 0; - try { - num = boost::lexical_cast(yytext); - yylval->num = num; - return token::OP_SQBKT_NUM; - } - catch (boost::bad_lexical_cast &) - { - error_list.push_back( - spot::ltl::parse_error(*yylloc, - "value too large ignored")); - // Skip this number and read next token - yylloc->step(); - } + errno = 0; + unsigned long n = strtoul(yytext, 0, 10); + yylval->num = n; + if (errno || yylval->num != n) + { + error_list.push_back( + spot::ltl::parse_error(*yylloc, + "value too large ignored")); + // Skip this number and read next token + yylloc->step(); + } + else + { + return token::OP_SQBKT_NUM; + } } /* .. is from PSL and EDL : is from Verilog and PSL diff --git a/src/ltltest/parseerr.test b/src/ltltest/parseerr.test index e7f8587ce..9c3fad466 100755 --- a/src/ltltest/parseerr.test +++ b/src/ltltest/parseerr.test @@ -1,8 +1,9 @@ #! /bin/sh -# Copyright (C) 2009, 2010, 2011 Laboratoire de Recherche et -# Développement de l'Epita (LRDE). +# -*- coding: utf-8 -*- +# Copyright (C) 2009, 2010, 2011, 2013 Laboratoire de Recherche et +# Développement de l'Epita (LRDE). # Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), -# département Systèmes Répartis Coopératifs (SRC), Université Pierre +# département Systèmes Répartis Coopératifs (SRC), Université Pierre # et Marie Curie. # # This file is part of Spot, a model checking library. @@ -99,3 +100,9 @@ syntax error, unexpected $undefined ^^^ ignoring trailing garbage ' + +check '{a[*9999999999]}' 'unop(Closure, bunop(Star, AP(a), 0, unbounded))' \ +'>>> {a[*9999999999]} + ^^^^^^^^^^ +value too large ignored +'