Google

TOP --> CcDoc

class CCcDocLexer

Converts a C++ source file into tokens with associated types.

Author:
Joe Linoff

Version:
$Id: ccdoclexer.h,v 1.4 1999/06/12 18:10:33 jdl Exp $

Source:
../../ccdoc/src/ccdoclexer.h:28

Constructors Index

CCcDocLexer
[public] Default constructor.


Enums Index

LEXICON_TYPE
[public] TOKEN TYPEs.


Methods Index

GetName
[public] Get the name of a token type.
IsDebug
[public] Is the CCDOC_LEXER_DEBUG environment variable set?
IsKeyword
[public] Is this token a keyword?
IsPunctuator
[public] Is this token a punctuator?
IsReserved
[public] Is this token a reserved word?
LoadStringDataFromRcFile
[public] Resource file load routine.
ScanNextToken
[public] Scan the next token.


Constructors

CCcDocLexer

public CCcDocLexer ( ) ;

Default constructor.


Enums

LEXICON_TYPE

public enum LEXICON_TYPE { COMMENT ,
                           DOUBLE_QUOTE ,
                           FLOAT ,
                           ID ,
                           INTEGER ,
                           KEYWORD ,
                           OPERATOR ,
                           PRAGMA ,
                           PUNCTUATOR ,
                           RESERVED ,
                           SINGLE_QUOTE ,
                           UNKNOWN ,
                           END_OF_FILE } ;

TOKEN TYPEs.


Methods

ScanNextToken

public LEXICON_TYPE ScanNextToken ( CJdlBufferedFileReader & file ,
                                    const char * & token ) ;

Scan the next token.

The example below shows how to dump all of the lexicons in a file.


 CJdlBufferedFileReader file;
 file.Open("main.cpp");
 CCcDocLexer scanner;
 const char* token;
 CCcDocLexer::LEXICON_TYPE type = CCcDocLexer::END_OF_FILE;
 while( (type = scanner.ScanNextToken(file,token)) != CCcDocLexer::END_OF_FILE ) {
   printf("L:%s:%d:%s\n",scanner.GetName(type),::strlen(token),token);
 }

IsKeyword

public static bool IsKeyword ( const char * token ) ;

Is this token a keyword?

Parameters:
token The token.

Return:
True if this token is keyword or false otherwise.

IsReserved

public static bool IsReserved ( const char * token ) ;

Is this token a reserved word?

Parameters:
token The token.

Return:
True if this token is keyword or false otherwise.

IsPunctuator

public static bool IsPunctuator ( const char * token ) ;

Is this token a punctuator?

Parameters:
token The token.

Return:
True if this token is keyword or false otherwise.

GetName

public static const char * GetName ( LEXICON_TYPE type ) ;

Get the name of a token type.

Parameters:
type The token type.

Return:
A string that describes the token type.

IsDebug

public bool IsDebug ( ) const ;

Is the CCDOC_LEXER_DEBUG environment variable set?

Return:
True if it is set or false otherwise.

LoadStringDataFromRcFile

public static void LoadStringDataFromRcFile ( CJdlStringList & list ,
                                              const char * rcfile ,
                                              const char * section ) ;

Resource file load routine.

Parameters:
The output list. If nothing is loaded the number of items in the returned string doesn't change.
rcfile The name of the RC file.
section The section within the file.

This documentation was generated automatically by the ccdoc tool (version 0.7a).
Click here to submit a bug report or feature request.

Click here to return to the top of the page.