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
|
%option stack
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
#include "ltlparse/parsedecl.hh"
|
#include "ltlparse/parsedecl.hh"
|
||||||
#include "misc/escape.hh"
|
#include "misc/escape.hh"
|
||||||
|
|
||||||
|
|
@ -197,20 +198,21 @@ BOXDARROW {BOX}{DARROWL}|"|"{DARROWL}|"⤇"
|
||||||
"["{ARROWL} BEGIN(sqbracket); return token::OP_GOTO_OPEN;
|
"["{ARROWL} BEGIN(sqbracket); return token::OP_GOTO_OPEN;
|
||||||
<sqbracket>"]" BEGIN(0); return token::OP_SQBKT_CLOSE;
|
<sqbracket>"]" BEGIN(0); return token::OP_SQBKT_CLOSE;
|
||||||
<sqbracket>[0-9]+ {
|
<sqbracket>[0-9]+ {
|
||||||
unsigned num = 0;
|
errno = 0;
|
||||||
try {
|
unsigned long n = strtoul(yytext, 0, 10);
|
||||||
num = boost::lexical_cast<unsigned>(yytext);
|
yylval->num = n;
|
||||||
yylval->num = num;
|
if (errno || yylval->num != n)
|
||||||
return token::OP_SQBKT_NUM;
|
{
|
||||||
}
|
error_list.push_back(
|
||||||
catch (boost::bad_lexical_cast &)
|
spot::ltl::parse_error(*yylloc,
|
||||||
{
|
"value too large ignored"));
|
||||||
error_list.push_back(
|
// Skip this number and read next token
|
||||||
spot::ltl::parse_error(*yylloc,
|
yylloc->step();
|
||||||
"value too large ignored"));
|
}
|
||||||
// Skip this number and read next token
|
else
|
||||||
yylloc->step();
|
{
|
||||||
}
|
return token::OP_SQBKT_NUM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* .. is from PSL and EDL
|
/* .. is from PSL and EDL
|
||||||
: is from Verilog and PSL
|
: is from Verilog and PSL
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Copyright (C) 2009, 2010, 2011 Laboratoire de Recherche et
|
# -*- coding: utf-8 -*-
|
||||||
# Développement de l'Epita (LRDE).
|
# 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),
|
# 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.
|
# et Marie Curie.
|
||||||
#
|
#
|
||||||
# This file is part of Spot, a model checking library.
|
# This file is part of Spot, a model checking library.
|
||||||
|
|
@ -99,3 +100,9 @@ syntax error, unexpected $undefined
|
||||||
^^^
|
^^^
|
||||||
ignoring trailing garbage
|
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