diff --git a/src/Compiler/ES/Javascript.idr b/src/Compiler/ES/Javascript.idr index ca82ab931..ea325ce02 100644 --- a/src/Compiler/ES/Javascript.idr +++ b/src/Compiler/ES/Javascript.idr @@ -27,22 +27,22 @@ compileToJS c tm = compileToES c Javascript tm ["browser", "javascript"] htmlHeader : String htmlHeader = """ - - - - - - - - -""" + + + + """ addHeaderAndFooter : String -> String -> String addHeaderAndFooter outfile es = diff --git a/src/Compiler/Scheme/Chez.idr b/src/Compiler/Scheme/Chez.idr index 3522b1d31..dcd15a5ac 100644 --- a/src/Compiler/Scheme/Chez.idr +++ b/src/Compiler/Scheme/Chez.idr @@ -110,11 +110,11 @@ schHeader chez libs whole schFooter : Bool -> Bool -> String schFooter prof whole = """ - (collect 4) - (blodwen-run-finalisers) - \{ (if prof then "(profile-dump-html)" else "") } - \{ (if whole then ")" else "") } -""" + (collect 4) + (blodwen-run-finalisers) + \{ (if prof then "(profile-dump-html)" else "") } + \{ (if whole then ")" else "") } + """ showChezChar : Char -> String -> String showChezChar '\\' = ("\\\\" ++) @@ -392,55 +392,55 @@ getFgnCall version (n, fc, d) = schFgnDef fc n d version export startChezPreamble : String startChezPreamble = #""" -#!/bin/sh -# \#{ (generatedString "Chez") } + #!/bin/sh + # \#{ (generatedString "Chez") } -set -e # exit on any error + set -e # exit on any error -if [ "$(uname)" = Darwin ]; then - DIR=$(zsh -c 'printf %s "$0:A:h"' "$0") -else - DIR=$(dirname "$(readlink -f -- "$0")") -fi + if [ "$(uname)" = Darwin ]; then + DIR=$(zsh -c 'printf %s "$0:A:h"' "$0") + else + DIR=$(dirname "$(readlink -f -- "$0")") + fi -"""# + """# startChez : String -> String -> String startChez appdir target = startChezPreamble ++ #""" -export LD_LIBRARY_PATH="$DIR/\#{ appdir }":$LD_LIBRARY_PATH -export DYLD_LIBRARY_PATH="$DIR/\#{ appdir }":$DYLD_LIBRARY_PATH -export IDRIS2_INC_SRC="$DIR/\#{ appdir }" + export LD_LIBRARY_PATH="$DIR/\#{ appdir }":$LD_LIBRARY_PATH + export DYLD_LIBRARY_PATH="$DIR/\#{ appdir }":$DYLD_LIBRARY_PATH + export IDRIS2_INC_SRC="$DIR/\#{ appdir }" -"$DIR/\#{ target }" "$@" -"""# + "$DIR/\#{ target }" "$@" + """# startChezCmd : String -> String -> String -> String startChezCmd chez appdir target progType = #""" -@echo off + @echo off -rem \#{ (generatedString "Chez") } + rem \#{ (generatedString "Chez") } -set APPDIR=%~dp0 -set PATH=%APPDIR%\#{ appdir };%PATH% -set IDRIS2_INC_SRC=%APPDIR%\#{ appdir } + set APPDIR=%~dp0 + set PATH=%APPDIR%\#{ appdir };%PATH% + set IDRIS2_INC_SRC=%APPDIR%\#{ appdir } -"\#{ chez }" \#{ progType } "%APPDIR%\#{ target }" %* -"""# + "\#{ chez }" \#{ progType } "%APPDIR%\#{ target }" %* + """# startChezWinSh : String -> String -> String -> String startChezWinSh chez appdir target progType = #""" -#!/bin/sh -# \#{ (generatedString "Chez") } + #!/bin/sh + # \#{ (generatedString "Chez") } -set -e # exit on any error + set -e # exit on any error -DIR=$(dirname "$(readlink -f -- "$0" || cygpath -a -- "$0")") -PATH="$DIR/\#{ appdir }":$PATH + DIR=$(dirname "$(readlink -f -- "$0" || cygpath -a -- "$0")") + PATH="$DIR/\#{ appdir }":$PATH -export IDRIS2_INC_SRC="$DIR/\#{ appdir }" + export IDRIS2_INC_SRC="$DIR/\#{ appdir }" -"\#{ chez }" \#{ progType } "$DIR/\#{ target }" "$@" -"""# + "\#{ chez }" \#{ progType } "$DIR/\#{ target }" "$@" + """# ||| Compile a TT expression to Chez Scheme compileToSS : Ref Ctxt Defs -> diff --git a/src/Compiler/Scheme/ChezSep.idr b/src/Compiler/Scheme/ChezSep.idr index f7e5b1cbc..91b10db58 100644 --- a/src/Compiler/Scheme/ChezSep.idr +++ b/src/Compiler/Scheme/ChezSep.idr @@ -50,57 +50,57 @@ schHeader libs compilationUnits = """ \{ unlines [" (load-shared-object \"" ++ escapeStringChez lib ++ "\")" | lib <- libs] }) -""" + """ schFooter : String schFooter = """ -(collect 4) -(blodwen-run-finalisers) -""" + (collect 4) + (blodwen-run-finalisers) + """ startChez : String -> String -> String -> String startChez chez appDirSh targetSh = Chez.startChezPreamble ++ #""" -export LD_LIBRARY_PATH="$DIR/\#{ appDirSh }":$LD_LIBRARY_PATH -export DYLD_LIBRARY_PATH="$DIR/\#{ appDirSh }":$DYLD_LIBRARY_PATH + export LD_LIBRARY_PATH="$DIR/\#{ appDirSh }":$LD_LIBRARY_PATH + export DYLD_LIBRARY_PATH="$DIR/\#{ appDirSh }":$DYLD_LIBRARY_PATH -"\#{ chez }" -q \ - --libdirs "$DIR/\#{ appDirSh }" \ - --program "$DIR/\#{ targetSh }" \ - "$@" -"""# + "\#{ chez }" -q \ + --libdirs "$DIR/\#{ appDirSh }" \ + --program "$DIR/\#{ targetSh }" \ + "$@" + """# startChezCmd : String -> String -> String -> String startChezCmd chez appDirSh targetSh = #""" -@echo off + @echo off -rem \#{ (generatedString "ChezSep") } + rem \#{ (generatedString "ChezSep") } -set APPDIR=%~dp0 -set PATH=%APPDIR%\#{ appDirSh };%PATH% + set APPDIR=%~dp0 + set PATH=%APPDIR%\#{ appDirSh };%PATH% -"\#{ chez }" -q \ - --libdirs "%APPDIR%\#{ appDirSh }" \ - --program "%APPDIR%\#{ targetSh }" \ - %* -"""# + "\#{ chez }" -q \ + --libdirs "%APPDIR%\#{ appDirSh }" \ + --program "%APPDIR%\#{ targetSh }" \ + %* + """# startChezWinSh : String -> String -> String -> String startChezWinSh chez appDirSh targetSh = #""" -#!/bin/sh -# \#{ (generatedString "ChezSep") } + #!/bin/sh + # \#{ (generatedString "ChezSep") } -set -e # exit on any error + set -e # exit on any error -DIR=$(dirname "$(readlink -f -- "$0" || cygpath -a -- "$0")") -PATH="$DIR/\#{ appDirSh }":$PATH + DIR=$(dirname "$(readlink -f -- "$0" || cygpath -a -- "$0")") + PATH="$DIR/\#{ appDirSh }":$PATH -"\#{ chez }" --program "$DIR/\#{ targetSh }" "$@" -"\#{ chez }" -q \ - --libdirs "$DIR/\#{ appDirSh }" \ - --program "$DIR/\#{ targetSh }" \ - "$@" -"""# + "\#{ chez }" --program "$DIR/\#{ targetSh }" "$@" + "\#{ chez }" -q \ + --libdirs "$DIR/\#{ appDirSh }" \ + --program "$DIR/\#{ targetSh }" \ + "$@" + """# -- TODO: parallelise this compileChezLibraries : (chez : String) -> (libDir : String) -> (ssFiles : List String) -> Core () diff --git a/src/Compiler/Scheme/Gambit.idr b/src/Compiler/Scheme/Gambit.idr index 453aa665c..57ef7142b 100644 --- a/src/Compiler/Scheme/Gambit.idr +++ b/src/Compiler/Scheme/Gambit.idr @@ -50,15 +50,15 @@ findGSCBackend = schHeader : String schHeader = """ -;; \{ (generatedString "Gambit") } -(declare (block) - (inlining-limit 450) - (standard-bindings) - (extended-bindings) - (not safe) - (optimize-dead-definitions)) + ;; \{ (generatedString "Gambit") } + (declare (block) + (inlining-limit 450) + (standard-bindings) + (extended-bindings) + (not safe) + (optimize-dead-definitions)) -""" + """ showGambitChar : Char -> String -> String showGambitChar '\\' = ("\\\\" ++) diff --git a/src/Compiler/Scheme/Racket.idr b/src/Compiler/Scheme/Racket.idr index dbb49bbdd..5b822d256 100644 --- a/src/Compiler/Scheme/Racket.idr +++ b/src/Compiler/Scheme/Racket.idr @@ -43,28 +43,28 @@ findRacoExe = schHeader : Bool -> String -> String schHeader prof libs = """ -#lang racket/base -;; \{ (generatedString "Racket") } -(require racket/async-channel) ; for asynchronous channels -(require racket/future) ; for parallelism/concurrency -(require racket/math) ; for math ops -(require racket/system) ; for system -(require rnrs/bytevectors-6) ; for buffers -(require rnrs/io/ports-6) ; for files -(require srfi/19) ; for file handling and data -(require ffi/unsafe ffi/unsafe/define) ; for calling C -\{ (if prof then "(require profile)" else "") } -(require racket/flonum) ; for float-typed transcendental functions -\{ libs } -(let () + #lang racket/base + ;; \{ (generatedString "Racket") } + (require racket/async-channel) ; for asynchronous channels + (require racket/future) ; for parallelism/concurrency + (require racket/math) ; for math ops + (require racket/system) ; for system + (require rnrs/bytevectors-6) ; for buffers + (require rnrs/io/ports-6) ; for files + (require srfi/19) ; for file handling and data + (require ffi/unsafe ffi/unsafe/define) ; for calling C + \{ (if prof then "(require profile)" else "") } + (require racket/flonum) ; for float-typed transcendental functions + \{ libs } + (let () -""" + """ schFooter : String schFooter = """ -) -(collect-garbage) -""" + ) + (collect-garbage) + """ showRacketChar : Char -> String -> String showRacketChar '\\' = ("\\\\" ++) @@ -336,47 +336,47 @@ getFgnCall appdir (n, fc, d) = schFgnDef appdir fc n d startRacket : String -> String -> String -> String startRacket racket appdir target = #""" -#!/bin/sh -# \#{ (generatedString "Racket") } + #!/bin/sh + # \#{ (generatedString "Racket") } -set -e # exit on any error + set -e # exit on any error -if [ "$(uname)" = Darwin ]; then - DIR=$(zsh -c 'printf %s "$0:A:h"' "$0") -else - DIR=$(dirname "$(readlink -f -- "$0")") -fi + if [ "$(uname)" = Darwin ]; then + DIR=$(zsh -c 'printf %s "$0:A:h"' "$0") + else + DIR=$(dirname "$(readlink -f -- "$0")") + fi -export LD_LIBRARY_PATH="$DIR/\#{ appdir }":$LD_LIBRARY_PATH -export DYLD_LIBRARY_PATH="$DIR/\#{ appdir }":$DYLD_LIBRARY_PATH + export LD_LIBRARY_PATH="$DIR/\#{ appdir }":$LD_LIBRARY_PATH + export DYLD_LIBRARY_PATH="$DIR/\#{ appdir }":$DYLD_LIBRARY_PATH -\#{ racket } "$DIR/\#{ target }" "$@" -"""# + \#{ racket } "$DIR/\#{ target }" "$@" + """# startRacketCmd : String -> String -> String -> String startRacketCmd racket appdir target = #""" -@echo off + @echo off -rem \#{ (generatedString "Racket") } + rem \#{ (generatedString "Racket") } -set APPDIR=%~dp0 -set PATH=%APPDIR%\#{ appdir };%PATH% + set APPDIR=%~dp0 + set PATH=%APPDIR%\#{ appdir };%PATH% -\#{ racket } "%APPDIR%\#{ target }" %* -"""# + \#{ racket } "%APPDIR%\#{ target }" %* + """# startRacketWinSh : String -> String -> String -> String startRacketWinSh racket appdir target = #""" -#!/bin/sh -# \#{ (generatedString "Racket") } + #!/bin/sh + # \#{ (generatedString "Racket") } -set -e # exit on any error + set -e # exit on any error -DIR=$(dirname "$(readlink -f -- "$0" || cygpath -a -- "$0")") -PATH="$DIR/\#{ appdir }":$PATH + DIR=$(dirname "$(readlink -f -- "$0" || cygpath -a -- "$0")") + PATH="$DIR/\#{ appdir }":$PATH -\#{ racket } "$DIR/\#{ target }" "$@" -"""# + \#{ racket } "$DIR/\#{ target }" "$@" + """# compileToRKT : Ref Ctxt Defs -> String -> ClosedTerm -> (outfile : String) -> Core () diff --git a/src/Idris/CommandLine.idr b/src/Idris/CommandLine.idr index 5dec38af4..0b3a3d239 100644 --- a/src/Idris/CommandLine.idr +++ b/src/Idris/CommandLine.idr @@ -403,15 +403,15 @@ versionMsg = "Idris 2, version " ++ show version export usage : String usage = """ -\{ versionMsg } -Usage: idris2 [options] [input file] + \{ versionMsg } + Usage: idris2 [options] [input file] -Available options: -\{ optsUsage } + Available options: + \{ optsUsage } -Environment variables: -\{ envsUsage } -""" + Environment variables: + \{ envsUsage } + """ checkNat : Integer -> Maybe Nat checkNat n = toMaybe (n >= 0) (integerToNat n) diff --git a/src/Idris/Driver.idr b/src/Idris/Driver.idr index f3723f4ae..14b26b425 100644 --- a/src/Idris/Driver.idr +++ b/src/Idris/Driver.idr @@ -133,14 +133,14 @@ tryTTM (c :: cs) = tryTTM cs banner : String banner = #""" - ____ __ _ ___ - / _/___/ /____(_)____ |__ \ - / // __ / ___/ / ___/ __/ / Version \#{ showVersion True version } - _/ // /_/ / / / (__ ) / __/ https://www.idris-lang.org - /___/\__,_/_/ /_/____/ /____/ Type :? for help + ____ __ _ ___ + / _/___/ /____(_)____ |__ \ + / // __ / ___/ / ___/ __/ / Version \#{ showVersion True version } + _/ // /_/ / / / (__ ) / __/ https://www.idris-lang.org + /___/\__,_/_/ /_/____/ /____/ Type :? for help -Welcome to Idris 2. Enjoy yourself! -"""# + Welcome to Idris 2. Enjoy yourself! + """# checkVerbose : List CLOpt -> Bool checkVerbose [] = False diff --git a/src/Idris/Package.idr b/src/Idris/Package.idr index 6d2c08e5f..d22d9e42a 100644 --- a/src/Idris/Package.idr +++ b/src/Idris/Package.idr @@ -780,22 +780,22 @@ partitionOpts opts = foldr pOptUpdate (MkPFR [] [] False) opts errorMsg : String errorMsg = """ -Not all command line options can be used to override package options. + Not all command line options can be used to override package options. -Overridable options are: - --quiet - --verbose - --timing - --log - --dumpcases - --dumplifted - --dumpvmcode - --debug-elab-check - --codegen - --directive - --build-dir - --output-dir -""" + Overridable options are: + --quiet + --verbose + --timing + --log + --dumpcases + --dumplifted + --dumpvmcode + --debug-elab-check + --codegen + --directive + --build-dir + --output-dir + """ export processPackageOpts : {auto c : Ref Ctxt Defs} -> diff --git a/src/Idris/SetOptions.idr b/src/Idris/SetOptions.idr index 14b25087e..89a831a51 100644 --- a/src/Idris/SetOptions.idr +++ b/src/Idris/SetOptions.idr @@ -249,14 +249,14 @@ opts x _ = pure $ if (x `elem` optionFlags) -- bash autocompletion script using the given function name completionScript : (fun : String) -> String completionScript fun = let fun' = "_" ++ fun in #""" -\#{ fun' }() -{ - ED=$([ -z $2 ] && echo "--" || echo $2) - COMPREPLY=($(idris2 --bash-completion $ED $3)) -} + \#{ fun' }() + { + ED=$([ -z $2 ] && echo "--" || echo $2) + COMPREPLY=($(idris2 --bash-completion $ED $3)) + } -complete -F \#{ fun' } -o default idris2 -"""# + complete -F \#{ fun' } -o default idris2 + """# -------------------------------------------------------------------------------- -- Processing Options