1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef __FLEX_LEXER_H
24 // Never included before - need to define base class.
25 #define __FLEX_LEXER_H
26 //#include <iostream.h>
27 typedef void ostream;
28 #include <vector>
29 #include <rtftok/RTFInputSource.hxx>
30 
31 extern "C++" {
32 
33 struct yy_buffer_state;
34 typedef int yy_state_type;
35 
36 }
37 #include <rtftok/RTFScanner.hxx>
38 #endif
39 
40 #if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
41 // Either this is the first time through (yyFlexLexerOnce not defined),
42 // or this is a repeated include to define a different flavor of
43 // yyFlexLexer, as discussed in the flex man page.
44 #define yyFlexLexerOnce
45 
46 class yyFlexLexer : public writerfilter::rtftok::RTFScanner {
47 private:
48 	class RtfTokenizer* tokenizerInstance;
49 
50 	void split_ctrl(char *yytext, char* token, char *value);
51 	void raise_ctrl(char* yytext);
52 	void raise_dest(char* yytext);
53 	void raise_destOrCtrl(char* yytext);
54 protected:
55 	int num_lines;
56 	sal_uInt64 num_chars;
57 	int star_flag;
58 
59 public:
60 	// arg_yyin and arg_yyout default to the cin and cout, but we
61 	// only make that assignment when initializing in yylex().
62 	yyFlexLexer( class writerfilter::rtftok::RTFInputSource* arg_yyin, class writerfilter::rtftok::RTFScannerHandler &eventHandler );
63 
64 	virtual ~yyFlexLexer();
65 
66 	void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
67 	struct yy_buffer_state* yy_create_buffer( class writerfilter::rtftok::RTFInputSource* s, int size );
68 	void yy_delete_buffer( struct yy_buffer_state* b );
69 	void yyrestart( class writerfilter::rtftok::RTFInputSource* s );
70 
71 	virtual int yylex();
72 	virtual void switch_streams( class writerfilter::rtftok::RTFInputSource* new_in, ostream* new_out );
73 
74 protected:
75 
76 //	int LexerInput( char* buf, int max_size );
77 	virtual void LexerOutput( const char* buf, int size );
78 	virtual void LexerError( const char* msg );
79 
80 	void yyunput( int c, char* buf_ptr );
81 	int yyinput();
82 
83 	void yy_load_buffer_state();
84 	void yy_init_buffer( struct yy_buffer_state* b, class writerfilter::rtftok::RTFInputSource* s );
85 	void yy_flush_buffer( struct yy_buffer_state* b );
86 
87 	int yy_start_stack_ptr;
88 	int yy_start_stack_depth;
89 	int* yy_start_stack;
90 
91 	void yy_push_state( int new_state );
92 	void yy_pop_state();
93 	int yy_top_state();
94 
95 	yy_state_type yy_get_previous_state();
96 	yy_state_type yy_try_NUL_trans( yy_state_type current_state );
97 	int yy_get_next_buffer();
98 
99 	class writerfilter::rtftok::RTFInputSource* yyin;	// input source for default LexerInput
100 	ostream* yyout;	// output sink for default LexerOutput
101 
102 	struct yy_buffer_state* yy_current_buffer;
103 
104 	// yy_hold_char holds the character lost when yytext is formed.
105 	char yy_hold_char;
106 
107 	// Number of characters read into yy_ch_buf.
108 	int yy_n_chars;
109 
110 	// Points to current character in buffer.
111 	char* yy_c_buf_p;
112 
113 	int yy_init;		// whether we need to initialize
114 	int yy_start;		// start state number
115 
116 	// Flag which is used to allow yywrap()'s to do buffer switches
117 	// instead of setting up a fresh yyin.  A bit of a hack ...
118 	int yy_did_buffer_switch_on_eof;
119 
120 	// The following are not always needed, but may be depending
121 	// on use of certain flex features (like REJECT or yymore()).
122 
123 	yy_state_type yy_last_accepting_state;
124 	char* yy_last_accepting_cpos;
125 
126 	yy_state_type* yy_state_buf;
127 	yy_state_type* yy_state_ptr;
128 
129 	char* yy_full_match;
130 	int* yy_full_state;
131 	int yy_full_lp;
132 
133 	int yy_lp;
134 	int yy_looking_for_trail_begin;
135 
136 	int yy_more_flag;
137 	int yy_more_len;
138 	int yy_more_offset;
139 	int yy_prev_more_offset;
140 
141  private:
142 
143 };
144 
145 #endif
146