40 #ifndef __EST_TOKEN_H__ 41 #define __EST_TOKEN_H__ 91 void init() {p_quoted=linenum=linepos=p_filepos=0;}
131 int Int(
bool &valid)
const {
return String().Int(valid); }
133 int I(
bool &valid)
const {
return Int(valid); }
134 int I()
const {
return Int(); }
140 long Long(
bool &valid)
const {
return String().Long(valid); }
142 long L(
bool &valid)
const {
return Long(valid); }
144 operator long()
const {
return Long(); }
151 float F(
bool &valid)
const {
return Float(valid); }
153 operator float()
const {
return Float(); }
160 double D(
bool &valid)
const {
return Double(valid); }
162 operator double()
const {
return Double(); }
185 int row(
void)
const {
return linenum; }
187 int col(
void)
const {
return linepos; }
266 void default_values(
void);
293 inline int getch_internal();
294 inline int peekch_internal();
295 inline int getpeeked_internal();
305 int open(FILE *ofp,
int close_when_finished);
307 int open(std::istream &newis);
323 {
return must_get(expected, &ok); }
325 {
return must_get(expected, (
bool *)
NULL); }
333 {
if (!peeked_tokp)
get();
334 peeked_tokp =
TRUE;
return current_tok; }
342 { WhiteSpaceChars = ws; p_table_wrong=1;}
345 { SingleCharSymbols = sc; p_table_wrong=1;}
348 { PunctuationSymbols = ps; p_table_wrong=1;}
351 { PrePunctuationSymbols = ps; p_table_wrong=1;}
353 void set_quotes(
char q,
char e) { quotes =
TRUE; quote = q; escape = e; p_table_wrong=1;}
363 {
return (eof_flag || ((!quotes) && (peek() ==
""))); }
371 int seek(
int position);
397 #endif // __EST_TOKEN_H__ void set_WhiteSpaceChars(const EST_String &ws)
set which characters are to be treated as whitespace
int row(void) const
Line number in original EST_TokenStream.
const EST_String EST_Token_Default_SingleCharSymbols
EST_Token(const EST_String p)
float F(bool &valid) const
EST_FilePos filepos(void) const
file position in original EST_TokenStream.
const EST_String EST_Token_Default_PrePunctuationSymbols
FILE * filedescriptor()
For the people who need the actual description (if possible)
EST_String quote_string(const EST_String &s, const EST_String "e="\"", const EST_String &escape="\\", int force=0)
const EST_String pos_description() const
A string describing current position, suitable for error messages.
void set_token(const char *p)
const EST_String & punctuation()
void set_filepos(EST_FilePos c)
Set file position in original EST_TokenStream.
const EST_String EST_Token_Default_PunctuationSymbols
void set_prepunctuation(const EST_String &p)
set prepunction
EST_String lstring()
Return lower case version of token name.
void set_SingleCharSymbols(const EST_String &sc)
set which characters are to be treated as single character symbols
long L(bool &valid) const
void set_punctuation(const char *p)
const EST_String filename() const
The originating filename (if there is one)
EST_FilePos tell(void) const
tell, synonym for filepos
const EST_String & whitespace()
int quoted() const
TRUE is token was quoted.
int quoted_mode(void)
query quote mode
void set_punctuation(const EST_String &p)
set (post) punctuation of token.
EST_String upcase(const EST_String &s)
void set_PrePunctuationSymbols(const EST_String &ps)
set which characters are to be treated as (post) punctuation
EST_Token & must_get(EST_String expected, bool &ok)
void set_PunctuationSymbols(const EST_String &ps)
set which characters are to be treated as (post) punctuation
void set_token(const EST_String &p)
set token from a string
EST_String downcase(const EST_String &s)
const EST_String & prepunctuation()
void set_prepunctuation(const char *p)
int linenum(void) const
returns line number of EST_TokenStream
const EST_String & S() const
Access token as a string.
int operator==(const EST_String &a)
EST_Token & operator=(const EST_Token &a)
#define EST_WARN_UNUSED_RESULT
long Long(bool &valid) const
int col(void) const
Line position in original EST_TokenStream.
EST_Token & peek(void)
peek at next token
EST_String ustring()
Return upper case version of token name.
void set_quotes(char q, char e)
set characters to be used as quotes and escape, and set quote mode
int operator!=(const EST_String &a)
EST_FilePos filepos(void) const
current file position in EST_TokenStream
double D(bool &valid) const
const EST_String & string() const
FILE16 *(* open)(const char *, const char *, int, const char *, const char *)
const EST_String & String() const
Access token as a string.
void set_whitespace(const char *p)
const EST_String EST_Token_Default_WhiteSpaceChars
The default whitespace characters.
float Float(bool &valid) const
int Int(bool &valid) const
void set_whitespace(const EST_String &p)
set whitespace of token.
EST_Token & must_get(EST_String expected)
friend std::ostream & operator<<(std::ostream &s, const EST_Token &p)
void set_quoted(int q)
Note that this token was quoted (or not)
double Double(bool &valid) const