coan 4.2.4
chew.h
Go to the documentation of this file.
00001 #ifndef CHEW_H
00002 #define CHEW_H
00003 
00004 /***************************************************************************
00005  *   Copyright (C) 2004, 2006 Symbian Software Ltd.                        *
00006  *   All rights reserved.                                                  *
00007  *   Copyright (C) 2002, 2003 Tony Finch <dot@dotat.at>.                   *
00008  *   All rights reserved.                                                  *
00009  *   Copyright (C) 1985, 1993 The Regents of the University of California. *
00010  *   All rights reserved.                                                  *
00011  *   Copyright (C) 2007-2011 Mike Kinghan, imk@strudl.org                  *
00012  *   All rights reserved.                                                  *
00013  *                                                                         *
00014  *   Contributed by Mike Kinghan, imk@strudl.org, derived from the code    *
00015  *   of Tony Finch                                                         *
00016  *                                                                         *
00017  *   Redistribution and use in source and binary forms, with or without    *
00018  *   modification, are permitted provided that the following conditions    *
00019  *   are met:                                                              *
00020  *                                                                         *
00021  *   Redistributions of source code must retain the above copyright        *
00022  *   notice, this list of conditions and the following disclaimer.         *
00023  *                                                                         *
00024  *   Redistributions in binary form must reproduce the above copyright     *
00025  *   notice, this list of conditions and the following disclaimer in the   *
00026  *   documentation and/or other materials provided with the distribution.  *
00027  *                                                                         *
00028  *   Neither the name of Symbian Software Ltd. nor the names of its        *
00029  *   contributors may be used to endorse or promote products derived from  *
00030  *   this software without specific prior written permission.              *
00031  *                                                                         *
00032  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   *
00033  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     *
00034  *   LIMITED TO, THE IMPLIED WARRANTIES OF  MERCHANTABILITY AND FITNESS    *
00035  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE        *
00036  *   COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,   *
00037  *   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,  *
00038  *   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS *
00039  *   OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED    *
00040  *   AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,*
00041  *   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF *
00042  *   THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH  *
00043  *   DAMAGE.                                                               *
00044  *                                                                         *
00045  **************************************************************************/
00046 
00047 #include "state_utils.h"
00048 
00056 
00058 typedef enum comment_state {
00060     NO_COMMENT = false,
00062     C_COMMENT,
00064     CXX_COMMENT,
00066     STARTING_COMMENT,
00068     FINISHING_COMMENT,
00070     PSEUDO_COMMENT
00071 } comment_state_t;
00072 
00074 typedef enum {
00076     LS_NEUTER,
00078     LS_DIRECTIVE,
00081     LS_CODE
00082 } line_state_t;
00083 
00091 extern unsigned
00092 eol(char const *cp);
00093 
00105 extern char const *
00106 chew_on(char const *cp);
00107 
00114 extern char const *
00115 chew_symbol(char const *cp);
00116 
00128 extern char const *
00129 chew_continuation(char const *cp);
00130 
00131 
00143 extern char const *
00144 chew_macro_call(char const *cp);
00145 
00153 extern char const *
00154 chew_header_name(char const *cp);
00155 
00156 
00170 extern char const *
00171 chew_string(char const *cp);
00172 
00176 extern char const *
00177 chew_unbroken_string(char const *cp);
00178 
00180 extern void
00181 chew_toplevel(void);
00182 
00187 
00189 PUBLIC_STATE_DEF(chew)
00190 {
00191     enum comment_state comment_state;
00193     bool stop_at_quote;
00195     bool must_balance_quotes;
00197     bool in_double_quote; 
00198     bool in_source; 
00200     line_state_t line_state;
00202     size_t      last_quote_start_line;
00204     size_t       last_comment_start_line;
00206 }
00207 PUBLIC_STATE_T(chew);
00212 IMPORT(chew);
00215 #endif /* EOF*/
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines