#include <sreader.hpp>
Inheritance diagram for IntelibReader:
This object differs from IntelibGenericReader only in the constructor, which sets up the reader to recognize the parentheses, the dot, the double-quotes, the character escapes and the comment.
Definition at line 252 of file sreader.hpp.
Public Types | |
typedef SReference(* | process_function )(SReference &) |
A function used to process some syntax constructs. | |
Public Member Functions | |
IntelibReader () | |
void | AddDelimiter (char *str, SReference &tok) |
lexem to be considered a delimiter in itself | |
void | AddToken (char *str, SReference &tok) |
lexem that isn't a delimiter but nevertheless special | |
void | AddTokenType (char *str, SReference(*fun)(char *)) |
lexem to be read until a delimiter, such as : or & | |
void | AddStringLiteral (char *str, int closing_char, SReference(*fun)(char *)=0) |
lexem to be read until a delimiter, such as : or & | |
void | AddQuoter (char *str, process_function proc) |
lexem that modifies the following expression, such as ', #', ` | |
void | AddSequenceOpener (char *str, process_function proc, char *closer, char *cons_sign=0, bool cons_sign_delimiter=false) |
lexem which opens a sequence, such as (, #(, #S( | |
void | AddTailSeparator (char *str, bool is_delimiter=false) |
lexem for separating a cons, such as . in lisp, or | in prolog | |
void | AddComment (char *starter, char *closer="\n") |
comment | |
IntelibPackage * | SetPackage (IntelibPackage *a_package) |
install a package | |
void | SetUppercase (bool u) |
Should the identifiers be converted into the upper case. | |
void | SetLine (int l, SString &afn="") |
Set the fule name and line number information. | |
int | GetLine () |
Get the current line number. | |
SString & | GetFileName () |
Get the current file name. | |
void | FeedChar (int c) |
Pass another character to the reader. | |
void | FeedString (char *s) |
Pass a string to the reader, char by char. | |
void | FeedEof () |
Pass the End Of File condition to the reader. | |
bool | IsEmpty () |
Is the buffer totally empty? | |
bool | IsReady () |
Is there an expression to get? | |
SReference | Get () |
Get the next expression constructed by the reader. | |
void | Drop () |
Drop all the stored information. | |
SReference | Read (SStreamRef &stream) |
Read one expression from the given stream. | |
Static Public Attributes | |
static SLabel & | EofMarker = LexemaEof |
The end of file marker. |
|
A function used to process some syntax constructs.
Definition at line 85 of file sreader.hpp. |
|
Definition at line 448 of file sreader.cpp. References IntelibGenericReader::AddComment(), IntelibGenericReader::AddSequenceOpener(), IntelibGenericReader::AddStringLiteral(), and IntelibGenericReader::AddTokenType(). |
|
lexem to be considered a delimiter in itself
Definition at line 66 of file sreader.cpp. References IntelibSLexAnalyser::AddDelimiter(), IntelibSLexAnalyser::GetErrorMessage(), and INTELIB_ASSERT. Referenced by SchemeReader::SchemeReader(). |
|
lexem that isn't a delimiter but nevertheless special
Definition at line 73 of file sreader.cpp. References IntelibSLexAnalyser::AddNonDelimiter(), IntelibSLexAnalyser::GetErrorMessage(), and INTELIB_ASSERT. |
|
lexem to be read until a delimiter, such as : or &
Definition at line 80 of file sreader.cpp. References IntelibSLexAnalyser::AddTokenStarter(), IntelibSLexAnalyser::GetErrorMessage(), and INTELIB_ASSERT. Referenced by IntelibReader(), and LispReader::LispReader(). |
|
lexem to be read until a delimiter, such as : or &
Definition at line 87 of file sreader.cpp. References IntelibSLexAnalyser::AddStringStarter(), IntelibSLexAnalyser::GetErrorMessage(), and INTELIB_ASSERT. Referenced by IntelibReader(), LispReader::LispReader(), and SchemeReader::SchemeReader(). |
|
lexem that modifies the following expression, such as ', #', `
Definition at line 94 of file sreader.cpp. References IntelibSLexAnalyser::AddDelimiter(), IntelibSLexAnalyser::GetErrorMessage(), and INTELIB_ASSERT. Referenced by LispReader::LispReader(), and SchemeReader::SchemeReader(). |
|
lexem which opens a sequence, such as (, #(, #S(
Definition at line 101 of file sreader.cpp. References IntelibSLexAnalyser::AddDelimiter(), IntelibSLexAnalyser::AddNonDelimiter(), and SReference::GetPtr(). Referenced by IntelibReader(). |
|
lexem for separating a cons, such as . in lisp, or | in prolog
|
|
comment by default, it is a line-based comment; just specify your desired comment closing token to create a block comment Definition at line 149 of file sreader.cpp. References IntelibSLexAnalyser::AddCommentStarter(). Referenced by IntelibReader(). |
|
install a package
Definition at line 158 of file sreader.hpp. |
|
Should the identifiers be converted into the upper case.
Definition at line 166 of file sreader.hpp. |
|
Set the fule name and line number information.
Definition at line 154 of file sreader.cpp. References IntelibSLexAnalyser::SetLine(). |
|
Get the current line number.
Definition at line 160 of file sreader.cpp. References IntelibSLexAnalyser::GetLine(). |
|
Get the current file name.
Definition at line 176 of file sreader.hpp. |
|
Pass another character to the reader.
Definition at line 165 of file sreader.cpp. References IntelibSLexAnalyser::FeedChar(), IntelibSLexAnalyser::Get(), IntelibSLexAnalyser::GetErrorMessage(), IntelibSLexAnalyser::GetLine(), and SString::SString(). Referenced by IntelibGenericReader::FeedEof(), IntelibGenericReader::FeedString(), and IntelibGenericReader::Read(). |
|
Pass a string to the reader, char by char.
Definition at line 188 of file sreader.cpp. References IntelibGenericReader::FeedChar(). |
|
Pass the End Of File condition to the reader.
Definition at line 183 of file sreader.hpp. References IntelibGenericReader::FeedChar(). |
|
Is the buffer totally empty? Returns true if there are neither complete expressions nor incomplete lexem chains stored within the reader. Generally speaking, this can only be true if only whitespace and comments were read so far (or since the last sequence of Get() operations which emptied the buffer, or since the last Drop() operation). Definition at line 193 of file sreader.hpp. References SQueue::IsEmpty(). |
|
Is there an expression to get?
Definition at line 195 of file sreader.hpp. References SQueue::IsEmpty(). Referenced by IntelibGenericReader::Get(), and IntelibGenericReader::Read(). |
|
Get the next expression constructed by the reader. If there's an expression (that is, if IsReady() method returns true), Get() returns the first expression and removes it from the internal buffer. The behaviour is undefined if you call Get() when IsReady() returns false. Definition at line 193 of file sreader.cpp. References SReference::Car(), INTELIB_ASSERT, IntelibGenericReader::IsReady(), and SQueue::RemoveFirst(). Referenced by IntelibGenericReader::Read(). |
|
Drop all the stored information. Both complete expressions and incomplete lexem sequences are dropped, the lexer is reset. This can be useful, for example, if the user decides to cancel the interactive input Definition at line 201 of file sreader.cpp. References IntelibSLexAnalyser::Drop(), and SQueue::RemoveFirst(). |
|
Read one expression from the given stream. Feeds the reader with chars read from the stream until IsReady() returns true, then returns the expression.
Definition at line 209 of file sreader.cpp. References SReference::DynamicCastGetPtr(), EOF, IntelibGenericReader::EofMarker, IntelibGenericReader::FeedChar(), IntelibGenericReader::Get(), IntelibGenericReader::IsReady(), IntelibSLexAnalyser::SetLine(), and SExpressionStreamTextInput::TellLine(). |
|
The end of file marker. The object returned as an expression when the end of file is reached Definition at line 23 of file sreader.cpp. Referenced by IntelibGenericReader::Read(). |