proxygen
|
Classes | |
class | CodeNode |
class | Cursor |
class | ElseNode |
class | Env |
class | ExpNode |
class | ForNode |
class | IfNode |
class | LiteralDollarNode |
class | Output |
class | RangeNode |
class | RawCodeNode |
class | Token |
class | VarNode |
Functions | |
def | Eof () |
def | StartsWith (lines, pos, string) |
def | FindFirstInLine (line, token_table) |
def | FindFirst (lines, token_table, cursor) |
def | SubString (lines, start, end) |
def | StripMetaComments (str) |
def | MakeToken (lines, start, end, token_type) |
def | ParseToken (lines, pos, regex, token_type) |
def | Skip (lines, pos, regex) |
def | SkipUntil (lines, pos, regex, token_type) |
def | ParseExpTokenInParens (lines, pos) |
def | RStripNewLineFromToken (token) |
def | TokenizeLines (lines, pos) |
def | Tokenize (s) |
def | PopFront (a_list) |
def | PushFront (a_list, elem) |
def | PopToken (a_list, token_type=None) |
def | PeekToken (a_list) |
def | ParseExpNode (token) |
def | ParseElseNode (tokens) |
def | ParseAtomicCodeNode (tokens) |
def | ParseCodeNode (tokens) |
def | ParseToAST (pump_src_text) |
def | RunAtomicCode (env, node, output) |
def | RunCode (env, code_node, output) |
def | IsSingleLineComment (cur_line) |
def | IsInPreprocessorDirective (prev_lines, cur_line) |
def | WrapComment (line, output) |
def | WrapCode (line, line_concat, output) |
def | WrapPreprocessorDirective (line, output) |
def | WrapPlainCode (line, output) |
def | IsMultiLineIWYUPragma (line) |
def | IsHeaderGuardIncludeOrOneLineIWYUPragma (line) |
def | WrapLongLine (line, output) |
def | BeautifyCode (string) |
def | ConvertFromPumpSource (src_text) |
def | main (argv) |
Variables | |
string | __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'\.\.') | |
def pump.BeautifyCode | ( | string | ) |
Definition at line 814 of file pump.py.
References join, and WrapLongLine().
Referenced by pump.Output.Append(), and ConvertFromPumpSource().
def pump.ConvertFromPumpSource | ( | src_text | ) |
Return the text generated from the given Pump source text.
Definition at line 823 of file pump.py.
References BeautifyCode(), ParseToAST(), RunCode(), and StripMetaComments().
Referenced by pump.Output.Append(), and main().
def pump.Eof | ( | ) |
Returns the special cursor to denote the end-of-file.
Definition at line 132 of file pump.py.
Referenced by pump.Token.__init__(), pump.Cursor.__str__(), pump.Cursor.Clone(), pump.Token.Clone(), SubString(), and TokenizeLines().
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.
References FindFirstInLine(), and MakeToken().
Referenced by pump.Token.Clone(), and TokenizeLines().
def pump.FindFirstInLine | ( | line, | |
token_table | |||
) |
def pump.IsHeaderGuardIncludeOrOneLineIWYUPragma | ( | line | ) |
Definition at line 783 of file pump.py.
Referenced by pump.Output.Append(), and WrapLongLine().
def pump.IsInPreprocessorDirective | ( | prev_lines, | |
cur_line | |||
) |
Definition at line 711 of file pump.py.
Referenced by pump.Output.Append(), and WrapLongLine().
def pump.IsMultiLineIWYUPragma | ( | line | ) |
def pump.IsSingleLineComment | ( | cur_line | ) |
def pump.main | ( | argv | ) |
Definition at line 831 of file pump.py.
References ConvertFromPumpSource().
Referenced by pump.Output.Append().
def pump.MakeToken | ( | lines, | |
start, | |||
end, | |||
token_type | |||
) |
Creates a new instance of Token.
Definition at line 237 of file pump.py.
References SubString().
Referenced by pump.Token.Clone(), FindFirst(), ParseExpTokenInParens(), ParseToken(), and TokenizeLines().
def pump.ParseAtomicCodeNode | ( | tokens | ) |
Definition at line 503 of file pump.py.
References ParseCodeNode(), ParseElseNode(), ParseExpNode(), PeekToken(), PopFront(), PopToken(), and PushFront().
Referenced by pump.ExpNode.__init__(), and ParseCodeNode().
def pump.ParseCodeNode | ( | tokens | ) |
Definition at line 564 of file pump.py.
References ParseAtomicCodeNode().
Referenced by pump.ExpNode.__init__(), ParseAtomicCodeNode(), ParseElseNode(), and ParseToAST().
def pump.ParseElseNode | ( | tokens | ) |
Definition at line 475 of file pump.py.
References ParseCodeNode(), ParseExpNode(), PeekToken(), and PopToken().
Referenced by pump.ExpNode.__init__(), and ParseAtomicCodeNode().
def pump.ParseExpNode | ( | token | ) |
Definition at line 470 of file pump.py.
Referenced by pump.ExpNode.__init__(), ParseAtomicCodeNode(), and ParseElseNode().
def pump.ParseExpTokenInParens | ( | lines, | |
pos | |||
) |
Definition at line 281 of file pump.py.
References MakeToken(), Skip(), SkipUntil(), and SubString().
Referenced by pump.Token.Clone(), and TokenizeLines().
def pump.ParseToAST | ( | pump_src_text | ) |
Convert the given Pump source text into an AST.
Definition at line 577 of file pump.py.
References bm.list, ParseCodeNode(), and Tokenize().
Referenced by pump.ExpNode.__init__(), pump.Output.Append(), and ConvertFromPumpSource().
def pump.ParseToken | ( | lines, | |
pos, | |||
regex, | |||
token_type | |||
) |
Definition at line 243 of file pump.py.
References MakeToken().
Referenced by pump.Token.Clone(), and TokenizeLines().
def pump.PeekToken | ( | a_list | ) |
Definition at line 463 of file pump.py.
Referenced by pump.ExpNode.__init__(), ParseAtomicCodeNode(), and ParseElseNode().
def pump.PopFront | ( | a_list | ) |
Definition at line 443 of file pump.py.
Referenced by pump.ExpNode.__init__(), ParseAtomicCodeNode(), and PopToken().
def pump.PopToken | ( | a_list, | |
token_type = None |
|||
) |
Definition at line 453 of file pump.py.
References PopFront().
Referenced by pump.ExpNode.__init__(), ParseAtomicCodeNode(), and ParseElseNode().
def pump.PushFront | ( | a_list, | |
elem | |||
) |
Definition at line 449 of file pump.py.
Referenced by pump.ExpNode.__init__(), and ParseAtomicCodeNode().
def pump.RStripNewLineFromToken | ( | token | ) |
Definition at line 303 of file pump.py.
Referenced by pump.Token.Clone(), and TokenizeLines().
def pump.RunAtomicCode | ( | env, | |
node, | |||
output | |||
) |
Definition at line 656 of file pump.py.
References folly::gen.range(), and RunCode().
Referenced by pump.Output.Append(), and RunCode().
def pump.RunCode | ( | env, | |
code_node, | |||
output | |||
) |
Definition at line 702 of file pump.py.
References RunAtomicCode().
Referenced by pump.Output.Append(), ConvertFromPumpSource(), and RunAtomicCode().
def pump.Skip | ( | lines, | |
pos, | |||
regex | |||
) |
Definition at line 261 of file pump.py.
Referenced by pump.Token.Clone(), ParseExpTokenInParens(), and TokenizeLines().
def pump.SkipUntil | ( | lines, | |
pos, | |||
regex, | |||
token_type | |||
) |
Definition at line 270 of file pump.py.
Referenced by pump.Token.Clone(), ParseExpTokenInParens(), and TokenizeLines().
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.
Referenced by pump.Token.Clone().
def pump.StripMetaComments | ( | str | ) |
Strip meta comments from each line in the given string.
Definition at line 226 of file pump.py.
Referenced by pump.Output.Append(), pump.Token.Clone(), and ConvertFromPumpSource().
def pump.SubString | ( | lines, | |
start, | |||
end | |||
) |
Returns a substring in lines.
Definition at line 208 of file pump.py.
Referenced by pump.Token.Clone(), MakeToken(), ParseExpTokenInParens(), and TokenizeLines().
def pump.Tokenize | ( | s | ) |
A generator that yields the tokens in the given string.
Definition at line 382 of file pump.py.
References TokenizeLines().
Referenced by pump.ExpNode.__init__(), pump.Token.Clone(), and ParseToAST().
def pump.TokenizeLines | ( | lines, | |
pos | |||
) |
Definition at line 310 of file pump.py.
References Eof(), FindFirst(), MakeToken(), ParseExpTokenInParens(), ParseToken(), RStripNewLineFromToken(), Skip(), SkipUntil(), and SubString().
Referenced by pump.Token.Clone(), and Tokenize().
def pump.WrapCode | ( | line, | |
line_concat, | |||
output | |||
) |
Definition at line 741 of file pump.py.
References folly::detail::distributed_mutex.strip().
Referenced by pump.Output.Append(), WrapPlainCode(), and WrapPreprocessorDirective().
def pump.WrapComment | ( | line, | |
output | |||
) |
Definition at line 717 of file pump.py.
References folly::detail::distributed_mutex.strip().
Referenced by pump.Output.Append(), and WrapLongLine().
def pump.WrapLongLine | ( | line, | |
output | |||
) |
Definition at line 790 of file pump.py.
References IsHeaderGuardIncludeOrOneLineIWYUPragma(), IsInPreprocessorDirective(), IsMultiLineIWYUPragma(), IsSingleLineComment(), WrapComment(), WrapPlainCode(), and WrapPreprocessorDirective().
Referenced by pump.Output.Append(), and BeautifyCode().
def pump.WrapPlainCode | ( | line, | |
output | |||
) |
Definition at line 775 of file pump.py.
References WrapCode().
Referenced by pump.Output.Append(), and WrapLongLine().
def pump.WrapPreprocessorDirective | ( | line, | |
output | |||
) |
Definition at line 771 of file pump.py.
References WrapCode().
Referenced by pump.Output.Append(), and WrapLongLine().
|
private |
list pump.TOKEN_TABLE |