Skip to content

Commit

Permalink
nixd/Syntax: add more derivation rules
Browse files Browse the repository at this point in the history
  • Loading branch information
inclyc committed Sep 16, 2023
1 parent 205e139 commit 2548a2e
Showing 1 changed file with 42 additions and 6 deletions.
48 changes: 42 additions & 6 deletions nixd/lib/Syntax/Parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@
%token <STR> STR IND_STR
%token <PATH> PATH HPATH SPATH PATH_END
%token <URI> URI
/* %token <id> ID ATTRPATH
%token <str> STR IND_STR
%token <n> INT
%token <nf> FLOAT
%token <path> PATH HPATH SPATH PATH_END
%token <uri> URI */
%token IF THEN ELSE ASSERT WITH LET IN REC INHERIT EQ NEQ AND OR IMPL OR_KW
%token DOLLAR_CURLY /* == ${ */
%token IND_STRING_OPEN IND_STRING_CLOSE
Expand Down Expand Up @@ -134,6 +128,43 @@ expr_select

expr_simple
: identifier
| INT
| FLOAT
| '"' string_parts '"'
| IND_STRING_OPEN ind_string_parts IND_STRING_CLOSE
| path_start PATH_END
| path_start string_parts_interpolated PATH_END
| SPATH
| URI
| '(' expr ')'
| LET '{' binds '}'
| REC '{' binds '}'
| '{' binds '}'
| '[' expr_list ']'
;

string_parts
: STR
| string_parts_interpolated
|
;

string_parts_interpolated
: string_parts_interpolated STR
| string_parts_interpolated DOLLAR_CURLY expr '}'
| DOLLAR_CURLY expr '}'
| STR DOLLAR_CURLY expr '}'
;

path_start
: PATH
| HPATH
;

ind_string_parts
: ind_string_parts IND_STR
| ind_string_parts DOLLAR_CURLY expr '}'
|
;

identifier
Expand Down Expand Up @@ -171,6 +202,11 @@ string_attr
: DOLLAR_CURLY expr '}'
;

expr_list
: expr_list expr_select
|
;

formals
: formal ',' formals
| formal
Expand Down

0 comments on commit 2548a2e

Please sign in to comment.