Horizon
Public Member Functions | Public Attributes | List of all members
pybis.Parse Class Reference
Inheritance diagram for pybis.Parse:
pybis.Bracket pybis.Header pybis.IBISCommon pybis.Param pybis.Comment pybis.End pybis.Keyword pybis.Section pybis.Text pybis.EBD pybis.IBS pybis.PKG pybis.DictParam pybis.RangeDictParam pybis.RangeParam

Public Member Functions

def __init__ (self, key, pyparser=None, default=None, initvalue=None, data_name=None, list_merge=False, asList=False, asDict=False, required=False)
 
def add (self, obj)
 
def __iadd__ (self, obj)
 
def get_globals (self)
 
def find_parser (self, text)
 
def can_parse (self, text)
 
def initial (self, text, comment)
 
def parse (self, node, text, comment)
 
def pyparse (self, text)
 
def fin (self, node)
 
def pop (self, new, name)
 
def flatten (self, new)
 
def merge (self, orig, new)
 

Public Attributes

 key
 
 flat_key
 
 data_name
 
 default
 
 initvalue
 
 pyparser
 
 list_merge
 
 asList
 
 asDict
 
 children
 
 parent
 
 globals
 
 required
 

Detailed Description

Base pybis Parse object.

Constructor & Destructor Documentation

◆ __init__()

def pybis.Parse.__init__ (   self,
  key,
  pyparser = None,
  default = None,
  initvalue = None,
  data_name = None,
  list_merge = False,
  asList = False,
  asDict = False,
  required = False 
)
key:         Name of element.
   pyparser:    Parser to call with pyparse
   default:     Default value of object if not found
   initvalue:   Default value of object on first merge
   data_name:   Make the data of this node a child with name 'data_name'
   list_merge:  Merge multiple copies together as list
   asList:      Interpret pyparse results as a list
   asDict:      Interpret pyparse results as a dict
   required:    raise Exception if not found

Member Function Documentation

◆ can_parse()

def pybis.Parse.can_parse (   self,
  text 
)
True if we can parse 'text'.

Reimplemented in pybis.Param, and pybis.Bracket.

◆ fin()

def pybis.Parse.fin (   self,
  node 
)

◆ find_parser()

def pybis.Parse.find_parser (   self,
  text 
)
Find a child parser that can parse 'text'.

◆ flatten()

def pybis.Parse.flatten (   self,
  new 
)
Reformat pyparse results as what we'd expect.

Reimplemented in pybis.Series_MOSFET, pybis.RangeSection, pybis.Text, pybis.RangeDictParam, pybis.RangeParam, and pybis.DictParam.

◆ get_globals()

def pybis.Parse.get_globals (   self)
Get the global parse object, for things that are parseable in all contexts.

◆ initial()

def pybis.Parse.initial (   self,
  text,
  comment 
)
Parse the first line of text and return a Node object.

Reimplemented in pybis.Param, pybis.RangeSection, pybis.TableSection, pybis.TokenizeSection, pybis.Section, pybis.Text, pybis.Keyword, pybis.End, pybis.Comment, and pybis.Bracket.

◆ merge()

def pybis.Parse.merge (   self,
  orig,
  new 
)
Merge two instances of the same parser under one parent.

Reimplemented in pybis.Series_MOSFET, pybis.RangeDictParam, pybis.RangeParam, pybis.DictParam, and pybis.Text.

◆ parse()

def pybis.Parse.parse (   self,
  node,
  text,
  comment 
)
Parse a subsequent line of text, False means we can't.

Reimplemented in pybis.RangeSection, pybis.DictSection, pybis.ListSection, pybis.TableSection, pybis.TokenizeSection, and pybis.Text.

◆ pop()

def pybis.Parse.pop (   self,
  new,
  name 
)
Remove 'name' from ParseResults 'new'.

◆ pyparse()

def pybis.Parse.pyparse (   self,
  text 
)
Use self.pyparser to parse 'text', returns parse tokens.
   Returns 'text' if there is no pyparser object.

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