Public Member Functions | Private Member Functions | Private Attributes

# Lexer Class Reference

Lexer of a file. More...

## Public Member Functions
| Lexer (const File *file)
| Create the lexer and fill the keywords table.
| ~Lexer ()
| Free everything.
void | Next ()
| Read the next character into 'current_char'.
Token | GetToken () const
| Get the current token.
const char * | GetString () const
| Read the currenty processed string.
void | Lex ()
| Perform the lexing/tokenizing of the file till we can return something that must be parsed.
## Private Member Functions
Token | FindKeyword (const char *name) const
| The token based on keyword with a given name.
void | ReadIdentifier ()
| Read an identifier.
void | ReadString (char end, Token token)
| Read a string up to a given character, then set the given token.
## Private Attributes
const File * | file
| The file to read from.
char | current_char
| The current character to process.
char * | string
| Currently processed string.
Token | token
| The current token to process.
char * | buf
| Temporary buffer.
size_t | buf_len
| Length of the temporary buffer.
KeywordList | keywords
| All keywords we know of.

## Detailed Description

Lexer of a file.

Definition at line 168 of file depend.cpp.

## Constructor & Destructor Documentation

Lexer::Lexer | ( | const File * | file | ) | `[inline]`

Create the lexer and fill the keywords table.

Parameters:

  | file | the file to read from.

Definition at line 174 of file depend.cpp.

References buf, buf_len, keywords, and Next().

## Member Function Documentation

Token Lexer::FindKeyword | ( | const char * | name | ) | const`[inline, private]`

The token based on keyword with a given name.

Parameters:

  | name | the actual keyword.

Returns:
  the token of the keyword.

Definition at line 356 of file depend.cpp.

References keywords, and TOKEN_IDENTIFIER.

Referenced by ReadIdentifier().

const char* Lexer::GetString | ( |  | ) | const`[inline]`

Read the currenty processed string.

Returns:
  the string, can be NULL.

Definition at line 222 of file depend.cpp.

References string.

Referenced by ExpressionDefined(), and ScanFile().

Token Lexer::GetToken | ( |  | ) | const`[inline]`

Get the current token.

Returns:
  the token.

Definition at line 213 of file depend.cpp.

References token.

Referenced by ExpressionAnd(), ExpressionDefined(), ExpressionNot(), ExpressionOr(), and ScanFile().

void Lexer::ReadString | ( | char | end,
|  | Token | token |
| ) |  |  | `[inline, private]`

Read a string up to a given character, then set the given token.

Parameters:

  | end | the 'marker' for the end of the string.
  | token | the token to set after returning.

Definition at line 393 of file depend.cpp.

References buf, buf_len, current_char, free(), and Next().

Referenced by Lex().

The documentation for this class was generated from the following file:

- src/depend/depend.cpp