|
Monero
|
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 | |
| Eof () | |
| StartsWith (lines, pos, string) | |
| FindFirstInLine (line, token_table) | |
| FindFirst (lines, token_table, cursor) | |
| SubString (lines, start, end) | |
| StripMetaComments (str) | |
| MakeToken (lines, start, end, token_type) | |
| ParseToken (lines, pos, regex, token_type) | |
| Skip (lines, pos, regex) | |
| SkipUntil (lines, pos, regex, token_type) | |
| ParseExpTokenInParens (lines, pos) | |
| RStripNewLineFromToken (token) | |
| TokenizeLines (lines, pos) | |
| Tokenize (s) | |
| PopFront (a_list) | |
| PushFront (a_list, elem) | |
| PopToken (a_list, token_type=None) | |
| PeekToken (a_list) | |
| ParseExpNode (token) | |
| ParseElseNode (tokens) | |
| ParseAtomicCodeNode (tokens) | |
| ParseCodeNode (tokens) | |
| ParseToAST (pump_src_text) | |
| RunAtomicCode (env, node, output) | |
| RunCode (env, code_node, output) | |
| IsSingleLineComment (cur_line) | |
| IsInPreprocessorDirective (prev_lines, cur_line) | |
| WrapComment (line, output) | |
| WrapCode (line, line_concat, output) | |
| WrapPreprocessorDirective (line, output) | |
| WrapPlainCode (line, output) | |
| IsMultiLineIWYUPragma (line) | |
| IsHeaderGuardIncludeOrOneLineIWYUPragma (line) | |
| WrapLongLine (line, output) | |
| BeautifyCode (string) | |
| ConvertFromPumpSource (src_text) | |
| main (argv) | |
Variables | |
| str | __author__ = 'wan@google.com (Zhanyong Wan)' |
| list | TOKEN_TABLE |
| ID_REGEX = re.compile(r'[_A-Za-z]\w*') | |
| EQ_REGEX = re.compile(r'=') | |
| REST_OF_LINE_REGEX = re.compile(r'.*?(?=$|\$\$)') | |
| OPTIONAL_WHITE_SPACES_REGEX = re.compile(r'\s*') | |
| WHITE_SPACE_REGEX = re.compile(r'\s') | |
| DOT_DOT_REGEX = re.compile(r'\.\.') | |
pump v0.2.0 - Pretty Useful for Meta Programming.
A tool for preprocessor meta programming. Useful for generating
repetitive boilerplate code. Especially useful for writing C++
classes, functions, macros, and templates that need to work with
various number of arguments.
USAGE:
pump.py SOURCE_FILE
EXAMPLES:
pump.py foo.cc.pump
Converts foo.cc.pump to foo.cc.
GRAMMAR:
CODE ::= ATOMIC_CODE*
ATOMIC_CODE ::= $var ID = EXPRESSION
| $var ID = [[ CODE ]]
| $range ID EXPRESSION..EXPRESSION
| $for ID SEPARATOR [[ CODE ]]
| $($)
| $ID
| $(EXPRESSION)
| $if EXPRESSION [[ CODE ]] ELSE_BRANCH
| [[ CODE ]]
| RAW_CODE
SEPARATOR ::= RAW_CODE | EMPTY
ELSE_BRANCH ::= $else [[ CODE ]]
| $elif EXPRESSION [[ CODE ]] ELSE_BRANCH
| EMPTY
EXPRESSION has Python syntax.
| pump.BeautifyCode | ( | string | ) |
| pump.ConvertFromPumpSource | ( | src_text | ) |
Return the text generated from the given Pump source text.
| pump.Eof | ( | ) |
Returns the special cursor to denote the end-of-file.
| pump.FindFirst | ( | lines, | |
| token_table, | |||
| cursor ) |
Finds the first occurrence of any string in strings in lines.
| pump.FindFirstInLine | ( | line, | |
| token_table ) |
| pump.IsHeaderGuardIncludeOrOneLineIWYUPragma | ( | line | ) |
| pump.IsInPreprocessorDirective | ( | prev_lines, | |
| cur_line ) |
| pump.IsMultiLineIWYUPragma | ( | line | ) |
| pump.IsSingleLineComment | ( | cur_line | ) |
| pump.main | ( | argv | ) |
| pump.MakeToken | ( | lines, | |
| start, | |||
| end, | |||
| token_type ) |
Creates a new instance of Token.
| pump.ParseAtomicCodeNode | ( | tokens | ) |
| pump.ParseCodeNode | ( | tokens | ) |
| pump.ParseElseNode | ( | tokens | ) |
| pump.ParseExpNode | ( | token | ) |
| pump.ParseExpTokenInParens | ( | lines, | |
| pos ) |
| pump.ParseToAST | ( | pump_src_text | ) |
Convert the given Pump source text into an AST.
| pump.ParseToken | ( | lines, | |
| pos, | |||
| regex, | |||
| token_type ) |
| pump.PeekToken | ( | a_list | ) |
| pump.PopFront | ( | a_list | ) |
| pump.PopToken | ( | a_list, | |
| token_type = None ) |
| pump.PushFront | ( | a_list, | |
| elem ) |
| pump.RStripNewLineFromToken | ( | token | ) |
| pump.RunAtomicCode | ( | env, | |
| node, | |||
| output ) |
| pump.RunCode | ( | env, | |
| code_node, | |||
| output ) |
| pump.Skip | ( | lines, | |
| pos, | |||
| regex ) |
| pump.SkipUntil | ( | lines, | |
| pos, | |||
| regex, | |||
| token_type ) |
| pump.StartsWith | ( | lines, | |
| pos, | |||
| string ) |
Returns True iff the given position in lines starts with 'string'.
| pump.StripMetaComments | ( | str | ) |
Strip meta comments from each line in the given string.
| pump.SubString | ( | lines, | |
| start, | |||
| end ) |
Returns a substring in lines.
| pump.Tokenize | ( | s | ) |
A generator that yields the tokens in the given string.
| pump.TokenizeLines | ( | lines, | |
| pos ) |
| pump.WrapCode | ( | line, | |
| line_concat, | |||
| output ) |
| pump.WrapComment | ( | line, | |
| output ) |
| pump.WrapLongLine | ( | line, | |
| output ) |
| pump.WrapPlainCode | ( | line, | |
| output ) |
| pump.WrapPreprocessorDirective | ( | line, | |
| output ) |
|
private |
| pump.DOT_DOT_REGEX = re.compile(r'\.\.') |
| pump.EQ_REGEX = re.compile(r'=') |
| pump.ID_REGEX = re.compile(r'[_A-Za-z]\w*') |
| pump.OPTIONAL_WHITE_SPACES_REGEX = re.compile(r'\s*') |
| pump.REST_OF_LINE_REGEX = re.compile(r'.*?(?=$|\$\$)') |
| list pump.TOKEN_TABLE |
| pump.WHITE_SPACE_REGEX = re.compile(r'\s') |