diff --git a/Nix/Parser.hs b/Nix/Parser.hs index 0c054f8..a578748 100644 --- a/Nix/Parser.hs +++ b/Nix/Parser.hs @@ -159,57 +159,3 @@ lookaheadForSet = do parseNixFile :: MonadIO m => FilePath -> m (Result NExpr) parseNixFile = parseFromFileEx nixApp - -{- - -Grammar of the Nix language (LL(n)). I conditionalize terms in the grammar -with a predicate suffix in square brackets. If the predicate fails, we -back-track. WS is used to indicate where arbitrary whitespace is allowed. - -top ::= app - -Applied expressions, or "expr expr", express function application. Since they -do not mean this within lists, we must call it out as a separate grammar rule so -that we can make clear when it is allowed. - -app ::= expr WS+ app | (epsilon) - -expr ::= atom - | '(' app ')' - | '[' list_members ']' - | "rec"[opt] '{' set_members[one kv_pair exists] '}' - | argspec ':' app - -atom ::= INTEGER - | "true" | "false" - | "null" - | CHAR(0-9A-Za-z_./)+[elem '/'] - | '"' string '"' - -Strings are a bit special in that not only do they observe escaping conventions, -but they allow for interpolation of arbitrary Nix expressions. This means -they form a sub-grammar, so we assume a lexical context switch here. - -string ::= string_elem string | (epsilon) - -string_elem ::= '\' ANYCHAR | subexpr | ANYCHAR+ - -subexpr ::= "${" WS* app "}" - -list_members ::= expr WS+ list_members | (epsilon) - -set_members ::= kv_pair WS* ';' WS* set_members | (epsilon) - -kv_pair ::= stringish WS* '=' WS* app - -stringish ::= string | CHAR(0-9A-Za-z_.)+ | subexpr - -argspec ::= CHAR(0-9A-Za-z_)+ | '{' arg_list '}' - -arg_list ::= arg_specifier | arg_specifier ',' arg_list - -arg_specifier ::= CHAR(0-9A-Za-z_)+ default_value[opt] - -default_value ::= '?' app - --}