ltlscan: get rid of boost::lexical_cast
This is one less useless dependency on Boost. * src/ltlparse/ltlscan.ll: Replace lexical_cast<unsigned>() by strtoul(). * src/ltltest/parseerr.test: Add a test case.
This commit is contained in:
parent
990ba837d3
commit
9145515bb8
2 changed files with 27 additions and 18 deletions
|
|
@ -26,8 +26,9 @@
|
|||
%option stack
|
||||
|
||||
%{
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "ltlparse/parsedecl.hh"
|
||||
#include "misc/escape.hh"
|
||||
|
||||
|
|
@ -197,20 +198,21 @@ BOXDARROW {BOX}{DARROWL}|"|"{DARROWL}|"⤇"
|
|||
"["{ARROWL} BEGIN(sqbracket); return token::OP_GOTO_OPEN;
|
||||
<sqbracket>"]" BEGIN(0); return token::OP_SQBKT_CLOSE;
|
||||
<sqbracket>[0-9]+ {
|
||||
unsigned num = 0;
|
||||
try {
|
||||
num = boost::lexical_cast<unsigned>(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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue