|
NEST
2.6.0,not_revisioned_source_dir@0
|
#include <scanner.h>
Public Member Functions | |
| Scanner (std::istream *) | |
| Initialise scanner with a stream. More... | |
| void | source (std::istream *) |
| Set new input stream. More... | |
| std::istream * | GetSource (void) |
| Return input stream. More... | |
| bool | operator() (Token &) |
| Scan input until the next Token. More... | |
| void | print_error (const char *) |
| Issue an error message. More... | |
| unsigned long | get_line () const |
| Return current line number in input stream. More... | |
| unsigned long | get_col () const |
| Return position in current line in input stream. More... | |
| void | clear_context () |
Public Attributes | |
| SymbolDatum | BeginArraySymbol |
| SymbolDatum | EndArraySymbol |
| SymbolDatum | BeginProcedureSymbol |
| SymbolDatum | EndProcedureSymbol |
| SymbolDatum | EndSymbol |
Private Types | |
| enum | ScanStates { start =0, intdgtst, intexpst, nullst, aheadintst, decpfirstst, decpdgtst, decpointst, fracdgtst, minusst, plusst, aheadsgst, sgalphast, aheadfracst, expntlst, plexpst, mnexpst, openbracketst, closebracketst, openbracest, closebracest, openparst, closeparst, expdigst, dotalphast, alphast, aheadalphst, slashst, literalst, aheadlitst, percentst, whitest, asteriskst, ccommentst, startstringst, stringst, backslashst, newlinest, tabulatorst, backslashcst, oparenthcst, cparenthcst, end, eofst, error, lastscanstate } |
| enum | Codes { invalid =0, whitespace, eof, digit, null, expntl, decpoint, plus, minus, openbracket, closebracket, openbrace, closebrace, openparenth, closeparenth, alpha, slash, backslash, newline, tabulator, asterisk, percent, eoln, other, lastcode } |
Private Member Functions | |
| int | digval (unsigned char c) const |
Private Attributes | |
| std::istream * | in |
| CharCode | code |
| unsigned long | line |
| Current line number. More... | |
| unsigned long | col |
| Current column in line. More... | |
| std::string | context |
| Current context. More... | |
| std::string | old_context |
| enum ScanStates | trans [lastscanstate][lastcode] |
| const unsigned char | space |
| const unsigned char | tab |
| const unsigned char | endoln |
| const unsigned char | cr |
| const unsigned char | endof |
|
private |
|
private |
| Scanner::Scanner | ( | std::istream * | is | ) |
Initialise scanner with a stream.
Scanner (implemented as a DFA)
References aheadalphst, aheadfracst, aheadintst, aheadlitst, aheadsgst, alpha, alphast, asterisk, asteriskst, backslash, backslashcst, backslashst, nest::names::c, ccommentst, closebrace, closebracest, closebracket, closebracketst, closeparenth, closeparst, code, cparenthcst, cr, decpdgtst, decpfirstst, decpoint, decpointst, digit, dotalphast, endof, endoln, eof, eofst, eoln, error, expdigst, expntl, expntlst, fracdgtst, CharCode::Group(), intdgtst, intexpst, invalid, lastcode, lastscanstate, literalst, minus, minusst, mnexpst, newline, newlinest, null, nullst, oparenthcst, openbrace, openbracest, openbracket, openbracketst, openparenth, openparst, percent, percentst, plexpst, plus, plusst, CharCode::Range(), sgalphast, slash, slashst, space, start, startstringst, stringst, tab, tabulator, tabulatorst, trans, and whitespace.
|
inline |
References col, context, line, and old_context.
Referenced by Parser::clear_context().
|
inlineprivate |
Referenced by operator()().
|
inline |
Return position in current line in input stream.
References col.
|
inline |
Return current line number in input stream.
References line.
|
inline |
Return input stream.
References in.
| bool Scanner::operator() | ( | Token & | t | ) |
Scan input until the next Token.
References aheadalphst, aheadfracst, aheadintst, aheadlitst, aheadsgst, alphast, assert(), backslashcst, BeginArraySymbol, BeginProcedureSymbol, nest::names::c, Token::clear(), closebracest, closebracketst, closeparst, code, col, context, cparenthcst, nest::names::d, decpdgtst, decpointst, digval(), dotalphast, numerics::e, end, EndArraySymbol, endof, endoln, EndProcedureSymbol, EndSymbol, eofst, error, expdigst, expntlst, fracdgtst, in, intdgtst, intexpst, line, literalst, minusst, mnexpst, Token::move(), newlinest, old_context, oparenthcst, openbracest, openbracketst, openparst, nest::names::p, plusst, print_error(), sgalphast, start, nest::names::state, stringst, tabulatorst, and trans.
| void Scanner::print_error | ( | const char * | msg | ) |
Issue an error message.
References col, context, line, and old_context.
Referenced by Parser::operator()(), and operator()().
| void Scanner::source | ( | std::istream * | in_s | ) |
Set new input stream.
References col, context, in, line, and old_context.
Referenced by Parser::readSymbol(), and Parser::readToken().
| SymbolDatum Scanner::BeginArraySymbol |
Referenced by Parser::operator()(), and operator()().
| SymbolDatum Scanner::BeginProcedureSymbol |
Referenced by Parser::operator()(), and operator()().
|
private |
Referenced by operator()(), and Scanner().
|
private |
Current column in line.
Referenced by clear_context(), get_col(), operator()(), print_error(), and source().
|
private |
Current context.
Referenced by clear_context(), operator()(), print_error(), and source().
|
private |
Referenced by Scanner().
| SymbolDatum Scanner::EndArraySymbol |
Referenced by Parser::operator()(), and operator()().
|
private |
Referenced by operator()(), and Scanner().
|
private |
Referenced by operator()(), and Scanner().
| SymbolDatum Scanner::EndProcedureSymbol |
Referenced by Parser::operator()(), and operator()().
| SymbolDatum Scanner::EndSymbol |
|
private |
Referenced by GetSource(), operator()(), and source().
|
private |
Current line number.
Referenced by clear_context(), get_line(), operator()(), print_error(), and source().
|
private |
Referenced by clear_context(), operator()(), print_error(), and source().
|
private |
Referenced by Scanner().
|
private |
Referenced by Scanner().
|
private |
Referenced by operator()(), and Scanner().
1.8.7