diff --git a/lix/libexpr/parser/grammar.hh b/lix/libexpr/parser/grammar.hh index d653691ca..5a97614d9 100644 --- a/lix/libexpr/parser/grammar.hh +++ b/lix/libexpr/parser/grammar.hh @@ -415,7 +415,7 @@ struct inherit : _inherit, seq< > {}; struct _binding { - struct path : semantic, attrpath {}; + struct path : attrpath {}; struct equal : one<'='> {}; struct value : semantic, must {}; }; diff --git a/lix/libexpr/parser/parser-impl1.inc.cc b/lix/libexpr/parser/parser-impl1.inc.cc index 4b311a6c7..300515dc3 100644 --- a/lix/libexpr/parser/parser-impl1.inc.cc +++ b/lix/libexpr/parser/parser-impl1.inc.cc @@ -323,13 +323,16 @@ template<> struct BuildAST { template<> struct BuildAST : BuildAST {}; +struct BindingState : AttrState { + using AttrState::AttrState; + + std::unique_ptr value; +}; + struct BindingsState : SubexprState { explicit BindingsState(ExprState & up, ExprAttrs & attrs) : SubexprState(up), attrs(attrs) {} ExprAttrs & attrs; - PosIdx pos; - AttrPath path; - std::unique_ptr value; }; struct BindingsStateSet : BindingsState { @@ -416,21 +419,15 @@ template<> struct BuildAST : change_head { } }; -template<> struct BuildAST : change_head { - static void success0(AttrState & a, BindingsState & s, State & ps) { - s.path = std::move(a.attrs); - } -}; - -template<> struct BuildAST { - static void apply0(BindingsState & s, State & ps) { +template<> struct BuildAST { + static void apply0(BindingState & s, State & ps) { s.value = s->popExprOnly(); } }; -template<> struct BuildAST { - static void apply(const auto & in, BindingsState & s, State & ps) { - ps.addAttr(&s.attrs, std::move(s.path), std::move(s.value), ps.at(in)); +template<> struct BuildAST : change_head { + static void success(const auto & in, BindingState & b, BindingsState & s, State & ps) { + ps.addAttr(&s.attrs, std::move(b.attrs), std::move(b.value), ps.at(in)); } };