Skip to content
Permalink
Browse files
Idris: Fixed import statements (#3115)
  • Loading branch information
RunDevelopment committed Oct 5, 2021
1 parent d359eea commit 15cb3b78ff52345ab96d4c7356eb81b2c55778bc
Showing with 105 additions and 15 deletions.
  1. +10 −4 components/prism-idris.js
  2. +1 −1 components/prism-idris.min.js
  3. +9 −1 tests/languages/idris/import_statement_feature.test
  4. +85 −9 tests/languages/idris/keyword_feature.test
@@ -3,11 +3,17 @@ Prism.languages.idris = Prism.languages.extend('haskell', {
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.insertBefore('idris', 'keyword', {
'import-statement': {
pattern: /(^\s*import\s+)(?:[A-Z][\w']*)(?:\.[A-Z][\w']*)*/m,
lookbehind: true,
inside: {
'punctuation': /\./
}
}
});

Prism.languages.idr = Prism.languages.idris;

Some generated files are not rendered by default. Learn more.

@@ -1,10 +1,18 @@
import Foo
import Maths.NumOps

----------------------------------------------------

[
["keyword", "import"],
["constant", ["Foo"]]
["import-statement", ["Foo"]],

["keyword", "import"],
["import-statement", [
"Maths",
["punctuation", "."],
"NumOps"
]]
]

----------------------------------------------------
@@ -1,17 +1,93 @@
case data do else if implementation
in infixl infixr interface let
module of then where
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

----------------------------------------------------

[
["keyword", "case"], ["keyword", "data"], ["keyword", "do"],
["keyword", "else"], ["keyword", "if"], ["keyword", "implementation"],
["keyword", "in"], ["keyword", "infixl"], ["keyword", "infixr"],
["keyword", "interface"], ["keyword", "let"], ["keyword", "module"],
["keyword", "of"], ["keyword", "then"], ["keyword", "where"]
["keyword", "Type"],
["keyword", "case"],
["keyword", "class"],
["keyword", "codata"],
["keyword", "constructor"],
["keyword", "corecord"],
["keyword", "data"],
["keyword", "do"],
["keyword", "dsl"],
["keyword", "else"],
["keyword", "export"],
["keyword", "if"],
["keyword", "implementation"],
["keyword", "implicit"],
["keyword", "import"],
["keyword", "impossible"],
["keyword", "in"],
["keyword", "infix"],
["keyword", "infixl"],
["keyword", "infixr"],
["keyword", "instance"],
["keyword", "interface"],
["keyword", "let"],
["keyword", "module"],
["keyword", "mutual"],
["keyword", "namespace"],
["keyword", "of"],
["keyword", "parameters"],
["keyword", "partial"],
["keyword", "postulate"],
["keyword", "private"],
["keyword", "proof"],
["keyword", "public"],
["keyword", "quoteGoal"],
["keyword", "record"],
["keyword", "rewrite"],
["keyword", "syntax"],
["keyword", "then"],
["keyword", "total"],
["keyword", "using"],
["keyword", "where"],
["keyword", "with"]
]

----------------------------------------------------

Checks for some keywords.
Checks for some keywords.

0 comments on commit 15cb3b7

Please sign in to comment.