-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extracted the ast info from the compier... chould not be there!
- Loading branch information
Showing
2 changed files
with
82 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
Python grammar, the AST classes contain those arguments as properties. | ||
|
||
module Python version "$Revision: 62047 $" | ||
{ | ||
mod = Module(stmt* body) | ||
| Interactive(stmt* body) | ||
| Expression(expr body) | ||
|
||
stmt = FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list) | ||
| ClassDef(identifier name, expr* bases, stmt* body, expr *decorator_list) | ||
| Return(expr? value) | ||
|
||
| Delete(expr* targets) | ||
| Assign(expr* targets, expr value) | ||
| AugAssign(expr target, operator op, expr value) | ||
|
||
| Print(expr? dest, expr* values, int nl) | ||
|
||
| For(expr target, expr iter, stmt* body, stmt* orelse) | ||
| While(expr test, stmt* body, stmt* orelse) | ||
| If(expr test, stmt* body, stmt* orelse) | ||
| With(expr context_expr, expr? optional_vars, stmt* body) | ||
|
||
| Raise(expr? type, expr? inst, expr? tback) | ||
| TryExcept(stmt* body, excepthandler* handlers, stmt* orelse) | ||
| TryFinally(stmt* body, stmt* finalbody) | ||
| Assert(expr test, expr? msg) | ||
|
||
| Import(alias* names) | ||
| ImportFrom(identifier module, alias* names, int? level) | ||
|
||
| Exec(expr body, expr? globals, expr? locals) | ||
|
||
| Global(identifier* names) | ||
| Expr(expr value) | ||
| Pass | Break | Continue | ||
|
||
expr = BoolOp(boolop op, expr* values) | ||
| BinOp(expr left, operator op, expr right) | ||
| UnaryOp(unaryop op, expr operand) | ||
| Lambda(arguments args, expr body) | ||
| IfExp(expr test, expr body, expr orelse) | ||
| Dict(expr* keys, expr* values) | ||
| ListComp(expr elt, comprehension* generators) | ||
| GeneratorExp(expr elt, comprehension* generators) | ||
| Yield(expr? value) | ||
| Compare(expr left, cmpop* ops, expr* comparators) | ||
| Call(expr func, expr* args, keyword* keywords, expr? starargs, expr? kwargs) | ||
| Repr(expr value) | ||
| Num(object n) | ||
| Str(string s) | ||
|
||
| Attribute(expr value, identifier attr, expr_context ctx) | ||
| Subscript(expr value, slice slice, expr_context ctx) | ||
| Name(identifier id, expr_context ctx) | ||
| List(expr* elts, expr_context ctx) | ||
| Tuple(expr* elts, expr_context ctx) | ||
|
||
expr_context = Load | Store | Del | AugLoad | AugStore | Param | ||
|
||
slice = Ellipsis | ||
| Slice(expr? lower, expr? upper, expr? step) | ||
| ExtSlice(slice* dims) | ||
| Index(expr value) | ||
|
||
boolop = And | Or | ||
|
||
operator = Add | Sub | Mult | Div | Mod | Pow | LShift | RShift | BitOr | BitXor | BitAnd | FloorDiv | ||
|
||
unaryop = Invert | Not | UAdd | USub | ||
|
||
cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn | ||
|
||
comprehension = (expr target, expr iter, expr* ifs) | ||
|
||
excepthandler = ExceptHandler(expr? type, expr? name, stmt* body) | ||
|
||
arguments = (expr* args, identifier? vararg, identifier? kwarg, expr* defaults) | ||
keyword = (identifier arg, expr value) | ||
|
||
alias = (identifier name, identifier? asname) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters