Goose  Diff

Differences From Artifact [8ca022354e]:

  • File bs/parse/parser.cpp — part of check-in [c33b227735] at 2021-11-13 14:09:04 on branch trunk — The builder is now passed as the first param of the _DropValue extension point (user: zlodo size: 9679)

To Artifact [757b1fa6be]:

  • File bs/parse/parser.cpp — part of check-in [0184a27429] at 2021-11-26 00:37:31 on branch trunk —
    • Parser: if an infix rules fails to parse, backtrack
    • Parser: it is now possible to define a contextual "default lhs value"
    • Parser: if an infix operator fails parsing, it is retried as an infix operator, using the default lhs value if there is one available
    • Type predicates: setup @val as the default lhs value inside of the proposition list context, so it is now possible to write u32[<10] instead of u32[@val<10]
    (user: zlodo size: 10142)

298
299
300
301
302
303
304
305
306
307
308
309









310





311
312
313
314
315
316
317
        return parseInfixOverloadSet( *FromValue< ptr< OverloadSet > >( *val ), prec );

    // If the term is an infix rule value, invoke its parseInfix() function.
    auto rule = FromValue< Rule >( *val );
    if( !rule )
        return false;

    m_resolver->consume();

    if( !( *rule )->isInfix() )
        return false;










    return ( *rule )->parseInfix( *this, t.second, prec );





}

optional< Value > Parser::popType()
{
    if( !m_lastValue )
        return nullopt;








<
<



>
>
>
>
>
>
>
>
>
|
>
>
>
>
>







298
299
300
301
302
303
304


305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
        return parseInfixOverloadSet( *FromValue< ptr< OverloadSet > >( *val ), prec );

    // If the term is an infix rule value, invoke its parseInfix() function.
    auto rule = FromValue< Rule >( *val );
    if( !rule )
        return false;



    if( !( *rule )->isInfix() )
        return false;

    // If an infix parsing rule fails to parse, attempt to backtrack,
    // so we can try to parse it again as a prefix rule if it supports it
    // (case of infix operators that may act as prefix operators using a default lhs
    // value in some contexts)
    auto savedPosition = m_resolver->position();
    auto savedLastVal = m_lastValue;

    m_resolver->consume();

    if( ( *rule )->parseInfix( *this, t.second, prec ) )
        return true;

    m_lastValue = savedLastVal;
    m_resolver->setPosition( savedPosition );
    return false;
}

optional< Value > Parser::popType()
{
    if( !m_lastValue )
        return nullopt;