From 5ae2a2b847f94e39932c7abd06662d990773649a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 16 Jul 2020 20:28:11 +0100 Subject: refactor(3p/nix/libexpr): Extract static helpers out of parser.y Moves several of the static helper functions into a new parser.cc file. Once the rest of the code is usefully extracted, these will be moved to a private namespace. Change-Id: I0d7b53dcefe31bb5c6bad3ad7f5fcb48276bf799 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1218 Tested-by: BuildkiteCI Reviewed-by: isomer --- third_party/nix/src/libexpr/parser.hh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'third_party/nix/src/libexpr/parser.hh') diff --git a/third_party/nix/src/libexpr/parser.hh b/third_party/nix/src/libexpr/parser.hh index ae0e932147f5..3de8280bf5f0 100644 --- a/third_party/nix/src/libexpr/parser.hh +++ b/third_party/nix/src/libexpr/parser.hh @@ -15,6 +15,8 @@ int yylex(YYSTYPE* yylval_param, YYLTYPE* yylloc_param, yyscan_t yyscanner, \ nix::ParseData* data) +#define CUR_POS makeCurPos(*yylocp, data) + namespace nix { struct ParseData { @@ -44,4 +46,12 @@ static void dupAttr(Symbol attr, const Pos& pos, const Pos& prevPos) { attr % pos % prevPos); } +void addAttr(ExprAttrs* attrs, AttrPath& attrPath, Expr* e, const Pos& pos); + +void addFormal(const Pos& pos, Formals* formals, const Formal& formal); + +Expr* stripIndentation(const Pos& pos, SymbolTable& symbols, + std::vector& es); + + } // namespace nix -- cgit 1.4.1