Skip to content

Commit

Permalink
Added support for Idris (#2755)
Browse files Browse the repository at this point in the history
  • Loading branch information
KeenS authored Feb 23, 2021
1 parent 8019e2f commit e931441
Show file tree
Hide file tree
Showing 18 changed files with 256 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,12 @@
"title": "Icon",
"owner": "Golmote"
},
"idris": {
"title": "Idris",
"alias": "idr",
"owner": "KeenS",
"require": "haskell"
},
"ignore": {
"title": ".ignore",
"owner": "osipxd",
Expand Down
13 changes: 13 additions & 0 deletions components/prism-idris.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Prism.languages.idris = Prism.languages.extend('haskell', {
'comment': {
pattern: /(?:(?:--|\|\|\|).*$|{-[\s\S]*?-})/m,
},
'keyword': /\b(?:Type|case|class|codata|constructor|corecord|data|do|dsl|else|export|if|implementation|implicit|import|impossible|in|infix|infixl|infixr|instance|interface|let|module|mutual|namespace|of|parameters|partial|postulate|private|proof|public|quoteGoal|record|rewrite|syntax|then|total|using|where|with)\b/,
'import-statement': {
pattern: /(^\s*)import\s+(?:[A-Z][\w']*)(?:\.[A-Z][\w']*)*/m,
lookbehind: true
},
'builtin': undefined
});

Prism.languages.idr = Prism.languages.idris;
1 change: 1 addition & 0 deletions components/prism-idris.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions examples/prism-idris.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<h2>Comments</h2>
<pre><code>-- Single line comment
{- Multi-line
comment -}</code></pre>

<h2>Strings and characters</h2>
<pre><code>'a'
'\n'
'\^A'
'\^]'
'\NUL'
'\23'
'\o75'
'\xFE'</code></pre>

<h2>Numbers</h2>
<pre><code>42
123.456
123.456e-789
1e+3
0o74
0XAF</code></pre>

<h2>Larger example</h2>
<pre><code>module Main

import Data.Vect

-- this is comment
record Person where
constructor MkPerson2
age : Integer
name : String

||| identity function
id : a -> a
id x = x

{-
Bool type can be defined in
userland
-}
data Bool = True | False

implementation Show Bool where
show True = "True"
show False = "False"

not : Bool -> Bool
not b = case b of
True => False
False => True

vect3 : Vect 3 Int
vect3 = with Vect (1 :: 2 :: 3 :: Nil)
</code></pre>
2 changes: 2 additions & 0 deletions plugins/autoloader/prism-autoloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"handlebars": "markup-templating",
"haxe": "clike",
"hlsl": "c",
"idris": "haskell",
"java": "clike",
"javadoc": [
"markup",
Expand Down Expand Up @@ -186,6 +187,7 @@
"xls": "excel-formula",
"gamemakerlanguage": "gml",
"hs": "haskell",
"idr": "idris",
"gitignore": "ignore",
"hgignore": "ignore",
"npmignore": "ignore",
Expand Down
2 changes: 1 addition & 1 deletion plugins/autoloader/prism-autoloader.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions plugins/show-language/prism-show-language.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"hpkp": "HTTP Public-Key-Pins",
"hsts": "HTTP Strict-Transport-Security",
"ichigojam": "IchigoJam",
"idr": "Idris",
"ignore": ".ignore",
"gitignore": ".gitignore",
"hgignore": ".hgignore",
Expand Down
Loading

0 comments on commit e931441

Please sign in to comment.