phino 0.0.0.65 → 0.0.0.66
raw patch · 5 files changed
+41/−11 lines, 5 filesdep ~containersdep ~filepathdep ~timePVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependency ranges changed: containers, filepath, time, xml-conduit
API changes (from Hackage documentation)
+ XMIR: escapeXML :: String -> String
Files
- README.md +1/−1
- phino.cabal +9/−9
- src/CLI/Runners.hs +4/−1
- src/XMIR.hs +12/−0
- test/CLISpec.hs +15/−0
README.md view
@@ -29,7 +29,7 @@ ```bash cabal update-cabal install --overwrite-policy=always phino-0.0.0.64+cabal install --overwrite-policy=always phino-0.0.0.65 phino --version ```
phino.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: phino-version: 0.0.0.65+version: 0.0.0.66 license: MIT synopsis: Command-Line Manipulator of 𝜑-Calculus Expressions description: Please see the README on GitHub at <https://github.com/objectionary/phino#readme>@@ -83,20 +83,20 @@ base >=4.18.3.0 && <5, binary-ieee754 >=0.1.0 && <0.2, bytestring >=0.11.4 && <0.13,- containers >=0.6.5 && <0.8,+ containers >=0.6.5 && <0.9, directory >=1.3.7 && <1.4, file-embed >=0.0.15 && <0.0.17,- filepath >=1.4.200 && <1.5,+ filepath >=1.4.200 && <1.6, megaparsec >=9.5 && <9.8, optparse-applicative >=0.18 && <0.20, random >=1.2 && <1.3, regex-pcre-builtin >=0.95.2 && <0.96, scientific >=0.3.7 && <0.4, text >=2.0.2 && <2.2,- time >=1.12 && <1.15,+ time >=1.12 && <1.16, utf8-string >=1.0.2 && <1.1, vector >=0.13.0 && <0.14,- xml-conduit >=1.9 && <1.10,+ xml-conduit >=1.9 && <1.11, yaml >=0.11.8 && <0.12, default-language: Haskell2010@@ -155,9 +155,9 @@ aeson >=2.2.3 && <2.3, base >=4.18.3.0 && <5, bytestring >=0.11.4 && <0.13,- containers >=0.6.5 && <0.8,+ containers >=0.6.5 && <0.9, directory >=1.3.7 && <1.4,- filepath >=1.4.200 && <1.5,+ filepath >=1.4.200 && <1.6, hspec >=2.11.0 && <2.12, hspec-core >=2.11.0 && <2.12, megaparsec >=9.5 && <9.8,@@ -166,8 +166,8 @@ process >=1.6.17 && <1.7, silently >=1.2.5 && <1.3, text >=2.0.2 && <2.2,- time >=1.12 && <1.15,- xml-conduit >=1.9 && <1.10,+ time >=1.12 && <1.16,+ xml-conduit >=1.9 && <1.11, yaml >=0.11.8 && <0.12, build-tool-depends:
src/CLI/Runners.hs view
@@ -43,7 +43,10 @@ input <- readInput _inputFile rules <- getRules _normalize _shuffle _rules program <- parseProgram input _inputFormat- let listing = if null rules then const input else (\prog -> P.printProgram' prog (_sugarType, UNICODE, _flat, _margin))+ let listing = case (rules, _inputFormat, _outputFormat) of+ ([], XMIR, XMIR) -> (\_ -> escapeXML input)+ ([], _, _) -> const input+ (_, _, _) -> (\prog -> P.printProgram' prog (_sugarType, UNICODE, _flat, _margin)) xmirCtx = XmirContext _omitListing _omitComments listing printCtx = printProgCtx xmirCtx foc canonize = if _canonize then C.canonize else id
src/XMIR.hs view
@@ -14,6 +14,7 @@ , parseXMIRThrows , xmirToPhi , defaultXmirContext+ , escapeXML , XmirContext (XmirContext) ) where@@ -253,6 +254,17 @@ nanos = floor (fractional * 1_000_000_000) :: Int in base ++ "." ++ printf "%09d" nanos ++ "Z" programToXMIR prog _ = throwIO (UnsupportedProgram prog)++escapeXML :: String -> String+escapeXML = concatMap escapeChar+ where+ escapeChar :: Char -> String+ escapeChar '&' = "&"+ escapeChar '<' = "<"+ escapeChar '>' = ">"+ escapeChar '"' = """+ escapeChar '\'' = "'"+ escapeChar ch = [ch] -- Add indentation (2 spaces per level). indent :: Int -> TB.Builder
test/CLISpec.hs view
@@ -411,6 +411,21 @@ ["rewrite", "--input=xmir", "--sweet"] ["{⟦ app ↦ ⟦ x ↦ Φ.number ⟧ ⟧}"] + it "rewrites and prints with XMIR as input and output" $+ withStdin+ ( intercalate+ ""+ [ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+ , "<object><o name=\"app\"><o name=\"x\" base=\"Φ.number\"/></o></object>"+ ]+ )+ ( testCLISucceeded+ ["rewrite", "--input=xmir", "--output=xmir", "--sweet"]+ [ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+ , "<listing><?xml version="1.0" encoding="UTF-8"?><object><o name="app"><o name="x" base="Φ.number"/></o></object></listing>"+ ]+ )+ it "rewrites as XMIR with omit-listing flag" $ withStdin "Q -> [[ x -> Q.y ]]" $ testCLISucceeded