Beispiel #1
0
def r(ctx: Context, token: TokenInfo):
    t, state = ctx.pop_op()
    if state not in (State.EXPECT_LBDX_LSQB, State.IN_LBDX_CALL) or not tk.ISMATCHED(t, token):
        ctx.error()

    if t.annotation == A.DECL_LPAR:
        ctx.pop_state()
        ctx.pop_state()
        token.annotation = A.DECL_RPAR
Beispiel #2
0
def r(ctx: Context, token: TokenInfo):
    if ctx.pop_op()[0].annotation == A.CLS_BODY_LSQB:
        ctx.pop_state()
        ctx.push_state(State.EXPECT_SUBCLS_DOT)

        sentinel = TokenInfo.new_sentinel_before(token, A.STMT_END)
        ctx.push_ret(sentinel)
        token.annotation = A.CLS_BODY_RSQB
        ctx.push_ret(token)
        return actions.Default(dont_store=True)
Beispiel #3
0
def r(ctx: Context, token: TokenInfo):
    ltoken, state = ctx.pop_op()
    if not tk.ISMATCHED(ltoken, token) or state != ctx.last_state:
        ctx.error()
Beispiel #4
0
def r(ctx: Context, token: TokenInfo):
    if ctx.pop_op()[1] == State.EXPECT_CLS_HEAD_OR_BODY_LSQB:
        ctx.pop_state()
        ctx.push_state(State.EXPECT_CLS_MAYBE_BODY_LSQB)
Beispiel #5
0
def r(ctx: Context, token: TokenInfo):
    if ctx.pop_op()[1] == State.EXPECT_CLS_HEAD_LSQB:
        ctx.pop_state()
        ctx.push_state(State.EXPECT_CLS_BODY_LSQB)
        token.annotation = A.CLS_HEAD_RSQB