Class for native "cooked" text-format token input.
Public Member Functions | |
Constructors etc. | |
TokenReaderNative (int fmt=tiofWellDone, const std::string &name="TokenReaderNative") | |
virtual | ~TokenReaderNative (void) |
Input Selection | |
virtual void | from_mstream (mootio::mistream *mis) |
Overrides | |
virtual mootTokenType | get_token (void) |
virtual mootTokenType | get_sentence (void) |
Diagnostics | |
virtual size_t | line_number (void) |
virtual size_t | line_number (size_t n) |
virtual size_t | column_number (void) |
virtual size_t | column_number (size_t n) |
virtual mootio::ByteOffset | byte_number (void) |
virtual mootio::ByteOffset | byte_number (mootio::ByteOffset n) |
New Methods | |
bool | input_is_tagged (void) |
bool | input_is_tagged (bool is_tagged) |
bool | input_has_locations (void) |
bool | input_has_locations (bool has_locs) |
bool | input_has_cost (void) |
bool | input_has_cost (bool has_cost) |
Public Member Functions inherited from moot::TokenReader | |
TokenReader (int fmt=tiofUnknown, const std::string &name="TokenReader") | |
virtual | ~TokenReader (void) |
void | tr_clear (void) |
virtual void | from_mstream (mootio::mistream &mis) |
virtual void | from_filename (const char *filename) |
virtual void | from_file (FILE *file) |
virtual void | from_fd (int fd) |
virtual void | from_buffer (const void *buf, size_t len) |
virtual void | from_string (const char *s) |
virtual void | from_cxxstream (std::istream &is) |
virtual void | close (void) |
virtual bool | opened (void) |
mootToken * | token (void) |
mootSentence * | sentence (void) |
virtual void | reader_name (const std::string &myname) |
virtual mootio::ByteOffset | byte_number (size_t n) |
virtual void | carp (const char *fmt,...) |
Public Attributes | |
mootTokenLexer | lexer |
mootSentence | trn_sentence |
Public Attributes inherited from moot::TokenReader | |
int | tr_format |
std::string | tr_name |
mootio::mistream * | tr_istream |
bool | tr_istream_created |
mootToken * | tr_token |
mootSentence * | tr_sentence |
void * | tr_data |
Additional Inherited Members | |
Static Public Member Functions inherited from moot::TokenIO | |
static int | parse_format_string (const std::string &fmtString) |
static int | guess_filename_format (const char *filename) |
static bool | is_empty_format (int fmt) |
static int | sanitize_format (int fmt, int fmt_implied=tiofNone, int fmt_default=tiofNone) |
static int | parse_format_request (const char *request, const char *filename=__null, int fmt_implied=tiofNone, int fmt_default=tiofNone) |
static std::string | format_canonical_string (int fmt) |
static class TokenReader * | new_reader (int fmt) |
static class TokenWriter * | new_writer (int fmt) |
static class TokenReader * | file_reader (const char *filename, const char *fmt_request=__null, int fmt_implied=tiofNone, int fmt_default=tiofNone) |
static class TokenWriter * | file_writer (const char *filename, const char *fmt_request=__null, int fmt_implied=tiofNone, int fmt_default=tiofNone) |
static size_t | pipe_tokens (class TokenReader *reader, class TokenWriter *writer) |
static size_t | pipe_sentences (class TokenReader *reader, class TokenWriter *writer) |
Static Public Attributes inherited from moot::TokenReader | |
static const size_t | TR_DEFAULT_BUFSIZE = 256 |
|
inline |
Default constructor
fmt | bitmask of moot::TokenIOFormat flags. |
name | name of input source, for diagnostics. |
References mootTokenLexer::mtoken_default, moot::tiofCost, moot::tiofLocation, moot::tiofNative, moot::tiofTagged, and moot::GenericLexer::to_file().
|
inlinevirtual |
Default destructor
|
virtual |
Select input from a mootio::mstream object.
Reimplemented from moot::TokenReader.
|
virtual |
Get the next token from the buffer. On completion, current token (if any) is in *tr_token. Descendants must override this method.
Reimplemented from moot::TokenReader.
|
virtual |
Read in next sentence. On completion, current sentence (if any) is in *tr_sentence. Descendants may override this method for sentence-wise input.
Reimplemented from moot::TokenReader.
|
inlinevirtual |
Get current line number.
Reimplemented from moot::TokenReader.
References moot::GenericLexer::theLine.
|
inlinevirtual |
Set current line number.
Reimplemented from moot::TokenReader.
References moot::GenericLexer::theLine.
|
inlinevirtual |
Get current column number.
Reimplemented from moot::TokenReader.
References moot::GenericLexer::theColumn.
|
inlinevirtual |
Set current column number.
Reimplemented from moot::TokenReader.
References moot::GenericLexer::theColumn.
|
inlinevirtual |
Get current byte offset.
Reimplemented from moot::TokenReader.
References moot::GenericLexer::theByte.
|
inlinevirtual |
Set current byte offset.
References moot::GenericLexer::theByte.
|
inline |
Get value of the 'tagged' flag : whether we think the input has been tagged with initial best-tags.
References mootTokenLexer::first_analysis_is_best.
|
inline |
Set value of the 'tagged' flag: whether we think the input has been tagged with initial best-tags.
References mootTokenLexer::first_analysis_is_best, mootTokenLexer::ignore_first_analysis, and moot::tiofTagged.
|
inline |
Get value of the 'locations' flag : whether we think the input has been marked with 'offset length' pairs.
References mootTokenLexer::parse_location.
|
inline |
Set value of the 'locations' flag: whether we think the input has been marked with 'offset length' pairs.
References mootTokenLexer::parse_location, and moot::tiofLocation.
|
inline |
Get value of the 'cost' flag : whether we want to parse analysis costs (prob field) from input stream
References mootTokenLexer::parse_analysis_cost.
|
inline |
Set value of the 'cost' flag: whether we want to parse analysis costs (prob field) from input stream
References mootTokenLexer::analysis_cost_details, mootTokenLexer::parse_analysis_cost, and moot::tiofCost.
mootTokenLexer moot::TokenReaderNative::lexer |
The underlying lexer (does the dirty work).
mootSentence moot::TokenReaderNative::trn_sentence |
Default construction buffer for get_sentence()