nixd
Loading...
Searching...
No Matches
Classes | Functions | Variables
nixd::idioms Namespace Reference

Classes

struct  DynamicNameException
 The attrpath has a dynamic name, thus it cannot be trivially transformed to "static" selector. More...
 
struct  IdiomException
 
struct  IdiomSelectorException
 Exceptions scoped in nixd::mkIdiomSelector. More...
 
struct  NoLocationForBuiltinVariable
 
struct  NoSuchVarException
 No such variable. More...
 
struct  NotAnIdiomException
 The pattern of this variable cannot be recognized by known idioms. More...
 
struct  NotVariableSelect
 
struct  UndefinedVarException
 
struct  VLAException
 

Functions

Selector mkVarSelector (const nixf::ExprVar &Var, const nixf::VariableLookupAnalysis &VLA, const nixf::ParentMapAnalysis &PM)
 Construct a nixd::Selector from Var.
 
Selector mkSelector (const nixf::AttrPath &AP, Selector BaseSelector)
 Construct a nixd::Selector from AP.
 
Selector mkSelector (const nixf::ExprSelect &Select, Selector BaseSelector)
 Construct a nixd::Selector from Select.
 
Selector mkSelector (const nixf::ExprSelect &Select, const nixf::VariableLookupAnalysis &VLA, const nixf::ParentMapAnalysis &PM)
 Construct a nixd::Selector from Select.
 

Variables

constexpr std::string_view Pkgs = "pkgs"
 Hardcoded name for "pkgs.xxx", or "with pkgs;".
 
constexpr std::string_view Lib = "lib"
 Hardcoded name for nixpkgs "lib".
 

Function Documentation

◆ mkSelector() [1/3]

nixd::Selector nixd::idioms::mkSelector ( const nixf::AttrPath & AP,
Selector BaseSelector )

Construct a nixd::Selector from AP.

Definition at line 249 of file AST.cpp.

References nixf::AttrPath::names().

Referenced by mkSelector(), and mkSelector().

◆ mkSelector() [2/3]

Construct a nixd::Selector from Select.

Definition at line 260 of file AST.cpp.

References nixf::ExprSelect::expr(), nixf::Node::kind(), mkSelector(), and mkVarSelector().

◆ mkSelector() [3/3]

nixd::Selector nixd::idioms::mkSelector ( const nixf::ExprSelect & Select,
nixd::Selector BaseSelector )

Construct a nixd::Selector from Select.

Definition at line 189 of file AST.cpp.

References mkSelector(), and nixf::ExprSelect::path().

◆ mkVarSelector()

Construct a nixd::Selector from Var.

Try to heuristically find a selector of a variable, based on some known idioms.

Definition at line 199 of file AST.cpp.

References nixf::ExprVar::id(), nixf::Node::kind(), nixf::Identifier::name(), nixf::VariableLookupAnalysis::query(), nixf::ParentMapAnalysis::query(), and nixf::Definition::syntax().

Referenced by mkSelector().

Variable Documentation

◆ Lib

constexpr std::string_view nixd::idioms::Lib = "lib"
inlineconstexpr

Hardcoded name for nixpkgs "lib".

Assume that the value of this variable is "nixpkgs lib". e.g. lib.genAttrs.

Definition at line 26 of file AST.h.

◆ Pkgs

constexpr std::string_view nixd::idioms::Pkgs = "pkgs"
inlineconstexpr

Hardcoded name for "pkgs.xxx", or "with pkgs;".

Assume that the value of this variable have the same structure with `import nixpkgs {}

Definition at line 20 of file AST.h.