about summary refs log tree commit diff
path: root/src/nix-instantiate/nix.sdf
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-11-19T10·04+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-11-19T10·04+0000
commit2be8b5917a8040fac72e7970e94bbb436e8c35d6 (patch)
tree6a5752e31772f26666057aa50fa40ee7f39f5265 /src/nix-instantiate/nix.sdf
parent38946e1378d50cf2921c509635e2119216fc9b0c (diff)
* Use `sdftable -s' to get warnings about the grammar.
* Several bug fixes in the grammar.
* Allow one-line comments (#... and //...) to end in EOF.

Diffstat (limited to 'src/nix-instantiate/nix.sdf')
-rw-r--r--src/nix-instantiate/nix.sdf30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/nix-instantiate/nix.sdf b/src/nix-instantiate/nix.sdf
index 54f5d5266f79..615bdb974775 100644
--- a/src/nix-instantiate/nix.sdf
+++ b/src/nix-instantiate/nix.sdf
@@ -17,7 +17,7 @@ imports Fix-Exprs Fix-Layout
 module Fix-Exprs
 imports Fix-Lexicals URI
 exports
-  sorts Expr Bind Formal
+  sorts Expr Formal Bind Binds BindSemi ExprList
   context-free syntax
 
     Id -> Expr {cons("Var")}
@@ -34,11 +34,11 @@ exports
 
     Expr Expr -> Expr {cons("Call"), left}
 
-    "{" {Formal ","}* "}" ":" Expr -> Expr {cons("Function"), right}
+    "{" {Formal ","}* "}" ":" Expr -> Expr {cons("Function")}
     Id -> Formal {cons("NoDefFormal")}
     Id "?" Expr -> Formal {cons("DefFormal")}
 
-    "assert" Expr ";" Expr -> Expr {cons("Assert"), right}
+    "assert" Expr ";" Expr -> Expr {cons("Assert")}
 
     "rec" "{" Binds "}" -> Expr {cons("Rec")}
     "let" "{" Binds "}" -> Expr {cons("LetRec")}
@@ -87,7 +87,7 @@ exports
 
 module Fix-Lexicals
 exports
-  sorts Id Path
+  sorts Id Int Str Path PathComp Bool
   lexical syntax
     [a-zA-Z\_][a-zA-Z0-9\_\']* -> Id
     "rec" -> Id {reject}
@@ -120,12 +120,17 @@ exports
 
 module URI
 exports
-  sorts Uri
+  sorts Uri Uhierpart Uopaquepart Uuricnoslash Unetpath Uabspath
+        Urelpath Urelsegment Uscheme Uauthority Uregname Userver
+        Uuserinfo Uhostport Uhost Uhostname Udomainlabel Utoplabel
+        UIPv4address Uport Upath Upathsegments Usegment Uparam
+        Upchar Uquery Ufragment Uuric Ureserved Uunreserved Umark
+        Uescaped Uhex Ualphanum Ualpha Ulowalpha Uupalpha Udigit
   lexical syntax
-    Uscheme ":" (Uhierpath | Uopaquepath) -> Uri
+    Uscheme ":" (Uhierpart | Uopaquepart) -> Uri
 
-    (Unetpath | Uabspath) ("?" Uquery)? -> Uhierpath
-    Uuricnoslash Uuric* -> Uopaquepath
+    (Unetpath | Uabspath) ("?" Uquery)? -> Uhierpart
+    Uuricnoslash Uuric* -> Uopaquepart
 
     Uunreserved | Uescaped | [\;\?\:\@\&\=\+\$\,] -> Uuricnoslash
 
@@ -187,17 +192,18 @@ exports
 
 module Fix-Layout
 exports
+  sorts HashComment Asterisk Comment EOF
   lexical syntax
     [\ \t\n] -> LAYOUT
     HashComment -> LAYOUT
     Comment -> LAYOUT
-    "#" ~[\n]* [\n] -> HashComment
-    "//" ~[\n]* [\n] -> HashComment
+    "#" ~[\n]* ([\n] | EOF) -> HashComment
+    "//" ~[\n]* ([\n] | EOF) -> HashComment
     "/*" ( ~[\*] | Asterisk )* "*/" -> Comment
     [\*] -> Asterisk
+    "" -> EOF
   lexical restrictions
     Asterisk -/- [\/]
+    EOF -/- ~[]
   context-free restrictions
     LAYOUT? -/- [\ \t\n] | [\#]
-  syntax
-    HashComment <START> -> <START>