Commit 2e31f847 authored by Marc Coiffier's avatar Marc Coiffier
Browse files

Try a release for the capricon interpreter

parent d45177d7
......@@ -57,6 +57,7 @@ script:
branches:
only:
- master
- capricon
- /^v\d+(\.\d+)*(-\S*)?$/
deploy:
......@@ -65,6 +66,7 @@ deploy:
file:
- curly~$TRAVIS_OS_NAME~$HOST_ARCH.tar.xz
- curly-gateway~$TRAVIS_OS_NAME~$HOST_ARCH.tar.xz
- capricon~$TRAVIS_OS_NAME~$HOST_ARCH.tar.xz
skip_cleanup: true
on:
tags: true
......
......@@ -10,9 +10,12 @@ endif
ifdef PREFIX
STACK_FLAGS += --local-install-root $(PREFIX)
endif
ifndef TARGETS
TARGETS := curly
endif
build:
stack build $(STACK_FLAGS)
stack build $(STACK_FLAGS) $(TARGETS)
doc: STACK_FLAGS += --haddock
doc: build
......
-- Initial misc.cabal generated by cabal init. For further documentation,
-- see http://haskell.org/cabal/users-guide/
name: misc
version: 0.1.0.0
name: capricon
version: 0.5.4
-- synopsis:
-- description:
license: GPL-3
......@@ -28,16 +28,16 @@ executable capricon
default-extensions: RebindableSyntax
-- other-modules:
-- other-extensions:
build-depends: base >=4.9 && <4.10,curly-core >=0.7 && <0.8,definitive-base >=2.6 && <2.7, definitive-parser, misc, hreadline, directory, filepath
ghc-options: -Wincomplete-patterns -Wname-shadowing -Werror
hs-source-dirs: exe
default-language: Haskell2010
executable coinche
main-is: Coinche.hs
default-extensions: RebindableSyntax
-- other-modules:
-- other-extensions:
build-depends: base >=4.9 && <4.10,definitive-base >=2.6 && <2.7, definitive-parser, misc, random, random-shuffle
build-depends: base >=4.9 && <4.10,curly-core >=0.7 && <0.8,definitive-base >=2.6 && <2.7, definitive-parser, capricon, hreadline, directory, filepath
ghc-options: -Wincomplete-patterns -Wname-shadowing -Werror
hs-source-dirs: exe
default-language: Haskell2010
-- executable coinche
-- main-is: Coinche.hs
-- default-extensions: RebindableSyntax
-- -- other-modules:
-- -- other-extensions:
-- build-depends: base >=4.9 && <4.10,definitive-base >=2.6 && <2.7, definitive-parser, misc, random, random-shuffle
-- ghc-options: -Wincomplete-patterns -Wname-shadowing -Werror
-- hs-source-dirs: exe
-- default-language: Haskell2010
......@@ -343,6 +343,11 @@ showDir = lens _showDir (\x y -> x { _showDir = y })
outputHandle :: Lens' COCState Handle
outputHandle = lens _outputHandle (\x y -> x { _outputHandle = y })
htmlQuote = foldMap qChar
where qChar '<' = "&lt;"
qChar '>' = "&gt;"
qChar '&' = "&amp;"
qChar c = [c]
stringWords = fromBlank
where fromBlank (c:t) | c `elem` " \n\t\r" = fromBlank t
| c == '"' = fromQuote id t
......@@ -398,17 +403,18 @@ runCOCBuiltin COCB_Open = do
xs <- lift (try (return []) (try (readString f) (readString (f+".md")) >>= maybe undefined return . matches Just literate))
runStackState (put (StackProg xs:t))
_ -> return ()
where literate = intercalate [":\n"] <$> sepBy' (cmdline (single '>') <+? cmdline (several " ")
where literate = intercalate [":\n"] <$> sepBy' (cmdline (several "> ") <+? cmdline (several "$> ")
<+? commentline) (single '\n')
wrapLabel hide x = "<label class=\"hide-label\"><input type=\"checkbox\" class=\"capricon-hide\" checked=\"checked\"/><span class=\"capricon-"+hide+"\"></span><span class=\"capricon-reveal\">"+x+"</span></label>"
wrapResult x l = (":<div class=\"capricon-"+x+"result\">") : l + [":</div>"]
cmdline pre = map (\x -> (":"+wrapLabel "hideparagraph" ("<pre class=\"capricon capricon-paragraph\">\n"+intercalate "\n" (map fst x)+"\n</pre>"))
: wrapResult "paragraph" (foldMap snd x)) (sepBy1' go (single '\n'))
wrapResult tag x l = (":<"+tag+" class=\"capricon-"+x+"result\">") : l + [":</"+tag+">"]
cmdline pre = map (\x -> (":"+wrapLabel "hideparagraph" ("<pre class=\"capricon capricon-paragraph\">"+htmlQuote (intercalate "\n" (map fst x))+"</pre>"))
: wrapResult "div" "paragraph" (foldMap snd x)) (sepBy1' go (single '\n'))
where go = do pre; many' (noneOf "\n") <&> \x -> (x,stringWords x)
commentline = map (foldMap (pure . (':':) <|> \(x,t) -> t+[':':(wrapLabel "hidestache" $ "<pre class=\"capricon\">"+x+"</pre>")])) $ (<* lookingAt eol)
commentline = map (foldMap (pure . (':':) <|> \(x,t) -> t+[':':(wrapLabel "hidestache" $ "<code class=\"capricon\">"+htmlQuote x+"</code>")])) $ (<* lookingAt eol)
$ many' (map Left (many1' (noneOf "{\n" <+? (fill '{' $ single '{' <* lookingAt (noneOf "{"))))
<+? map Right (between (several "{{") (several "}}")
(many1' (noneOf "}" <+? fill '}' (single '{' <* lookingAt (noneOf "}"))) <&> \x -> (x,wrapResult "" (stringWords x)))))
(many1' (noneOf "}" <+? fill '}' (single '{' <* lookingAt (noneOf "}"))) <&> \x -> (x,wrapResult "span" "" (stringWords x)))))
runCOCBuiltin COCB_ToInt = runStackState $ modify $ \case
......
......@@ -29,5 +29,5 @@ case "$BUILD" in
done
;;
esac
scripts/ci/build-package curly curly-gateway
scripts/ci/build-package curly curly-gateway capricon
set +ex
......@@ -35,22 +35,23 @@ resolver: lts-9.10
# A package marked 'extra-dep: true' will only be built if demanded by a
# non-dependency (i.e. a user package), and its test suites and benchmarks
# will not be run. This is useful for tweaking upstream packages.
packages:
- definitive-base
- definitive-parser
- definitive-network
- definitive-filesystem
- hreadline
- curly-kademlia
- curly-core
- curly-system
- curly
- curly-gateway
# - grow
- misc
packages: []
# Dependency packages to be pulled from upstream that are not in the resolver
# (e.g., acme-missiles-0.3)
extra-deps: [AES-0.2.9,kademlia-1.1.0.0]
extra-deps:
- AES-0.2.9
- kademlia-1.1.0.0
- ./curly
- ./capricon
- ./definitive-base
- ./definitive-parser
- ./definitive-network
- ./definitive-filesystem
- ./hreadline
- ./curly-kademlia
- ./curly-core
- ./curly-system
- ./curly-gateway
# Override default flag values for local packages and extra-deps
# flags: {}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment