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 <isomer@tvl.fyi>
This commit is contained in:
Vincent Ambo 2020-07-16 20:28:11 +01:00 committed by tazjin
parent d579ceb783
commit 5ae2a2b847
4 changed files with 202 additions and 185 deletions

View file

@ -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<Expr*>& es);
} // namespace nix