Edinburgh Speech Tools 2.4-release
EST_Token Class Reference

#include <include/EST_Token.h>

Public Member Functions

 EST_Token (const EST_String p)
 
void init ()
 
Basic access to fields
void set_token (const EST_String &p)
 set token from a string More...
 
void set_token (const char *p)
 
void set_whitespace (const EST_String &p)
 set whitespace of token. More...
 
void set_whitespace (const char *p)
 
void set_punctuation (const EST_String &p)
 set (post) punctuation of token. More...
 
void set_punctuation (const char *p)
 
void set_prepunctuation (const EST_String &p)
 set prepunction More...
 
void set_prepunctuation (const char *p)
 
const EST_Stringwhitespace ()
 
const EST_Stringpunctuation ()
 
const EST_Stringprepunctuation ()
 
Access token as a string
const EST_Stringstring () const
 
const EST_StringS () const
 Access token as a string. More...
 
const EST_StringString () const
 Access token as a string. More...
 
 operator EST_String () const
 For automatic coercion to \Ref{EST_String}. More...
 
Access token as a int
int Int (bool &valid) const
 
int Int () const
 
int I (bool &valid) const
 
int I () const
 
 operator int () const
 
Access token as a long
long Long (bool &valid) const
 
long Long () const
 
long L (bool &valid) const
 
long L () const
 
 operator long () const
 
Access token as a float
float Float (bool &valid) const
 
float Float () const
 
float F (bool &valid) const
 
float F () const
 
 operator float () const
 

Access token as a double

double Double (bool &valid) const
 
double Double () const
 
double D (bool &valid) const
 
double D () const
 
 operator double () const
 
void set_quoted (int q)
 Note that this token was quoted (or not) More...
 
int quoted () const
 TRUE is token was quoted. More...
 
void set_row (int r)
 
void set_col (int c)
 
void set_filepos (int c)
 Set file position in original \Ref{EST_TokenStream}. More...
 
EST_String lstring ()
 Return lower case version of token name. More...
 
EST_String ustring ()
 Return upper case version of token name. More...
 
int row (void) const
 Line number in original \Ref{EST_TokenStream}. More...
 
int col (void) const
 Line position in original \Ref{EST_TokenStream}. More...
 
int filepos (void) const
 file position in original \Ref{EST_TokenStream}. More...
 
const EST_String pos_description () const
 A string describing current position, suitable for error messages. More...
 
EST_Tokenoperator= (const EST_Token &a)
 
EST_Tokenoperator= (const EST_String &a)
 
int operator== (const EST_String &a)
 
int operator!= (const EST_String &a)
 
int operator== (const char *a)
 
int operator!= (const char *a)
 
ostream & operator<< (ostream &s, const EST_Token &p)
 

Detailed Description

This class is similar to \Ref{EST_String} but also maintains the original punctuation and whitespace found around the token.

\Ref{EST_Token}'s primary use is with \Ref{EST_TokenStream} class which allows easy tokenizing of ascii files.

A token consists of four parts, any of which may be empty: a name, the actual token, preceding whitespace, preceding punctuation, the name and succeeding punctuation.

Author
Alan W Black (awb@c.nosp@m.str..nosp@m.ed.ac.nosp@m..uk): April 1996

Definition at line 73 of file EST_Token.h.

Constructor & Destructor Documentation

◆ EST_Token() [1/2]

EST_Token::EST_Token ( )
inline

Definition at line 86 of file EST_Token.h.

◆ EST_Token() [2/2]

EST_Token::EST_Token ( const EST_String  p)
inline

Definition at line 88 of file EST_Token.h.

Member Function Documentation

◆ init()

void EST_Token::init ( void  )
inline

Definition at line 90 of file EST_Token.h.

◆ set_token() [1/2]

void EST_Token::set_token ( const EST_String p)
inline

set token from a string

Definition at line 95 of file EST_Token.h.

◆ set_token() [2/2]

void EST_Token::set_token ( const char *  p)
inline

Definition at line 97 of file EST_Token.h.

◆ set_whitespace() [1/2]

void EST_Token::set_whitespace ( const EST_String p)
inline

set whitespace of token.

Definition at line 99 of file EST_Token.h.

◆ set_whitespace() [2/2]

void EST_Token::set_whitespace ( const char *  p)
inline

Definition at line 101 of file EST_Token.h.

◆ set_punctuation() [1/2]

void EST_Token::set_punctuation ( const EST_String p)
inline

set (post) punctuation of token.

Definition at line 103 of file EST_Token.h.

◆ set_punctuation() [2/2]

void EST_Token::set_punctuation ( const char *  p)
inline

Definition at line 105 of file EST_Token.h.

◆ set_prepunctuation() [1/2]

void EST_Token::set_prepunctuation ( const EST_String p)
inline

set prepunction

Definition at line 107 of file EST_Token.h.

◆ set_prepunctuation() [2/2]

void EST_Token::set_prepunctuation ( const char *  p)
inline

Definition at line 109 of file EST_Token.h.

◆ whitespace()

const EST_String & EST_Token::whitespace ( )
inline

Definition at line 111 of file EST_Token.h.

◆ punctuation()

const EST_String & EST_Token::punctuation ( )
inline

Definition at line 113 of file EST_Token.h.

◆ prepunctuation()

const EST_String & EST_Token::prepunctuation ( )
inline

Definition at line 115 of file EST_Token.h.

◆ string()

const EST_String & EST_Token::string ( ) const
inline

Definition at line 119 of file EST_Token.h.

◆ S()

const EST_String & EST_Token::S ( ) const
inline

Access token as a string.

Definition at line 121 of file EST_Token.h.

◆ String()

const EST_String & EST_Token::String ( ) const
inline

Access token as a string.

Definition at line 123 of file EST_Token.h.

◆ operator EST_String()

EST_Token::operator EST_String ( ) const
inline

For automatic coercion to \Ref{EST_String}.

Definition at line 125 of file EST_Token.h.

◆ Int() [1/2]

int EST_Token::Int ( bool &  valid) const
inline

Definition at line 130 of file EST_Token.h.

◆ Int() [2/2]

int EST_Token::Int ( void  ) const
inline

Definition at line 131 of file EST_Token.h.

◆ I() [1/2]

int EST_Token::I ( bool &  valid) const
inline

Definition at line 132 of file EST_Token.h.

◆ I() [2/2]

int EST_Token::I ( ) const
inline

Definition at line 133 of file EST_Token.h.

◆ operator int()

EST_Token::operator int ( ) const
inline

Definition at line 134 of file EST_Token.h.

◆ Long() [1/2]

long EST_Token::Long ( bool &  valid) const
inline

Definition at line 139 of file EST_Token.h.

◆ Long() [2/2]

long EST_Token::Long ( void  ) const
inline

Definition at line 140 of file EST_Token.h.

◆ L() [1/2]

long EST_Token::L ( bool &  valid) const
inline

Definition at line 141 of file EST_Token.h.

◆ L() [2/2]

long EST_Token::L ( ) const
inline

Definition at line 142 of file EST_Token.h.

◆ operator long()

EST_Token::operator long ( ) const
inline

Definition at line 143 of file EST_Token.h.

◆ Float() [1/2]

float EST_Token::Float ( bool &  valid) const
inline

Definition at line 148 of file EST_Token.h.

◆ Float() [2/2]

float EST_Token::Float ( void  ) const
inline

Definition at line 149 of file EST_Token.h.

◆ F() [1/2]

float EST_Token::F ( bool &  valid) const
inline

Definition at line 150 of file EST_Token.h.

◆ F() [2/2]

float EST_Token::F ( ) const
inline

Definition at line 151 of file EST_Token.h.

◆ operator float()

EST_Token::operator float ( ) const
inline

Definition at line 152 of file EST_Token.h.

◆ Double() [1/2]

double EST_Token::Double ( bool &  valid) const
inline

Definition at line 157 of file EST_Token.h.

◆ Double() [2/2]

double EST_Token::Double ( void  ) const
inline

Definition at line 158 of file EST_Token.h.

◆ D() [1/2]

double EST_Token::D ( bool &  valid) const
inline

Definition at line 159 of file EST_Token.h.

◆ D() [2/2]

double EST_Token::D ( ) const
inline

Definition at line 160 of file EST_Token.h.

◆ operator double()

EST_Token::operator double ( ) const
inline

Definition at line 161 of file EST_Token.h.

◆ set_quoted()

void EST_Token::set_quoted ( int  q)
inline

Note that this token was quoted (or not)

Definition at line 167 of file EST_Token.h.

◆ quoted()

int EST_Token::quoted ( ) const
inline

TRUE is token was quoted.

Definition at line 169 of file EST_Token.h.

◆ set_row()

void EST_Token::set_row ( int  r)
inline

Definition at line 172 of file EST_Token.h.

◆ set_col()

void EST_Token::set_col ( int  c)
inline

Definition at line 174 of file EST_Token.h.

◆ set_filepos()

void EST_Token::set_filepos ( int  c)
inline

Set file position in original \Ref{EST_TokenStream}.

Definition at line 176 of file EST_Token.h.

◆ lstring()

EST_String EST_Token::lstring ( )
inline

Return lower case version of token name.

Definition at line 178 of file EST_Token.h.

◆ ustring()

EST_String EST_Token::ustring ( )
inline

Return upper case version of token name.

Definition at line 180 of file EST_Token.h.

◆ row()

int EST_Token::row ( void  ) const
inline

Line number in original \Ref{EST_TokenStream}.

Definition at line 182 of file EST_Token.h.

◆ col()

int EST_Token::col ( void  ) const
inline

Line position in original \Ref{EST_TokenStream}.

Definition at line 184 of file EST_Token.h.

◆ filepos()

int EST_Token::filepos ( void  ) const
inline

file position in original \Ref{EST_TokenStream}.

Definition at line 186 of file EST_Token.h.

◆ pos_description()

const EST_String EST_Token::pos_description ( ) const

A string describing current position, suitable for error messages.

Definition at line 107 of file EST_Token.cc.

◆ operator=() [1/2]

EST_Token & EST_Token::operator= ( const EST_Token a)

Definition at line 94 of file EST_Token.cc.

◆ operator=() [2/2]

EST_Token & EST_Token::operator= ( const EST_String a)

Definition at line 112 of file EST_Token.cc.

◆ operator==() [1/2]

int EST_Token::operator== ( const EST_String a)
inline

Definition at line 199 of file EST_Token.h.

◆ operator!=() [1/2]

int EST_Token::operator!= ( const EST_String a)
inline

Definition at line 201 of file EST_Token.h.

◆ operator==() [2/2]

int EST_Token::operator== ( const char *  a)
inline

Definition at line 203 of file EST_Token.h.

◆ operator!=() [2/2]

int EST_Token::operator!= ( const char *  a)
inline

Definition at line 205 of file EST_Token.h.

Friends And Related Function Documentation

◆ operator<<

ostream & operator<< ( ostream &  s,
const EST_Token p 
)
friend

Definition at line 87 of file EST_Token.cc.


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