Rapicorn - Experimental UI Toolkit - Source Code  13.07.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Public Member Functions | Public Attributes
aidacc.yapps2runtime.Scanner Class Reference

List of all members.

Public Member Functions

def __init__
def stack_input
def get_pos
def print_line_with_pointer
def grab_input
def getchar
def token
def peek
def scan

Public Attributes

 input
 ignore
 file
 filename
 pos
 del_pos
 line
 del_line
 col
 tokens
 stack
 stacked
 last_read_token
 last_token
 last_types
 patterns

Detailed Description

Yapps scanner.

The Yapps scanner can work in context sensitive or context
insensitive modes.  The token(i) method is used to retrieve the
i-th token.  It takes a restrict set that limits the set of tokens
it is allowed to return.  In context sensitive mode, this restrict
set guides the scanner.  In context insensitive mode, there is no
restriction (the set is always the full set of tokens).


Constructor & Destructor Documentation

def aidacc.yapps2runtime.Scanner.__init__ (   self,
  patterns,
  ignore,
  input = "",
  file = None,
  filename = None,
  stacked = False 
)
Initialize the scanner.

Parameters:
  patterns : [(terminal, uncompiled regex), ...] or None
  ignore : {terminal:None, ...}
  input : string

If patterns is None, we assume that the subclass has
defined self.patterns : [(terminal, compiled regex), ...].
Note that the patterns parameter expects uncompiled regexes,
whereas the self.patterns field expects compiled regexes.

The 'ignore' value is either None or a callable, which is called
with the scanner and the to-be-ignored match object; this can
be used for include file or comment handling.

Member Function Documentation

Return a file/line/char tuple.
Return the next character.
Get more input if possible.
def aidacc.yapps2runtime.Scanner.peek (   self,
  types,
  kw 
)
Returns the token type for lookahead; if there are any args
then the list of args is the set of token types to allow
def aidacc.yapps2runtime.Scanner.print_line_with_pointer (   self,
  pos,
  length = 0,
  out = sys.stderr 
)
Print the line of 'text' that includes position 'p',
along with a second line with a single caret (^) at position p
def aidacc.yapps2runtime.Scanner.scan (   self,
  type,
  kw 
)
Returns the matched text, and moves to the next token
def aidacc.yapps2runtime.Scanner.stack_input (   self,
  input = "",
  file = None,
  filename = None 
)
Temporarily parse from a second file.
def aidacc.yapps2runtime.Scanner.token (   self,
  restrict,
  context = None 
)
Scan for another token.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines