foonathan / lexy

C++ parsing DSL
https://lexy.foonathan.net
Boost Software License 1.0
991 stars 66 forks source link

error: no member named 'p' in 'AIR::(lambda ...) #156

Closed OfekShochat closed 1 year ago

OfekShochat commented 1 year ago

Hello! For some reason when I write something like:

    static constexpr auto max_recursion_depth = 19;

    static constexpr auto whitespace = dsl::ascii::blank / dsl::ascii::newline;

    static constexpr auto rule = [] {
        return dsl::p<InstructionRule> + dsl::eof;
    };

    static constexpr auto value = lexy::forward<Instruction>;
};

compilation errors out with error: no member named 'p' in 'AIR::(lambda at parser/parser.h:63:34)' (at https://github.com/foonathan/lexy/blob/main/include/lexy/dsl/base.hpp#L100). I didn't see any inheritance done in the examples, and I couldn't find anything about it online. I might have an idea of what it is related to, but no idea how to fix it. Could you help? Thanks

Life4gal commented 1 year ago

I think you missed this. :)

Life4gal commented 1 year ago
static constexpr auto rule = [] {
        return dsl::p<InstructionRule> + dsl::eof;
    };

v

static constexpr auto rule = [] {
        return dsl::p<InstructionRule> + dsl::eof;
    }();