Skip to content

Commit e931441

Browse files
authored
Added support for Idris (#2755)
1 parent 8019e2f commit e931441

18 files changed

+256
-3
lines changed

components.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

+6
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,12 @@
528528
"title": "Icon",
529529
"owner": "Golmote"
530530
},
531+
"idris": {
532+
"title": "Idris",
533+
"alias": "idr",
534+
"owner": "KeenS",
535+
"require": "haskell"
536+
},
531537
"ignore": {
532538
"title": ".ignore",
533539
"owner": "osipxd",

components/prism-idris.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Prism.languages.idris = Prism.languages.extend('haskell', {
2+
'comment': {
3+
pattern: /(?:(?:--|\|\|\|).*$|{-[\s\S]*?-})/m,
4+
},
5+
'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/,
6+
'import-statement': {
7+
pattern: /(^\s*)import\s+(?:[A-Z][\w']*)(?:\.[A-Z][\w']*)*/m,
8+
lookbehind: true
9+
},
10+
'builtin': undefined
11+
});
12+
13+
Prism.languages.idr = Prism.languages.idris;

components/prism-idris.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/prism-idris.html

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<h2>Comments</h2>
2+
<pre><code>-- Single line comment
3+
{- Multi-line
4+
comment -}</code></pre>
5+
6+
<h2>Strings and characters</h2>
7+
<pre><code>'a'
8+
'\n'
9+
'\^A'
10+
'\^]'
11+
'\NUL'
12+
'\23'
13+
'\o75'
14+
'\xFE'</code></pre>
15+
16+
<h2>Numbers</h2>
17+
<pre><code>42
18+
123.456
19+
123.456e-789
20+
1e+3
21+
0o74
22+
0XAF</code></pre>
23+
24+
<h2>Larger example</h2>
25+
<pre><code>module Main
26+
27+
import Data.Vect
28+
29+
-- this is comment
30+
record Person where
31+
constructor MkPerson2
32+
age : Integer
33+
name : String
34+
35+
||| identity function
36+
id : a -> a
37+
id x = x
38+
39+
{-
40+
Bool type can be defined in
41+
userland
42+
-}
43+
data Bool = True | False
44+
45+
implementation Show Bool where
46+
show True = "True"
47+
show False = "False"
48+
49+
not : Bool -> Bool
50+
not b = case b of
51+
True => False
52+
False => True
53+
54+
vect3 : Vect 3 Int
55+
vect3 = with Vect (1 :: 2 :: 3 :: Nil)
56+
</code></pre>

plugins/autoloader/prism-autoloader.js

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"handlebars": "markup-templating",
6161
"haxe": "clike",
6262
"hlsl": "c",
63+
"idris": "haskell",
6364
"java": "clike",
6465
"javadoc": [
6566
"markup",
@@ -186,6 +187,7 @@
186187
"xls": "excel-formula",
187188
"gamemakerlanguage": "gml",
188189
"hs": "haskell",
190+
"idr": "idris",
189191
"gitignore": "ignore",
190192
"hgignore": "ignore",
191193
"npmignore": "ignore",

plugins/autoloader/prism-autoloader.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/show-language/prism-show-language.js

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"hpkp": "HTTP Public-Key-Pins",
9090
"hsts": "HTTP Strict-Transport-Security",
9191
"ichigojam": "IchigoJam",
92+
"idr": "Idris",
9293
"ignore": ".ignore",
9394
"gitignore": ".gitignore",
9495
"hgignore": ".hgignore",

0 commit comments

Comments
 (0)