Zen
A cross-platform functional programming language

Scanner Class Reference

Class for scanning the input stream and feeding into the lexer. More...

#include <Scanner.hpp>

List of all members.

Classes

class  cursor
 Class for maintaining cursor in input stream. More...

Public Member Functions

 Scanner (z::stream &stream)
 Default constructor.
const z::stringgetString () const
 Get current string.
const int & getLine () const
 Get current line number.
const int & getCol () const
 Get current column number.
z::string getToken ()
 Get current token.
Token createToken (const int &id, const z::string &s, const bool &hidden)
 Create token.
Token createToken (const int &id, const bool &hidden)
 Create token.
Token createQuotedToken (const int &id, const bool &hidden)
 Create token, eliminate first and last char, so "xyz" becomes xyz.
Token createTrimmedToken (const int &id, const bool &hidden)
 Create token, eliminate first char, e.g. @id becomes id.

Public Attributes

cursor start
 start cursor
cursor marker
 position marker cursor
cursor end
 end cursor

Private Member Functions

int read ()
 Read one character from the input stream.
int get (const int &pos)
 Get current character that has been read from the input stream.
bool next ()
 Advance input stream.
z::string resetToken ()
 Reset the token data.

Private Attributes

z::stream_stream
 Input stream.
z::queue< int > _queue
 Input queue.
z::string _string
 Current string.
int _ch
 Current character.
int _tokenPos
 Current token position.
int _npos
 Previous position.
int _line
 row number of current character
int _col
 column number of current character read
int _ccol
 column number of start of current token
int _tcol
 column number of start of token

Detailed Description

Class for scanning the input stream and feeding into the lexer.


Constructor & Destructor Documentation

Scanner ( z::stream stream) [inline]

Default constructor.

Parameters:
streamInput stream

Member Function Documentation

Token createQuotedToken ( const int &  id,
const bool &  hidden 
) [inline]

Create token, eliminate first and last char, so "xyz" becomes xyz.

Parameters:
idID for token
hiddenTrue if this is a hidden token
Returns:
Token with current string
Token createToken ( const int &  id,
const z::string s,
const bool &  hidden 
) [inline]

Create token.

Parameters:
idID fo rtoken
sToken string
hiddenTrue if this is a hidden token
Returns:
Token with current string
Token createToken ( const int &  id,
const bool &  hidden 
) [inline]

Create token.

Parameters:
idID for token
hiddenTrue if this is a hidden token
Returns:
Token with current string
Token createTrimmedToken ( const int &  id,
const bool &  hidden 
) [inline]

Create token, eliminate first char, e.g. @id becomes id.

Parameters:
idID for token
hiddenTrue if this is a hidden token
Returns:
Token with current string
int get ( const int &  pos) [inline, private]

Get current character that has been read from the input stream.

Parameters:
posThe current position
Returns:
The current character
const int& getCol ( ) const [inline]

Get current column number.

Returns:
Current column number
const int& getLine ( ) const [inline]

Get current line number.

Returns:
Current line number
const z::string& getString ( ) const [inline]

Get current string.

Returns:
Current string
z::string getToken ( ) [inline]

Get current token.

Returns:
Current token string
bool next ( ) [inline, private]

Advance input stream.

Returns:
True if success, false if EOF
int read ( ) [inline, private]

Read one character from the input stream.

Returns:
The read character
z::string resetToken ( ) [inline, private]

Reset the token data.

Returns:
Current token

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines