Skip to content

Commit

Permalink
well format ast for comparision
Browse files Browse the repository at this point in the history
  • Loading branch information
loechel committed Feb 4, 2017
1 parent a06f0dd commit 26e5ed0
Show file tree
Hide file tree
Showing 9 changed files with 733 additions and 562 deletions.
61 changes: 45 additions & 16 deletions docs/upgrade/ast/python2_6.ast
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,49 @@ module Python version "2.6"
-- col_offset is the byte offset in the utf8 string the parser uses
attributes (int lineno, int col_offset)

expr_context = Load | Store | Del | AugLoad | AugStore | Param

slice = Ellipsis | Slice(expr? lower, expr? upper, expr? step)
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
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)

Expand All @@ -103,11 +132,11 @@ module Python version "2.6"
attributes (int lineno, int col_offset)

arguments = (expr* args, identifier? vararg,
identifier? kwarg, expr* defaults)
identifier? kwarg, expr* defaults)

-- keyword arguments supplied to call
keyword = (identifier arg, expr value)
-- keyword arguments supplied to call
keyword = (identifier arg, expr value)

-- import name with optional 'as' alias.
alias = (identifier name, identifier? asname)
-- import name with optional 'as' alias.
alias = (identifier name, identifier? asname)
}
56 changes: 42 additions & 14 deletions docs/upgrade/ast/python2_7.ast
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Python version "2.7"
| Suite(stmt* body)

stmt = FunctionDef(identifier name, arguments args,
stmt* body, expr* decorator_list)
stmt* body, expr* decorator_list)
| ClassDef(identifier name, expr* bases, stmt* body, expr* decorator_list)
| Return(expr? value)

Expand Down Expand Up @@ -84,20 +84,48 @@ module Python version "2.7"
-- col_offset is the byte offset in the utf8 string the parser uses
attributes (int lineno, int col_offset)

expr_context = Load | Store | Del | AugLoad | AugStore | Param
expr_context = Load
| Store
| Del
| AugLoad
| AugStore
| Param

slice = Ellipsis | Slice(expr? lower, expr? upper, expr? step)
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
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)

Expand All @@ -106,11 +134,11 @@ module Python version "2.7"
attributes (int lineno, int col_offset)

arguments = (expr* args, identifier? vararg,
identifier? kwarg, expr* defaults)
identifier? kwarg, expr* defaults)

-- keyword arguments supplied to call
keyword = (identifier arg, expr value)
-- keyword arguments supplied to call
keyword = (identifier arg, expr value)

-- import name with optional 'as' alias.
alias = (identifier name, identifier? asname)
-- import name with optional 'as' alias.
alias = (identifier name, identifier? asname)
}
Loading

0 comments on commit 26e5ed0

Please sign in to comment.