HappyDoc Generated Documentation Class: Parser

. / chimera / oslParser.py / Parser 

Methods   
  __checkValue 
__checkValue (
        self,
        key,
        attr,
        op,
        s,
        )

__checkValue Add code to test an attribute against a constant

  __tab 
__tab ( self,  key )

__tab Indent to the proper level

  __insertAbbrev 
__insertAbbrev (
        self,
        key,
        depth,
        abbr,
        )

__insertAbbrev Insert a test for an abbreviation into the output code Note that we call __insertTest to do all the hard work

  __parseAndList 
__parseAndList ( self )

__parseAndList Parse the "and" list of qualifier expressions

  __parseOrList 
__parseOrList ( self )

__parseOrList The qualifier expression can have "or" and "and" conjunctions We define "and" as having higher precedence than "or", so we parse the "or" list higher

  __addCond 
__addCond ( self,  s )

__addCond Add code for condition of current test

  __checkDefined 
__checkDefined (
        self,
        key,
        attr,
        present=None,
        )

__checkDefined Add code to test if an attribute is defined

  __beginCond 
__beginCond ( self )

__beginCond Prepare to create the conditional part of a selection test We create a StringIO object to store any generated code

  __insertTest 
__insertTest ( self,  cond )

__insertTest Insert a test into the output code Since we are inserting an if statement, we adjust the indentation level of all objects that we contain to match the indentation level of this test

  __parseTest 
__parseTest ( self )

__parseTest Each "and" list consists of a series of actual conditions A condition may be simply the name of an attribute, which tests for the presence of the attribute (a preceding ! negates the test) It may also be a name and a constant, separated by an operator, which tests the attribute against a fixed value Finally, a test may be a parenthesized expression as well

Exceptions   

SyntaxError, ('expected close parenthesis', ( '', 1, self.__token [ 'start' ], self.input ) )
SyntaxError, ('expected identifier', ( '', 1, self.__token [ 'start' ], self.input ) )
SyntaxError, ('unexpected operator', ( '', 1, self.__token [ 'start' ], self.input ) )
SyntaxError, ('unexpected token', ( '', 1, self.__token [ 'start' ], self.input ) )

  __nextToken 
__nextToken ( self,  mode )

__nextToken Get the next token from input string

  __endCond 
__endCond ( self )

__endCond If If code was generated for a condition, we insert a test into the output code

  __checkPresence 
__checkPresence (
        self,
        key,
        attr,
        present=None,
        )

__checkPresence Add code to test for the truth value of an attribute

  __parseQualifier 
__parseQualifier ( self )

__parseQualifier Parse the qualifier expression

Exceptions   

RuntimeError, ( 'unexpected token', self.__token )

  __parseKey 
__parseKey ( self )

__parseKey Input consists of a set of selectors that consist of a predefined key (# for graphs, : for subgraphs and @ for vertices), an optional abbreviation string and a qualifier (which starts with a /) We parse this input use a recursive descent parser that starts with the first key

Exceptions   

ValueError, ( 'unknown key type', self.__token )

  __newKey 
__newKey ( self,  key )

__newKey Switch to a new object type (key) This is the function that inserts all the code between tests The algorithm is divided into two phases: 1. If the new key level is higher (more specific) than the current key level, we descend to that level 2. If the new key level is equal or lower (same or less specific) than the current key level, we invoke the callback and pop up to the new level 3. Readjust the indentation levels to the new object type Phase 1 allows us to insert the start of the loop constructs Phase 2 allows us to terminate the loop and select objects if appropriate Phase 3 allows us to move on to the next test in a consistent state

  __init__ 
__init__ (
        self,
        s,
        gFunc,
        sFunc,
        vFunc,
        )

__init__ initialize a Parser instance by parsing the given string and generating Python code corresponding to the object selection language specification

Exceptions   

SyntaxError, ('extraneous token', ( '', 1, self.__token [ 'start' ], self.input ) )

  __setIndent 
__setIndent ( self )

__setIndent Set the indentation levels according to the key


This document was automatically generated Wed Jul 9 15:49:30 2008 by HappyDoc version 3.1