Leaked source code of windows server 2003
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
//
// Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
//
#ifndef SIMC_SCANNER_H
#define SIMC_SCANNER_H
class SIMCParser;
/*
* This is the SIMCScanner class that forms the scanner (tokenizer) * used by the SIMCParser class, which is the parser. The SIMCScanner * class is derived form the yy_scan class that is generated by the * MKS LEX utility from the information in the lex.l file. * * It adds functionality to it, like column numbers, naming the * input stream, and redefining yyerror(). */ class SIMCScanner : public yy_scan { CString _inputStreamName;
// The parser that is making use of this scanner currently.
// This value *has* to be set by the parser, if it makes
// a call to yy_scan::yyerror, since this value is used there
SIMCParser *_theParser; public:
// Create s scanner, by specifying a parser. If this is specified
// as null, it has to be set using the SetParser() function, before
// it is used
SIMCScanner(SIMCParser * parser = NULL); ~SIMCScanner();
// Various ways of setting the input that is scanned. This is used as
// the source. NOTE: Only the second one has been tested (ie., the
// one that specifies an input file name
BOOL SetInput(ifstream& inputStream); BOOL SetInput(const CString& inputFile); BOOL SetInput(const int fd = 0); BOOL SetInput(FILE * fileStream); // Column number. Make it public, as is the LEX tradition
long columnNo; virtual void output(int);
// Sets the parse that uses this scanner currently
void SetParser(SIMCParser *parser) { _theParser = parser; } SIMCParser *GetParser() const { return _theParser; }
// The redefinition of yy_scan.yyerror() to suit our needs
// of error reporting
virtual void yyerror (char *fmt, ...);
inline const char * const GetInputStreamName() const { return _inputStreamName; } void SetInputStreamName( const CString& streamName); };
#endif SIMC_SCANNER_H
|