build: fix Nixpkgs lock
[haskell/symantic-parser.git] / parsers / Parsers / Nandlang.hs
index aff89998fd96a8dbfa0c7d4aee55aec1929485b2..5f8e9aedf5881ec0aca5f4d09e837186314c10cf 100644 (file)
@@ -17,9 +17,8 @@ import Data.String (String)
 import qualified Data.Set as Set
 import qualified Data.Text as Text
 
-import Symantic.Univariant.Trans
+import qualified Symantic.Class as Prod
 import qualified Symantic.Parser as P
-import qualified Symantic.Parser.Haskell as H
 
 type Parser a = P.Parser Text.Text a
 
@@ -50,7 +49,7 @@ grammar = whitespace P.*> P.skipMany funcdef P.<* P.eof
   charLit = P.between (P.char '\'') (symbol '\'') charChar
   charChar :: repr ()
   charChar = P.void (P.satisfy
-    (trans (H.ValueCode nandStringLetter [||nandStringLetter||]))) P.<|> esc
+    (P.production nandStringLetter [||nandStringLetter||])) P.<|> esc
   esc :: repr ()
   esc = P.char '\\' P.*> P.void (P.oneOf "0tnvfr")
   expr :: repr ()
@@ -62,7 +61,7 @@ grammar = whitespace P.*> P.skipMany funcdef P.<* P.eof
   identifier :: repr ()
   identifier = P.try (identStart P.*> P.skipMany identLetter) P.*> whitespace
   identStart = P.satisfy
-    (trans (H.ValueCode nandIdentStart [||nandIdentStart||]))
+    (P.production nandIdentStart [||nandIdentStart||])
 
   exprlist  = commaSep expr
   exprlist1 = commaSep1 expr
@@ -84,18 +83,18 @@ grammar = whitespace P.*> P.skipMany funcdef P.<* P.eof
   block = braces (P.skipMany statement)
   statement =
     ifstmt P.<|> whilestmt P.<|> P.try varstmt P.<|> expr P.<* semi
-    -- P.pure H.unit
+    -- P.pure Prod.unit
   ifstmt = keyword "if" -- P.*> expr P.*> block P.*> P.optional (keyword "else" P.*> block)
   whilestmt = keyword "while" P.*> expr P.*> block
   varstmt = P.optional (keyword "var") P.*> varlist1 P.*> symbol '=' P.*> exprlist1 P.<* semi
   keyword :: String -> repr ()
-  keyword k = P.string k P.*> P.pure H.unit
+  keyword k = P.string k P.*> P.pure Prod.unit
   {-
   keyword s = P.try (P.string s P.*> notIdentLetter) P.*> whitespace
   notIdentLetter = P.negLook identLetter
   -}
   identLetter = P.satisfy
-    (trans (H.ValueCode nandIdentLetter [||nandIdentLetter||]))
+    (P.production nandIdentLetter [||nandIdentLetter||])
 
   -- hexadecimal = P.oneOf "xX" P.*> number (P.oneOf (['a'..'f'] <> ['A'..'F'] <> ['0'..'9']))
   -- octal = P.oneOf "oO" P.*> number (P.oneOf ['0'..'7'])
@@ -118,15 +117,14 @@ grammar = whitespace P.*> P.skipMany funcdef P.<* P.eof
   commaSep1 p = p P.*> P.skipMany (comma P.*> p)
 
   space :: repr ()
-  space = P.void (P.satisfy
-    (trans (H.ValueCode isSpace [||isSpace||])))
+  space = P.void (P.satisfy (P.production isSpace [||isSpace||]))
   whitespace :: repr ()
   whitespace = spaces
   {-
   whitespace = P.skipMany (spaces P.<|> oneLineComment)
   oneLineComment :: repr ()
   oneLineComment = P.void (P.string "//" P.*> P.skipMany (P.satisfy
-    (trans (H.ValueCode (/= '\n') [||(/= '\n')||]))))
+    (P.production (/= '\n') [||(/= '\n')||])))
   -}
   spaces :: repr ()
   spaces = P.skipSome space