update dev300-m58
[ooovba.git] / writerfilter / source / rtftok / FlexLexer.h
bloba1a01162ddb726855efe705a5488ebf19b54a308
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: FlexLexer.h,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef __FLEX_LEXER_H
31 // Never included before - need to define base class.
32 #define __FLEX_LEXER_H
33 //#include <iostream.h>
34 typedef void ostream;
35 #include <vector>
36 #include <rtftok/RTFInputSource.hxx>
38 extern "C++" {
40 struct yy_buffer_state;
41 typedef int yy_state_type;
44 #include <rtftok/RTFScanner.hxx>
45 #endif
47 #if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
48 // Either this is the first time through (yyFlexLexerOnce not defined),
49 // or this is a repeated include to define a different flavor of
50 // yyFlexLexer, as discussed in the flex man page.
51 #define yyFlexLexerOnce
53 class yyFlexLexer : public writerfilter::rtftok::RTFScanner {
54 private:
55 class RtfTokenizer* tokenizerInstance;
57 void split_ctrl(char *yytext, char* token, char *value);
58 void raise_ctrl(char* yytext);
59 void raise_dest(char* yytext);
60 void raise_destOrCtrl(char* yytext);
61 protected:
62 int num_lines;
63 sal_uInt64 num_chars;
64 int star_flag;
66 public:
67 // arg_yyin and arg_yyout default to the cin and cout, but we
68 // only make that assignment when initializing in yylex().
69 yyFlexLexer( class writerfilter::rtftok::RTFInputSource* arg_yyin, class writerfilter::rtftok::RTFScannerHandler &eventHandler );
71 virtual ~yyFlexLexer();
73 void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
74 struct yy_buffer_state* yy_create_buffer( class writerfilter::rtftok::RTFInputSource* s, int size );
75 void yy_delete_buffer( struct yy_buffer_state* b );
76 void yyrestart( class writerfilter::rtftok::RTFInputSource* s );
78 virtual int yylex();
79 virtual void switch_streams( class writerfilter::rtftok::RTFInputSource* new_in, ostream* new_out );
81 protected:
83 // int LexerInput( char* buf, int max_size );
84 virtual void LexerOutput( const char* buf, int size );
85 virtual void LexerError( const char* msg );
87 void yyunput( int c, char* buf_ptr );
88 int yyinput();
90 void yy_load_buffer_state();
91 void yy_init_buffer( struct yy_buffer_state* b, class writerfilter::rtftok::RTFInputSource* s );
92 void yy_flush_buffer( struct yy_buffer_state* b );
94 int yy_start_stack_ptr;
95 int yy_start_stack_depth;
96 int* yy_start_stack;
98 void yy_push_state( int new_state );
99 void yy_pop_state();
100 int yy_top_state();
102 yy_state_type yy_get_previous_state();
103 yy_state_type yy_try_NUL_trans( yy_state_type current_state );
104 int yy_get_next_buffer();
106 class writerfilter::rtftok::RTFInputSource* yyin; // input source for default LexerInput
107 ostream* yyout; // output sink for default LexerOutput
109 struct yy_buffer_state* yy_current_buffer;
111 // yy_hold_char holds the character lost when yytext is formed.
112 char yy_hold_char;
114 // Number of characters read into yy_ch_buf.
115 int yy_n_chars;
117 // Points to current character in buffer.
118 char* yy_c_buf_p;
120 int yy_init; // whether we need to initialize
121 int yy_start; // start state number
123 // Flag which is used to allow yywrap()'s to do buffer switches
124 // instead of setting up a fresh yyin. A bit of a hack ...
125 int yy_did_buffer_switch_on_eof;
127 // The following are not always needed, but may be depending
128 // on use of certain flex features (like REJECT or yymore()).
130 yy_state_type yy_last_accepting_state;
131 char* yy_last_accepting_cpos;
133 yy_state_type* yy_state_buf;
134 yy_state_type* yy_state_ptr;
136 char* yy_full_match;
137 int* yy_full_state;
138 int yy_full_lp;
140 int yy_lp;
141 int yy_looking_for_trail_begin;
143 int yy_more_flag;
144 int yy_more_len;
145 int yy_more_offset;
146 int yy_prev_more_offset;
148 private:
152 #endif