coan  6.0.1
A C/C++ Configuration Analyzer
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
chew.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2007-2013 Mike Kinghan, imk@burroingroingjoing.com *
3  * All rights reserved. *
4  * *
5  * Contributed by Mike Kinghan, imk@burroingroingjoing.com, *
6  * derived from the code of Tony Finch *
7  * *
8  * Redistribution and use in source and binary forms, with or without *
9  * modification, are permitted provided that the following conditions *
10  * are met: *
11  * *
12  * Redistributions of source code must retain the above copyright *
13  * notice, this list of conditions and the following disclaimer. *
14  * *
15  * Redistributions in binary form must reproduce the above copyright *
16  * notice, this list of conditions and the following disclaimer in the *
17  * documentation and/or other materials provided with the distribution. *
18  * *
19  * Neither the name of Mike Kinghan nor the names of its contributors *
20  * may be used to endorse or promote products derived from this software *
21  * without specific prior written permission. *
22  * *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS *
30  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED *
31  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,*
32  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF *
33  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
34  * DAMAGE. *
35  * *
36  **************************************************************************/
37 
38 #include "chew.h"
39 #include "diagnostic.h"
40 #include "parse_buffer.h"
41 
42 using namespace std;
43 
48 
50 template<>
51 void chewer<parse_buffer>::missing_terminator(size_t mark, char missing)
52 {
54  << "Missing '" << missing << "' terminator after \""
55  << buf().substr(mark) << '\"' << emit();
56 }
57 
58 template<>
60 {
62  << "Unexpected end of file, within C-comment" << defer();
63 }
64 
65 // No-ops
66 
67 template<>
68 void chewer<string>::missing_terminator(size_t mark, char missing){}
69 
70 template<>
72 
74 
75 /* EOF*/
warning_msg< 19 > warning_missing_terminator
Report missing terminator quotation.
Definition: diagnostic.h:687
error_msg< 4 > error_eof_too_soon
Report unexpected end of input.
Definition: diagnostic.h:730
The tag class is inserted in a diagnostic_base to tell it to emit itself.
Definition: diagnostic.h:77
void eof_in_comment()
Diagnose end of file in C-comment.
The tag class is inserted in a diagnostic_base to tell it to defer itself.
Definition: diagnostic.h:82
void missing_terminator(size_t off, char_type missing)
Diagnose a missing terminator character.