| 12 | |
| 13 | |
| 14 | class Python35Parser(Python34Parser): |
| 15 | def __init__(self, debug_parser=PARSER_DEFAULT_DEBUG): |
| 16 | super(Python35Parser, self).__init__(debug_parser) |
| 17 | self.customized = {} |
| 18 | |
| 19 | def p_35on(self, args): |
| 20 | """ |
| 21 | |
| 22 | # FIXME! isolate this to only loops! |
| 23 | _ifstmts_jump ::= c_stmts_opt come_froms |
| 24 | ifelsestmt ::= testexpr c_stmts_opt jump_forward_else else_suite _come_froms |
| 25 | |
| 26 | pb_ja ::= POP_BLOCK JUMP_ABSOLUTE |
| 27 | |
| 28 | # The number of canned instructions in new statements is mind boggling. |
| 29 | # I'm sure by the time Python 4 comes around these will be turned |
| 30 | # into special opcodes |
| 31 | |
| 32 | while1stmt ::= SETUP_LOOP l_stmts COME_FROM JUMP_BACK |
| 33 | POP_BLOCK COME_FROM_LOOP |
| 34 | while1stmt ::= SETUP_LOOP l_stmts POP_BLOCK COME_FROM_LOOP |
| 35 | while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK |
| 36 | POP_BLOCK else_suite COME_FROM_LOOP |
| 37 | |
| 38 | # The following rule is for Python 3.5+ where we can have stuff like |
| 39 | # while .. |
| 40 | # if |
| 41 | # ... |
| 42 | # the end of the if will jump back to the loop and there will be a COME_FROM |
| 43 | # after the jump |
| 44 | l_stmts ::= lastl_stmt come_froms l_stmts |
| 45 | |
| 46 | # Python 3.5+ Await statement |
| 47 | expr ::= await_expr |
| 48 | await_expr ::= expr GET_AWAITABLE LOAD_CONST YIELD_FROM |
| 49 | |
| 50 | stmt ::= await_stmt |
| 51 | await_stmt ::= await_expr POP_TOP |
| 52 | |
| 53 | # Python 3.5+ has WITH_CLEANUP_START/FINISH |
| 54 | |
| 55 | with ::= expr |
| 56 | SETUP_WITH POP_TOP suite_stmts_opt |
| 57 | POP_BLOCK LOAD_CONST COME_FROM_WITH |
| 58 | WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY |
| 59 | |
| 60 | with_as ::= expr |
| 61 | SETUP_WITH store suite_stmts_opt |
| 62 | POP_BLOCK LOAD_CONST COME_FROM_WITH |
| 63 | WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY |
| 64 | |
| 65 | # Python 3.5+ async additions |
| 66 | stmt ::= async_for_stmt |
| 67 | async_for_stmt ::= SETUP_LOOP expr |
| 68 | GET_AITER |
| 69 | LOAD_CONST YIELD_FROM SETUP_EXCEPT GET_ANEXT LOAD_CONST |
| 70 | YIELD_FROM |
| 71 | store |
no outgoing calls
no test coverage detected