# HG changeset patch
# User Michael Stahl <mst@openoffice.org>
# Date 1303140561 0
# Node ID c0653e1cbbfdb2764417f9ce2c5c6c93561bdfd9
# Parent  5fdd9cee833c7ef9b4651c5dde05fda22abbc931
rtftok01: writerfilter: revert FlexLexer.h to version shipped with flex

diff --git a/writerfilter/source/rtftok/FlexLexer.h b/writerfilter/source/rtftok/FlexLexer.h
--- a/writerfilter/source/rtftok/FlexLexer.h
+++ b/writerfilter/source/rtftok/FlexLexer.h
@@ -1,44 +1,97 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+// $Header: /home/daffy/u0/vern/flex/RCS/FlexLexer.h,v 1.19 96/05/25 20:43:02 vern Exp $
+
+// FlexLexer.h -- define interfaces for lexical analyzer classes generated
+//		  by flex
+
+// Copyright (c) 1993 The Regents of the University of California.
+// All rights reserved.
+//
+// This code is derived from software contributed to Berkeley by
+// Kent Williams and Tom Epperly.
+//
+// Redistribution and use in source and binary forms with or without
+// modification are permitted provided that: (1) source distributions retain
+// this entire copyright notice and comment, and (2) distributions including
+// binaries display the following acknowledgement:  ``This product includes
+// software developed by the University of California, Berkeley and its
+// contributors'' in the documentation or other materials provided with the
+// distribution and in all advertising materials mentioning features or use
+// of this software.  Neither the name of the University nor the names of
+// its contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+
+// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+// This file defines FlexLexer, an abstract class which specifies the
+// external interface provided to flex C++ lexer objects, and yyFlexLexer,
+// which defines a particular lexer class.
+//
+// If you want to create multiple lexer classes, you use the -P flag
+// to rename each yyFlexLexer to some other xxFlexLexer.  You then
+// include <FlexLexer.h> in your other sources once per lexer class:
+//
+//	#undef yyFlexLexer
+//	#define yyFlexLexer xxFlexLexer
+//	#include <FlexLexer.h>
+//
+//	#undef yyFlexLexer
+//	#define yyFlexLexer zzFlexLexer
+//	#include <FlexLexer.h>
+//	...
+
 #ifndef __FLEX_LEXER_H
 // Never included before - need to define base class.
 #define __FLEX_LEXER_H
-//#include <iostream.h>
-typedef void ostream;
-#include <vector>
-#include <rtftok/RTFInputSource.hxx>
+#include <iostream>
 
 extern "C++" {
 
 struct yy_buffer_state;
 typedef int yy_state_type;
-  
+
+class FlexLexer {
+public:
+	virtual ~FlexLexer()	{ }
+
+	const char* YYText()	{ return yytext; }
+	int YYLeng()		{ return yyleng; }
+
+	virtual void
+		yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
+	virtual struct yy_buffer_state*
+		yy_create_buffer( std::istream* s, int size ) = 0;
+	virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
+	virtual void yyrestart( std::istream* s ) = 0;
+
+	virtual int yylex() = 0;
+
+	// Call yylex with new input/output sources.
+	int yylex( std::istream* new_in, std::ostream* new_out = 0 )
+		{
+		switch_streams( new_in, new_out );
+		return yylex();
+		}
+
+	// Switch to new input/output streams.  A nil stream pointer
+	// indicates "keep the current one".
+	virtual void switch_streams( std::istream* new_in = 0,
+					std::ostream* new_out = 0 ) = 0;
+
+	int lineno() const		{ return yylineno; }
+
+	int debug() const		{ return yy_flex_debug; }
+	void set_debug( int flag )	{ yy_flex_debug = flag; }
+
+protected:
+	char* yytext;
+	int yyleng;
+	int yylineno;		// only maintained if you use %option yylineno
+	int yy_flex_debug;	// only has effect with -d or "%option debug"
+};
+
 }
-#include <rtftok/RTFScanner.hxx>
 #endif
 
 #if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
@@ -47,37 +100,24 @@
 // yyFlexLexer, as discussed in the flex man page.
 #define yyFlexLexerOnce
 
-class yyFlexLexer : public writerfilter::rtftok::RTFScanner {
-private:
-	class RtfTokenizer* tokenizerInstance;
-
-	void split_ctrl(char *yytext, char* token, char *value);
-	void raise_ctrl(char* yytext);
-	void raise_dest(char* yytext);
-	void raise_destOrCtrl(char* yytext);
-protected:
-	int num_lines;
-	sal_uInt64 num_chars;
-	int star_flag;
-
+class yyFlexLexer : public FlexLexer {
 public:
 	// arg_yyin and arg_yyout default to the cin and cout, but we
 	// only make that assignment when initializing in yylex().
-	yyFlexLexer( class writerfilter::rtftok::RTFInputSource* arg_yyin, class writerfilter::rtftok::RTFScannerHandler &eventHandler );
+	yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 );
 
 	virtual ~yyFlexLexer();
 
 	void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
-	struct yy_buffer_state* yy_create_buffer( class writerfilter::rtftok::RTFInputSource* s, int size );
+	struct yy_buffer_state* yy_create_buffer( std::istream* s, int size );
 	void yy_delete_buffer( struct yy_buffer_state* b );
-	void yyrestart( class writerfilter::rtftok::RTFInputSource* s );
+	void yyrestart( std::istream* s );
 
 	virtual int yylex();
-	virtual void switch_streams( class writerfilter::rtftok::RTFInputSource* new_in, ostream* new_out );
+	virtual void switch_streams( std::istream* new_in, std::ostream* new_out );
 
 protected:
-
-//	int LexerInput( char* buf, int max_size );
+	virtual int LexerInput( char* buf, int max_size );
 	virtual void LexerOutput( const char* buf, int size );
 	virtual void LexerError( const char* msg );
 
@@ -85,7 +125,7 @@
 	int yyinput();
 
 	void yy_load_buffer_state();
-	void yy_init_buffer( struct yy_buffer_state* b, class writerfilter::rtftok::RTFInputSource* s );
+	void yy_init_buffer( struct yy_buffer_state* b, std::istream* s );
 	void yy_flush_buffer( struct yy_buffer_state* b );
 
 	int yy_start_stack_ptr;
@@ -100,8 +140,8 @@
 	yy_state_type yy_try_NUL_trans( yy_state_type current_state );
 	int yy_get_next_buffer();
 
-	class writerfilter::rtftok::RTFInputSource* yyin;	// input source for default LexerInput
-	ostream* yyout;	// output sink for default LexerOutput
+	std::istream* yyin;	// input source for default LexerInput
+	std::ostream* yyout;	// output sink for default LexerOutput
 
 	struct yy_buffer_state* yy_current_buffer;
 
@@ -141,9 +181,6 @@
 	int yy_more_len;
 	int yy_more_offset;
 	int yy_prev_more_offset;
-
- private:
-
 };
 
 #endif
