Goose  Check-in [0b6a7a10ee]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix using statement not skipping newline markers before the expression.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0b6a7a10ee13d0f58da9f43b494500d996f05ed31aec79593fae11e354de5834
User & Date: achavasse 2019-02-14 20:35:29.186
Context
2019-02-14
22:12
Templates: added TDecl type. check-in: 46417155c1 user: achavasse tags: trunk
20:35
Fix using statement not skipping newline markers before the expression. check-in: 0b6a7a10ee user: achavasse tags: trunk
2019-02-13
21:51
Templates: added template rules base classes. check-in: 12db48f235 user: achavasse tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to bs/builtins/statements/using.cpp.
8
9
10
11
12
13
14

15
16
17
18
19
20
21
22
23
24
25
26
27
28

29
30
31
32
33
34
35
36
37
38
39
40
41


42
43
44
45
46
47
48

namespace empathy::builtins
{
    void SetupUsingStmt( Env& e )
    {
        auto handleUsing = []( Parser& p, const Term& t, uint32_t prec ) -> optional< Value >
        {

            auto nameTerm = p.resolver()->consume();
            if( !nameTerm )
            {
                cout << t.location() << ": expected an identifier after 'using'.\n";
                return nullopt;
            }

            const auto* name = get_if< StringId >( &nameTerm->content() );
            if( !name )
            {
                cout << nameTerm->location() << ": expected an identifier after 'using'.\n";
                return nullopt;
            }


            auto eqTerm = p.resolver()->consumeUnresolved();
            if( !eqTerm )
            {
                cout << eqTerm->location() << ": expected '=' after 'using " << name->c_str() << "'.\n";
                return nullopt;
            }

            const auto* eq = get_if< StringId >( &eqTerm->content() );
            if( !eq || *eq != "="_sid )
            {
                cout << eqTerm->location() << ": expected '=' after 'using " << name->c_str() << "'.\n";
                return nullopt;
            }



            // Store all the units following the equal sign until the next semicolon or newline.
            vector< Term > toks;
            while( !p.resolver()->eos() )
            {
                const auto& tok = p.resolver()->lookAheadUnresolved();
                if( !tok )







>














>













>
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

namespace empathy::builtins
{
    void SetupUsingStmt( Env& e )
    {
        auto handleUsing = []( Parser& p, const Term& t, uint32_t prec ) -> optional< Value >
        {
            p.resolver()->consumeNewLines();
            auto nameTerm = p.resolver()->consume();
            if( !nameTerm )
            {
                cout << t.location() << ": expected an identifier after 'using'.\n";
                return nullopt;
            }

            const auto* name = get_if< StringId >( &nameTerm->content() );
            if( !name )
            {
                cout << nameTerm->location() << ": expected an identifier after 'using'.\n";
                return nullopt;
            }

            p.resolver()->consumeNewLines();
            auto eqTerm = p.resolver()->consumeUnresolved();
            if( !eqTerm )
            {
                cout << eqTerm->location() << ": expected '=' after 'using " << name->c_str() << "'.\n";
                return nullopt;
            }

            const auto* eq = get_if< StringId >( &eqTerm->content() );
            if( !eq || *eq != "="_sid )
            {
                cout << eqTerm->location() << ": expected '=' after 'using " << name->c_str() << "'.\n";
                return nullopt;
            }

            p.resolver()->consumeNewLines();

            // Store all the units following the equal sign until the next semicolon or newline.
            vector< Term > toks;
            while( !p.resolver()->eos() )
            {
                const auto& tok = p.resolver()->lookAheadUnresolved();
                if( !tok )