示例#1
0
def r(ctx: Context, token: TokenInfo):
    if not ctx.last_op[0].annotation in (A.CLS_BODY_LSQB, A.BODY_LSQB):
        return

    ctx.cache = [token]
    ctx.push_state(State.EXPECT_AUGASSIGN_DASH)
    return actions.StartBuffer()
示例#2
0
def r(ctx: Context, token: TokenInfo):
    token.annotation = A.CLS_HEAD_LSQB
    ctx.push_op(token)
    ctx.pop_state()
    ctx.push_state(State.IN_LBDX_CLS_HEAD)

    _annotate_clause_declarer(ctx)
    ctx.cache = None
    if ctx.is_buffering():
        return actions.StopBuffer()
示例#3
0
def r(ctx: Context, token: TokenInfo):
    last_state = ctx.pop_state()

    new_state = {
        State.EXPECT_SUBCLS_DOT: State.EXPECT_SUBCLS_NAME,
        State.MUST_SUBCLS_DOT_WITH_HEAD: State.MUST_SUBCLS_NAME_WITH_HEAD,
        State.MUST_SUBCLS_DOT_WITH_BODY: State.MUST_SUBCLS_NAME_WITH_BODY,
    }[last_state]

    ctx.push_state(new_state)
    ctx.cache = [token]

    return actions.StartBuffer()
示例#4
0
def r(ctx: Context, token: TokenInfo):
    if ctx.is_buffering():
        return actions.StopBuffer(dont_consume=True)

    ctx.pop_state()
    ctx.push_state(State.IN_LBDX_CLS_BODY)
    token.annotation = A.CLS_BODY_LSQB
    ctx.push_op(token)

    _annotate_clause_declarer(ctx)
    ctx.cache = None

    ctx.push_ret(token)
    sentinel = TokenInfo.new_sentinel_after(token, A.STMT_START)
    ctx.push_ret(sentinel)

    return actions.Default(dont_store=True)
示例#5
0
def r(ctx: Context, token: TokenInfo):
    ctx.pop_state()
    ctx.cache = None
    return actions.StopBuffer(dont_consume=True)
示例#6
0
def r(ctx: Context, token: TokenInfo):
    ctx.push_state(State.EXPECT_LBDX_LPAR)

    ctx.cache = token
    return actions.StartBuffer()
示例#7
0
def r(ctx: Context, token: TokenInfo):
    ctx.push_state(State.EXPECT_CLS_BODY_LSQB)
    ctx.cache = [token]
    return actions.StartBuffer()