Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pump Namespace Reference

Classes

class  Cursor
 
class  Token
 
class  CodeNode
 
class  VarNode
 
class  RangeNode
 
class  ForNode
 
class  ElseNode
 
class  IfNode
 
class  RawCodeNode
 
class  LiteralDollarNode
 
class  ExpNode
 
class  Env
 
class  Output
 

Functions

def Eof
 
def StartsWith
 
def FindFirstInLine
 
def FindFirst
 
def SubString
 
def StripMetaComments
 
def MakeToken
 
def ParseToken
 
def Skip
 
def SkipUntil
 
def ParseExpTokenInParens
 
def RStripNewLineFromToken
 
def TokenizeLines
 
def Tokenize
 
def PopFront
 
def PushFront
 
def PopToken
 
def PeekToken
 
def ParseExpNode
 
def ParseElseNode
 
def ParseAtomicCodeNode
 
def ParseCodeNode
 
def ParseToAST
 
def RunAtomicCode
 
def RunCode
 
def IsSingleLineComment
 
def IsInPreprocessorDirective
 
def WrapComment
 
def WrapCode
 
def WrapPreprocessorDirective
 
def WrapPlainCode
 
def IsMultiLineIWYUPragma
 
def IsHeaderGuardIncludeOrOneLineIWYUPragma
 
def WrapLongLine
 
def BeautifyCode
 
def ConvertFromPumpSource
 
def main
 

Variables

string __author__ 'wan@google.com (Zhanyong Wan)'
 
list TOKEN_TABLE
 
tuple ID_REGEX re.compile(r'[_A-Za-z]\w*')
 
tuple EQ_REGEX re.compile(r'=')
 
tuple REST_OF_LINE_REGEX re.compile(r'.*?(?=$|\$\$)')
 
tuple OPTIONAL_WHITE_SPACES_REGEX re.compile(r'\s*')
 
tuple WHITE_SPACE_REGEX re.compile(r'\s')
 
tuple DOT_DOT_REGEX re.compile(r'\.\.')
 

Function Documentation

def pump.BeautifyCode (   string)

Definition at line 814 of file pump.py.

View newest version in sPHENIX GitHub at line 814 of file pump.py

References join(), and WrapLongLine().

Referenced by ConvertFromPumpSource().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.ConvertFromPumpSource (   src_text)
Return the text generated from the given Pump source text.

Definition at line 823 of file pump.py.

View newest version in sPHENIX GitHub at line 823 of file pump.py

References BeautifyCode(), ParseToAST(), RunCode(), and StripMetaComments().

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.Eof ( )
Returns the special cursor to denote the end-of-file.

Definition at line 132 of file pump.py.

View newest version in sPHENIX GitHub at line 132 of file pump.py

Referenced by pump.Cursor.__str__(), SubString(), and TokenizeLines().

+ Here is the caller graph for this function:

def pump.FindFirst (   lines,
  token_table,
  cursor 
)
Finds the first occurrence of any string in strings in lines.

Definition at line 186 of file pump.py.

View newest version in sPHENIX GitHub at line 186 of file pump.py

References FindFirstInLine(), and MakeToken().

Referenced by TokenizeLines().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.FindFirstInLine (   line,
  token_table 
)

Definition at line 169 of file pump.py.

View newest version in sPHENIX GitHub at line 169 of file pump.py

Referenced by FindFirst().

+ Here is the caller graph for this function:

def pump.IsHeaderGuardIncludeOrOneLineIWYUPragma (   line)

Definition at line 783 of file pump.py.

View newest version in sPHENIX GitHub at line 783 of file pump.py

Referenced by WrapLongLine().

+ Here is the caller graph for this function:

def pump.IsInPreprocessorDirective (   prev_lines,
  cur_line 
)

Definition at line 711 of file pump.py.

View newest version in sPHENIX GitHub at line 711 of file pump.py

Referenced by WrapLongLine().

+ Here is the caller graph for this function:

def pump.IsMultiLineIWYUPragma (   line)

Definition at line 779 of file pump.py.

View newest version in sPHENIX GitHub at line 779 of file pump.py

Referenced by WrapLongLine().

+ Here is the caller graph for this function:

def pump.IsSingleLineComment (   cur_line)

Definition at line 707 of file pump.py.

View newest version in sPHENIX GitHub at line 707 of file pump.py

Referenced by WrapLongLine().

+ Here is the caller graph for this function:

def pump.main (   argv)

Definition at line 831 of file pump.py.

View newest version in sPHENIX GitHub at line 831 of file pump.py

References ConvertFromPumpSource(), and file.

+ Here is the call graph for this function:

def pump.MakeToken (   lines,
  start,
  end,
  token_type 
)
Creates a new instance of Token.

Definition at line 237 of file pump.py.

View newest version in sPHENIX GitHub at line 237 of file pump.py

References SubString().

Referenced by FindFirst(), ParseExpTokenInParens(), ParseToken(), and TokenizeLines().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.ParseAtomicCodeNode (   tokens)

Definition at line 503 of file pump.py.

View newest version in sPHENIX GitHub at line 503 of file pump.py

References ParseCodeNode(), ParseElseNode(), ParseExpNode(), PeekToken(), PopFront(), PopToken(), and PushFront().

Referenced by ParseCodeNode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.ParseCodeNode (   tokens)

Definition at line 564 of file pump.py.

View newest version in sPHENIX GitHub at line 564 of file pump.py

References ParseAtomicCodeNode().

Referenced by ParseAtomicCodeNode(), ParseElseNode(), and ParseToAST().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.ParseElseNode (   tokens)

Definition at line 475 of file pump.py.

View newest version in sPHENIX GitHub at line 475 of file pump.py

References ParseCodeNode(), ParseExpNode(), PeekToken(), and PopToken().

Referenced by ParseAtomicCodeNode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.ParseExpNode (   token)

Definition at line 470 of file pump.py.

View newest version in sPHENIX GitHub at line 470 of file pump.py

Referenced by ParseAtomicCodeNode(), and ParseElseNode().

+ Here is the caller graph for this function:

def pump.ParseExpTokenInParens (   lines,
  pos 
)

Definition at line 281 of file pump.py.

View newest version in sPHENIX GitHub at line 281 of file pump.py

References MakeToken(), Skip(), SkipUntil(), and SubString().

Referenced by TokenizeLines().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.ParseToAST (   pump_src_text)
Convert the given Pump source text into an AST.

Definition at line 577 of file pump.py.

View newest version in sPHENIX GitHub at line 577 of file pump.py

References ParseCodeNode(), and Tokenize().

Referenced by ConvertFromPumpSource().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.ParseToken (   lines,
  pos,
  regex,
  token_type 
)

Definition at line 243 of file pump.py.

View newest version in sPHENIX GitHub at line 243 of file pump.py

References MakeToken().

Referenced by TokenizeLines().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.PeekToken (   a_list)

Definition at line 463 of file pump.py.

View newest version in sPHENIX GitHub at line 463 of file pump.py

Referenced by ParseAtomicCodeNode(), and ParseElseNode().

+ Here is the caller graph for this function:

def pump.PopFront (   a_list)

Definition at line 443 of file pump.py.

View newest version in sPHENIX GitHub at line 443 of file pump.py

Referenced by ParseAtomicCodeNode(), and PopToken().

+ Here is the caller graph for this function:

def pump.PopToken (   a_list,
  token_type = None 
)

Definition at line 453 of file pump.py.

View newest version in sPHENIX GitHub at line 453 of file pump.py

References PopFront().

Referenced by ParseAtomicCodeNode(), and ParseElseNode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.PushFront (   a_list,
  elem 
)

Definition at line 449 of file pump.py.

View newest version in sPHENIX GitHub at line 449 of file pump.py

Referenced by ParseAtomicCodeNode().

+ Here is the caller graph for this function:

def pump.RStripNewLineFromToken (   token)

Definition at line 303 of file pump.py.

View newest version in sPHENIX GitHub at line 303 of file pump.py

Referenced by TokenizeLines().

+ Here is the caller graph for this function:

def pump.RunAtomicCode (   env,
  node,
  output 
)

Definition at line 656 of file pump.py.

View newest version in sPHENIX GitHub at line 656 of file pump.py

References RunCode().

Referenced by RunCode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.RunCode (   env,
  code_node,
  output 
)

Definition at line 702 of file pump.py.

View newest version in sPHENIX GitHub at line 702 of file pump.py

References RunAtomicCode().

Referenced by ConvertFromPumpSource(), and RunAtomicCode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.Skip (   lines,
  pos,
  regex 
)

Definition at line 261 of file pump.py.

View newest version in sPHENIX GitHub at line 261 of file pump.py

Referenced by ParseExpTokenInParens(), and TokenizeLines().

+ Here is the caller graph for this function:

def pump.SkipUntil (   lines,
  pos,
  regex,
  token_type 
)

Definition at line 270 of file pump.py.

View newest version in sPHENIX GitHub at line 270 of file pump.py

Referenced by ParseExpTokenInParens(), and TokenizeLines().

+ Here is the caller graph for this function:

def pump.StartsWith (   lines,
  pos,
  string 
)
Returns True iff the given position in lines starts with 'string'.

Definition at line 163 of file pump.py.

View newest version in sPHENIX GitHub at line 163 of file pump.py

def pump.StripMetaComments (   str)
Strip meta comments from each line in the given string.

Definition at line 226 of file pump.py.

View newest version in sPHENIX GitHub at line 226 of file pump.py

Referenced by ConvertFromPumpSource().

+ Here is the caller graph for this function:

def pump.SubString (   lines,
  start,
  end 
)
Returns a substring in lines.

Definition at line 208 of file pump.py.

View newest version in sPHENIX GitHub at line 208 of file pump.py

References Eof(), and join().

Referenced by MakeToken(), ParseExpTokenInParens(), and TokenizeLines().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.Tokenize (   s)
A generator that yields the tokens in the given string.

Definition at line 382 of file pump.py.

View newest version in sPHENIX GitHub at line 382 of file pump.py

References TokenizeLines().

Referenced by ParseToAST().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.TokenizeLines (   lines,
  pos 
)

Definition at line 310 of file pump.py.

View newest version in sPHENIX GitHub at line 310 of file pump.py

References Eof(), FindFirst(), MakeToken(), ParseExpTokenInParens(), ParseToken(), RStripNewLineFromToken(), Skip(), SkipUntil(), and SubString().

Referenced by Tokenize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.WrapCode (   line,
  line_concat,
  output 
)

Definition at line 741 of file pump.py.

View newest version in sPHENIX GitHub at line 741 of file pump.py

Referenced by WrapPlainCode(), and WrapPreprocessorDirective().

+ Here is the caller graph for this function:

def pump.WrapComment (   line,
  output 
)

Definition at line 717 of file pump.py.

View newest version in sPHENIX GitHub at line 717 of file pump.py

Referenced by WrapLongLine().

+ Here is the caller graph for this function:

def pump.WrapLongLine (   line,
  output 
)

Definition at line 790 of file pump.py.

View newest version in sPHENIX GitHub at line 790 of file pump.py

References IsHeaderGuardIncludeOrOneLineIWYUPragma(), IsInPreprocessorDirective(), IsMultiLineIWYUPragma(), IsSingleLineComment(), WrapComment(), WrapPlainCode(), and WrapPreprocessorDirective().

Referenced by BeautifyCode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.WrapPlainCode (   line,
  output 
)

Definition at line 775 of file pump.py.

View newest version in sPHENIX GitHub at line 775 of file pump.py

References WrapCode().

Referenced by WrapLongLine().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def pump.WrapPreprocessorDirective (   line,
  output 
)

Definition at line 771 of file pump.py.

View newest version in sPHENIX GitHub at line 771 of file pump.py

References WrapCode().

Referenced by WrapLongLine().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

string pump.__author__ 'wan@google.com (Zhanyong Wan)'

Definition at line 65 of file pump.py.

View newest version in sPHENIX GitHub at line 65 of file pump.py

tuple pump.DOT_DOT_REGEX re.compile(r'\.\.')

Definition at line 258 of file pump.py.

View newest version in sPHENIX GitHub at line 258 of file pump.py

tuple pump.EQ_REGEX re.compile(r'=')

Definition at line 254 of file pump.py.

View newest version in sPHENIX GitHub at line 254 of file pump.py

tuple pump.ID_REGEX re.compile(r'[_A-Za-z]\w*')

Definition at line 253 of file pump.py.

View newest version in sPHENIX GitHub at line 253 of file pump.py

tuple pump.OPTIONAL_WHITE_SPACES_REGEX re.compile(r'\s*')

Definition at line 256 of file pump.py.

View newest version in sPHENIX GitHub at line 256 of file pump.py

tuple pump.REST_OF_LINE_REGEX re.compile(r'.*?(?=$|\$\$)')

Definition at line 255 of file pump.py.

View newest version in sPHENIX GitHub at line 255 of file pump.py

list pump.TOKEN_TABLE
Initial value:
1 [
2  (re.compile(r'\$var\s+'), '$var'),
3  (re.compile(r'\$elif\s+'), '$elif'),
4  (re.compile(r'\$else\s+'), '$else'),
5  (re.compile(r'\$for\s+'), '$for'),
6  (re.compile(r'\$if\s+'), '$if'),
7  (re.compile(r'\$range\s+'), '$range'),
8  (re.compile(r'\$[_A-Za-z]\w*'), '$id'),
9  (re.compile(r'\$\(\$\)'), '$($)'),
10  (re.compile(r'\$'), '$'),
11  (re.compile(r'\[\[\n?'), '[['),
12  (re.compile(r'\]\]\n?'), ']]'),
13  ]

Definition at line 72 of file pump.py.

View newest version in sPHENIX GitHub at line 72 of file pump.py

tuple pump.WHITE_SPACE_REGEX re.compile(r'\s')

Definition at line 257 of file pump.py.

View newest version in sPHENIX GitHub at line 257 of file pump.py