idbase.cc (ragel-7.0.0.9) | : | idbase.cc (ragel-7.0.0.10) | ||
---|---|---|---|---|
/* | /* | |||
* Copyright 2008-2016 Adrian Thurston <thurston@complang.org> | * Copyright 2008-2016 Adrian Thurston <thurston@colm.net> | |||
*/ | ||||
/* This file is part of Ragel. | ||||
* | * | |||
* Ragel is free software; you can redistribute it and/or modify | * Permission is hereby granted, free of charge, to any person obtaining a copy | |||
* it under the terms of the GNU General Public License as published by | * of this software and associated documentation files (the "Software"), to | |||
* the Free Software Foundation; either version 2 of the License, or | * deal in the Software without restriction, including without limitation the | |||
* (at your option) any later version. | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |||
* sell copies of the Software, and to permit persons to whom the Software is | ||||
* furnished to do so, subject to the following conditions: | ||||
* | * | |||
* Ragel is distributed in the hope that it will be useful, | * The above copyright notice and this permission notice shall be included in al | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | l | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * copies or substantial portions of the Software. | |||
* GNU General Public License for more details. | ||||
* | * | |||
* You should have received a copy of the GNU General Public License | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
* along with Ragel; if not, write to the Free Software | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
* SOFTWARE. | ||||
*/ | */ | |||
#include "ragel.h" | #include "ragel.h" | |||
#include "fsmgraph.h" | #include "fsmgraph.h" | |||
#include "parsedata.h" | #include "parsedata.h" | |||
/* Error reporting format. */ | /* Error reporting format. */ | |||
ErrorFormat errorFormat = ErrorFormatGNU; | ErrorFormat errorFormat = ErrorFormatGNU; | |||
void FsmCtx::finalizeInstance( FsmAp *graph ) | void FsmCtx::finalizeInstance( FsmAp *graph ) | |||
skipping to change at line 346 | skipping to change at line 347 | |||
} | } | |||
void FsmGbl::abortCompile( int code ) | void FsmGbl::abortCompile( int code ) | |||
{ | { | |||
throw AbortCompile( code ); | throw AbortCompile( code ); | |||
} | } | |||
/* Print the opening to a warning in the input, then return the error ostream. * / | /* Print the opening to a warning in the input, then return the error ostream. * / | |||
ostream &FsmGbl::warning( const InputLoc &loc ) | ostream &FsmGbl::warning( const InputLoc &loc ) | |||
{ | { | |||
ostream &err = inLibRagel ? libcerr : std::cerr; | ostream &err = std::cerr; | |||
err << loc << ": warning: "; | err << loc << ": warning: "; | |||
return err; | return err; | |||
} | } | |||
/* Print the opening to a program error, then return the error stream. */ | /* Print the opening to a program error, then return the error stream. */ | |||
ostream &FsmGbl::error() | ostream &FsmGbl::error() | |||
{ | { | |||
errorCount += 1; | errorCount += 1; | |||
ostream &err = inLibRagel ? libcerr : std::cerr; | ostream &err = std::cerr; | |||
err << PROGNAME ": "; | err << PROGNAME ": "; | |||
return err; | return err; | |||
} | } | |||
ostream &FsmGbl::error( const InputLoc &loc ) | ostream &FsmGbl::error( const InputLoc &loc ) | |||
{ | { | |||
errorCount += 1; | errorCount += 1; | |||
ostream &err = inLibRagel ? libcerr : std::cerr; | ostream &err = std::cerr; | |||
err << loc << ": "; | err << loc << ": "; | |||
return err; | return err; | |||
} | } | |||
ostream &FsmGbl::error_plain() | ||||
{ | ||||
errorCount += 1; | ||||
ostream &err = std::cerr; | ||||
return err; | ||||
} | ||||
std::ostream &FsmGbl::stats() | std::ostream &FsmGbl::stats() | |||
{ | { | |||
return inLibRagel ? libcout : std::cout; | return std::cout; | |||
} | } | |||
/* Requested info. */ | /* Requested info. */ | |||
std::ostream &FsmGbl::info() | std::ostream &FsmGbl::info() | |||
{ | { | |||
return inLibRagel ? libcout : std::cout; | return std::cout; | |||
} | } | |||
ostream &operator<<( ostream &out, const InputLoc &loc ) | ostream &operator<<( ostream &out, const InputLoc &loc ) | |||
{ | { | |||
assert( loc.fileName != 0 ); | assert( loc.fileName != 0 ); | |||
switch ( errorFormat ) { | switch ( errorFormat ) { | |||
case ErrorFormatMSVC: | case ErrorFormatMSVC: | |||
out << loc.fileName << "(" << loc.line; | out << loc.fileName << "(" << loc.line; | |||
if ( loc.col ) | if ( loc.col ) | |||
out << "," << loc.col; | out << "," << loc.col; | |||
End of changes. 10 change blocks. | ||||
20 lines changed or deleted | 29 lines changed or added |