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 _annotate_clause_declarer(ctx: Context):
    if ctx.cache is None:
        return actions.Default()
    if not isinstance(ctx.cache, list):
        ctx.error()
    length = len(ctx.cache)
    if length == 1:
        ctx.cache[0].annotation = A.CLS_DECL
    elif length == 2:
        ctx.cache[0].annotation = A.CLS_DOT
        ctx.cache[1].annotation = A.CLS_DECL
    else:
        ctx.error()
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.last_op[0].annotation != A.DECL_LPAR:
        ctx.error()

    token.annotation = A.DECL_ARG_COMMA