Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Token Class Reference

#include <Token.h>

List of all members.

Public Types

enum  Types {
  Undefined, Keyword, AlphaIdent, SymbolicIdent,
  Comment, IntLiteral, FloatLiteral, StringLiteral,
  CharLiteral, Dot, Comma, Colon,
  Semicolon, LParen, RParen, LBracket,
  RBracket, LBrace, RBrace, EOT,
  LastTokenType
}
enum  Alias {
  CompoundSeparator = Dot, ItemSeparator = Comma, StatementTerminator = Semicolon, TypeIndicator = Colon,
  Lambda = LastTokenType + 1
}

Public Member Functions

 Token ()
 Token (const Token &rhs)
 Token (int t)
 Token (const char *s, int t, int k=0, int l=0, int c=0)
 Token (const Text &s, int t, int k=0, int l=0, int c=0)
 ~Token ()
Tokenoperator= (const Token &rhs)
bool match (const Token &ref) const
Text symbol () const
int type () const
int key () const
int line () const
int column () const
Text typestr () const

Static Public Member Functions

static Text describe (const Text &tok)
static void addKey (const Text &k, int v)
static void addKeys (Dictionary< int > &keys)
static bool findKey (const Text &k, int &v)
static void comments (const Text &begin, const Text &end)
static void altComments (const Text &begin, const Text &end)
static void hideComments (bool hide=true)
static char comBeg (unsigned int i)
static char comEnd (unsigned int i)
static char altBeg (unsigned int i)
static char altEnd (unsigned int i)
static void close ()

Protected Attributes

int mLength
union {
   char   mSymbol [8]
   char *   mFullSymbol
}; 
int mType
int mKey
int mLine
int mColumn

Static Protected Attributes

static bool hidecom = true
static char combeg [3] = "//"
static char comend [3] = "\n"
static char altbeg [3] = "/*"
static char altend [3] = "*/"
static Dictionary< int > keymap

Friends

class Scanner

Detailed Description

Definition at line 31 of file Token.h.


Member Enumeration Documentation

Enumerator:
CompoundSeparator 
ItemSeparator 
StatementTerminator 
TypeIndicator 
Lambda 

Definition at line 43 of file Token.h.

Enumerator:
Undefined 
Keyword 
AlphaIdent 
SymbolicIdent 
Comment 
IntLiteral 
FloatLiteral 
StringLiteral 
CharLiteral 
Dot 
Comma 
Colon 
Semicolon 
LParen 
RParen 
LBracket 
RBracket 
LBrace 
RBrace 
EOT 
LastTokenType 

Definition at line 37 of file Token.h.


Constructor & Destructor Documentation

Token::Token ( )

Definition at line 33 of file Token.cpp.

Token::Token ( const Token rhs)

Definition at line 40 of file Token.cpp.

Token::Token ( int  t)

Definition at line 53 of file Token.cpp.

Token::Token ( const char *  s,
int  t,
int  k = 0,
int  l = 0,
int  c = 0 
)

Definition at line 60 of file Token.cpp.

Token::Token ( const Text s,
int  t,
int  k = 0,
int  l = 0,
int  c = 0 
)

Definition at line 73 of file Token.cpp.

Token::~Token ( )

Definition at line 86 of file Token.cpp.


Member Function Documentation

void Token::addKey ( const Text k,
int  v 
)
static

Definition at line 163 of file Token.cpp.

void Token::addKeys ( Dictionary< int > &  keys)
static

Definition at line 171 of file Token.cpp.

static char Token::altBeg ( unsigned int  i)
inlinestatic

Definition at line 78 of file Token.h.

void Token::altComments ( const Text begin,
const Text end 
)
static

Definition at line 208 of file Token.cpp.

static char Token::altEnd ( unsigned int  i)
inlinestatic

Definition at line 79 of file Token.h.

void Token::close ( )
static

Definition at line 95 of file Token.cpp.

int Token::column ( ) const
inline

Definition at line 64 of file Token.h.

static char Token::comBeg ( unsigned int  i)
inlinestatic

Definition at line 76 of file Token.h.

static char Token::comEnd ( unsigned int  i)
inlinestatic

Definition at line 77 of file Token.h.

void Token::comments ( const Text begin,
const Text end 
)
static

Definition at line 194 of file Token.cpp.

Text Token::describe ( const Text tok)
static

Definition at line 255 of file Token.cpp.

bool Token::findKey ( const Text k,
int &  v 
)
static

Definition at line 181 of file Token.cpp.

static void Token::hideComments ( bool  hide = true)
inlinestatic

Definition at line 74 of file Token.h.

int Token::key ( ) const
inline

Definition at line 62 of file Token.h.

int Token::line ( ) const
inline

Definition at line 63 of file Token.h.

bool Token::match ( const Token ref) const

Definition at line 128 of file Token.cpp.

Token & Token::operator= ( const Token rhs)

Definition at line 103 of file Token.cpp.

Text Token::symbol ( ) const

Definition at line 152 of file Token.cpp.

int Token::type ( ) const
inline

Definition at line 61 of file Token.h.

Text Token::typestr ( ) const

Definition at line 222 of file Token.cpp.


Friends And Related Function Documentation

friend class Scanner
friend

Definition at line 33 of file Token.h.


Member Data Documentation

union { ... }
char Token::altbeg = "/*"
staticprotected

Definition at line 97 of file Token.h.

char Token::altend = "*/"
staticprotected

Definition at line 98 of file Token.h.

char Token::combeg = "//"
staticprotected

Definition at line 95 of file Token.h.

char Token::comend = "\n"
staticprotected

Definition at line 96 of file Token.h.

bool Token::hidecom = true
staticprotected

Definition at line 94 of file Token.h.

Dictionary< int > Token::keymap
staticprotected

Definition at line 100 of file Token.h.

int Token::mColumn
protected

Definition at line 92 of file Token.h.

char* Token::mFullSymbol

Definition at line 87 of file Token.h.

int Token::mKey
protected

Definition at line 90 of file Token.h.

int Token::mLength
protected

Definition at line 84 of file Token.h.

int Token::mLine
protected

Definition at line 91 of file Token.h.

char Token::mSymbol[8]

Definition at line 86 of file Token.h.

int Token::mType
protected

Definition at line 89 of file Token.h.


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