NEST  2.6.0,not_revisioned_source_dir@0
Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
Scanner Class Reference

#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
 

Member Enumeration Documentation

enum Scanner::Codes
private
Enumerator
invalid 
whitespace 
eof 
digit 
null 
expntl 
decpoint 
plus 
minus 
openbracket 
closebracket 
openbrace 
closebrace 
openparenth 
closeparenth 
alpha 
slash 
backslash 
newline 
tabulator 
asterisk 
percent 
eoln 
other 
lastcode 
enum Scanner::ScanStates
private
Enumerator
start 
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 

Constructor & Destructor Documentation

Scanner::Scanner ( std::istream *  is)

Member Function Documentation

void Scanner::clear_context ( )
inline

References col, context, line, and old_context.

Referenced by Parser::clear_context().

int Scanner::digval ( unsigned char  c) const
inlineprivate

Referenced by operator()().

unsigned long Scanner::get_col ( ) const
inline

Return position in current line in input stream.

References col.

unsigned long Scanner::get_line ( ) const
inline

Return current line number in input stream.

References line.

std::istream* Scanner::GetSource ( void  )
inline

Return input stream.

References in.

bool Scanner::operator() ( Token t)
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().

Member Data Documentation

SymbolDatum Scanner::BeginArraySymbol

Referenced by Parser::operator()(), and operator()().

SymbolDatum Scanner::BeginProcedureSymbol

Referenced by Parser::operator()(), and operator()().

CharCode Scanner::code
private

Referenced by operator()(), and Scanner().

unsigned long Scanner::col
private

Current column in line.

Referenced by clear_context(), get_col(), operator()(), print_error(), and source().

std::string Scanner::context
private

Current context.

Referenced by clear_context(), operator()(), print_error(), and source().

const unsigned char Scanner::cr
private

Referenced by Scanner().

SymbolDatum Scanner::EndArraySymbol

Referenced by Parser::operator()(), and operator()().

const unsigned char Scanner::endof
private

Referenced by operator()(), and Scanner().

const unsigned char Scanner::endoln
private

Referenced by operator()(), and Scanner().

SymbolDatum Scanner::EndProcedureSymbol

Referenced by Parser::operator()(), and operator()().

SymbolDatum Scanner::EndSymbol
std::istream* Scanner::in
private

Referenced by GetSource(), operator()(), and source().

unsigned long Scanner::line
private

Current line number.

Referenced by clear_context(), get_line(), operator()(), print_error(), and source().

std::string Scanner::old_context
private
const unsigned char Scanner::space
private

Referenced by Scanner().

const unsigned char Scanner::tab
private

Referenced by Scanner().

enum ScanStates Scanner::trans[lastscanstate][lastcode]
private

Referenced by operator()(), and Scanner().


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