coan  6.0.1
A C/C++ Configuration Analyzer
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
canonical.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 originally by Mike Kinghan, imk@burroingroingjoing.com *
6  * *
7  * Redistribution and use in source and binary forms, with or without *
8  * modification, are permitted provided that the following conditions *
9  * are met: *
10  * *
11  * Redistributions of source code must retain the above copyright *
12  * notice, this list of conditions and the following disclaimer. *
13  * *
14  * Redistributions in binary form must reproduce the above copyright *
15  * notice, this list of conditions and the following disclaimer in the *
16  * documentation and/or other materials provided with the distribution. *
17  * *
18  * Neither the name of Mike Kinghan nor the names of its contributors *
19  * may be used to endorse or promote products derived from this software *
20  * without specific prior written permission. *
21  * *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS *
29  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED *
30  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,*
31  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF *
32  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
33  * DAMAGE. *
34  * *
35  **************************************************************************/
36 #include "canonical.h"
37 #include "identifier.h"
38 #include "options.h"
39 #include "parse_buffer.h"
40 
41 using namespace std;
42 
48 bool innards::canonical_base::cxx() const {
50  return !options::plaintext();
51 }
52 
53 template<>
54 template<class CharSeq>
56 {
57  chew(continuation);
58  if (chew && identifier::is_start_char(*chew)) {
59  _canonical.append(1,*chew);
60  chew(+1,continuation);
61  for ( ; chew && identifier::is_valid_char(*chew);
62  chew(+1,continuation)) {
63  _canonical.append(1,*chew);
64  }
65  }
66 }
67 
68 template
70 template
72 
74 
75 /* EOF */
static bool plaintext()
Are we to omit parsing for C/C++ comments?
Definition: options.h:183
bool is_start_char(char ch)
Say whether a character can be the first of an identifier.
Definition: identifier.h:52
chew_mode::continuation const continuation
An exemplar chew_mode::continuation
Definition: chew.h:213
bool is_valid_char(char ch)
Say whether a character can occur in an identifier.
Definition: identifier.h:57
`template struct chewer<CharSeq> is a cursor-like type that is associated with a character-sequence t...
Definition: chew.h:248
void canonicalize(chewer< CharSeq > &chew)
Canonicalize from a chewer<CharSeq>
bool cxx() const
Canonicalizing C/C++ source?