Skip to content

Instantly share code, notes, and snippets.

@PhilAndrew
Created March 20, 2013 02:45
Show Gist options
  • Save PhilAndrew/5201908 to your computer and use it in GitHub Desktop.
Save PhilAndrew/5201908 to your computer and use it in GitHub Desktop.
Textmate bundle which syntax highlights Idris Language. Replace existing Haskell.tmLanguage with this file. Only one change made.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>hs</string>
</array>
<key>keyEquivalent</key>
<string>^~H</string>
<key>name</key>
<string>Haskell</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.entity.haskell</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.definition.entity.haskell</string>
</dict>
</dict>
<key>comment</key>
<string>In case this regex seems unusual for an infix operator, note that Haskell allows any ordinary function application (elem 4 [1..10]) to be rewritten as an infix expression (4 `elem` [1..10]).</string>
<key>match</key>
<string>(`)[a-zA-Z_']*?(`)</string>
<key>name</key>
<string>keyword.operator.function.infix.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\(\)</string>
<key>name</key>
<string>constant.language.unit.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\[\]</string>
<key>name</key>
<string>constant.language.empty-list.haskell</string>
</dict>
<dict>
<key>begin</key>
<string>\b(class)\b</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.haskell</string>
</dict>
</dict>
<key>end</key>
<string>\b(where)\b</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.haskell</string>
</dict>
</dict>
<key>name</key>
<string>meta.declaration.class.haskell</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\b(Monad|Functor|Eq|Ord|Read|Show|Num|(Frac|Ra)tional|Enum|Bounded|Real(Frac|Float)?|Integral|Floating)\b</string>
<key>name</key>
<string>support.class.prelude.haskell</string>
</dict>
<dict>
<key>match</key>
<string>[A-Z][A-Za-z_']*</string>
<key>name</key>
<string>entity.other.inherited-class.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\b[a-z][a-zA-Z0-9_']*\b</string>
<key>name</key>
<string>variable.other.generic-type.haskell</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>\b(instance)\b</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.haskell</string>
</dict>
</dict>
<key>end</key>
<string>\b(where)\b|$</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.haskell</string>
</dict>
</dict>
<key>name</key>
<string>meta.declaration.instance.haskell</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#type_signature</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(import)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.haskell</string>
</dict>
</dict>
<key>end</key>
<string>($|;)</string>
<key>name</key>
<string>meta.import.haskell</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(qualified|as|hiding)</string>
<key>name</key>
<string>keyword.other.haskell</string>
</dict>
<dict>
<key>include</key>
<string>#module_name</string>
</dict>
<dict>
<key>include</key>
<string>#module_exports</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(deriving)\s*\(</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.haskell</string>
</dict>
</dict>
<key>end</key>
<string>\)</string>
<key>name</key>
<string>meta.deriving.haskell</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\b[A-Z][a-zA-Z_']*</string>
<key>name</key>
<string>entity.other.inherited-class.haskell</string>
</dict>
</array>
</dict>
<dict>
<key>match</key>
<string>\b(deriving|where|data|type|case|of|let|in|newtype|default)\b</string>
<key>name</key>
<string>keyword.other.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\binfix[lr]?\b</string>
<key>name</key>
<string>keyword.operator.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\b(do|if|then|else)\b</string>
<key>name</key>
<string>keyword.control.haskell</string>
</dict>
<dict>
<key>comment</key>
<string>Floats are always decimal</string>
<key>match</key>
<string>\b([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\b</string>
<key>name</key>
<string>constant.numeric.float.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\b([0-9]+|0([xX][0-9a-fA-F]+|[oO][0-7]+))\b</string>
<key>name</key>
<string>constant.numeric.haskell</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.preprocessor.c</string>
</dict>
</dict>
<key>comment</key>
<string>In addition to Haskell's "native" syntax, GHC permits the C preprocessor to be run on a source file.</string>
<key>match</key>
<string>^\s*(#)\s*\w+</string>
<key>name</key>
<string>meta.preprocessor.c</string>
</dict>
<dict>
<key>include</key>
<string>#pragma</string>
</dict>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.haskell</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.haskell</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.haskell</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\(NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\"'\&amp;])</string>
<key>name</key>
<string>constant.character.escape.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\\o[0-7]+|\\x[0-9A-Fa-f]+|\\[0-9]+</string>
<key>name</key>
<string>constant.character.escape.octal.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\^[A-Z@\[\]\\\^_]</string>
<key>name</key>
<string>constant.character.escape.control.haskell</string>
</dict>
</array>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.haskell</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>constant.character.escape.haskell</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>constant.character.escape.octal.haskell</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>constant.character.escape.hexadecimal.haskell</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>constant.character.escape.control.haskell</string>
</dict>
<key>6</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.haskell</string>
</dict>
</dict>
<key>match</key>
<string>(?x)
(')
(?:
[\ -\[\]-~] # Basic Char
| (\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE
|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS
|US|SP|DEL|[abfnrtv\\\"'\&amp;])) # Escapes
| (\\o[0-7]+) # Octal Escapes
| (\\x[0-9A-Fa-f]+) # Hexadecimal Escapes
| (\^[A-Z@\[\]\\\^_]) # Control Chars
)
(')
</string>
<key>name</key>
<string>string.quoted.single.haskell</string>
</dict>
<dict>
<key>begin</key>
<string>^\s*([a-z_][a-zA-Z0-9_']*|\([|!%$+\-.,=&lt;/&gt;]+\))\s*(::)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.name.function.haskell</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.other.double-colon.haskell</string>
</dict>
</dict>
<key>end</key>
<string>$\n?</string>
<key>name</key>
<string>meta.function.type-declaration.haskell</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#type_signature</string>
</dict>
</array>
</dict>
<dict>
<key>match</key>
<string>\b(Just|Nothing|Left|Right|True|False|LT|EQ|GT|\(\)|\[\])\b</string>
<key>name</key>
<string>support.constant.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\b[A-Z]\w*\b</string>
<key>name</key>
<string>constant.other.haskell</string>
</dict>
<dict>
<key>include</key>
<string>#comments</string>
</dict>
<dict>
<key>match</key>
<string>\b(abs|acos|acosh|all|and|any|appendFile|applyM|asTypeOf|asin|asinh|atan|atan2|atanh|break|catch|ceiling|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|div|divMod|drop|dropWhile|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromEnum|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|head|id|init|interact|ioError|isDenormalized|isIEEE|isInfinite|isNaN|isNegativeZero|iterate|last|lcm|length|lex|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|odd|or|otherwise|pi|pred|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|read|readFile|readIO|readList|readLn|readParen|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showList|showParen|showString|shows|showsPrec|significand|signum|sin|sinh|snd|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|toEnum|toInteger|toRational|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\b</string>
<key>name</key>
<string>support.function.prelude.haskell</string>
</dict>
<dict>
<key>include</key>
<string>#infix_op</string>
</dict>
<dict>
<key>comment</key>
<string>In case this regex seems overly general, note that Haskell permits the definition of new operators which can be nearly any string of punctuation characters, such as $%^&amp;*.</string>
<key>match</key>
<string>[|!%$?~+:\-.=&lt;/&gt;\\]+</string>
<key>name</key>
<string>keyword.operator.haskell</string>
</dict>
<dict>
<key>match</key>
<string>,</string>
<key>name</key>
<string>punctuation.separator.comma.haskell</string>
</dict>
</array>
<key>repository</key>
<dict>
<key>block_comment</key>
<dict>
<key>applyEndPatternLast</key>
<integer>1</integer>
<key>begin</key>
<string>\{-(?!#)</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.haskell</string>
</dict>
</dict>
<key>end</key>
<string>-\}</string>
<key>name</key>
<string>comment.block.haskell</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#block_comment</string>
</dict>
</array>
</dict>
<key>comments</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.haskell</string>
</dict>
</dict>
<key>match</key>
<string>(--).*$\n?</string>
<key>name</key>
<string>comment.line.double-dash.haskell</string>
</dict>
<dict>
<key>include</key>
<string>#block_comment</string>
</dict>
</array>
</dict>
<key>infix_op</key>
<dict>
<key>match</key>
<string>(\([|!%$+:\-.=&lt;/&gt;]+\)|\(,+\))</string>
<key>name</key>
<string>entity.name.function.infix.haskell</string>
</dict>
<key>module_exports</key>
<dict>
<key>begin</key>
<string>\(</string>
<key>end</key>
<string>\)</string>
<key>name</key>
<string>meta.declaration.exports.haskell</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\b[a-z][a-zA-Z_'0-9]*</string>
<key>name</key>
<string>entity.name.function.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\b[A-Z][A-Za-z_'0-9]*</string>
<key>name</key>
<string>storage.type.haskell</string>
</dict>
<dict>
<key>match</key>
<string>,</string>
<key>name</key>
<string>punctuation.separator.comma.haskell</string>
</dict>
<dict>
<key>include</key>
<string>#infix_op</string>
</dict>
<dict>
<key>comment</key>
<string>So named because I don't know what to call this.</string>
<key>match</key>
<string>\(.*?\)</string>
<key>name</key>
<string>meta.other.unknown.haskell</string>
</dict>
</array>
</dict>
<key>module_name</key>
<dict>
<key>match</key>
<string>[A-Z][A-Za-z._']*</string>
<key>name</key>
<string>support.other.module.haskell</string>
</dict>
<key>pragma</key>
<dict>
<key>begin</key>
<string>\{-#</string>
<key>end</key>
<string>#-\}</string>
<key>name</key>
<string>meta.preprocessor.haskell</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\b(LANGUAGE|UNPACK|INLINE)\b</string>
<key>name</key>
<string>keyword.other.preprocessor.haskell</string>
</dict>
</array>
</dict>
<key>type_signature</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.other.inherited-class.haskell</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>variable.other.generic-type.haskell</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>keyword.other.big-arrow.haskell</string>
</dict>
</dict>
<key>match</key>
<string>\(\s*([A-Z][A-Za-z]*)\s+([a-z][A-Za-z_']*)\)\s*(=&gt;)</string>
<key>name</key>
<string>meta.class-constraint.haskell</string>
</dict>
<dict>
<key>include</key>
<string>#pragma</string>
</dict>
<dict>
<key>match</key>
<string>-&gt;</string>
<key>name</key>
<string>keyword.other.arrow.haskell</string>
</dict>
<dict>
<key>match</key>
<string>=&gt;</string>
<key>name</key>
<string>keyword.other.big-arrow.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\b(Int(eger)?|Maybe|Either|Bool|Float|Double|Char|String|Ordering|ShowS|ReadS|FilePath|IO(Error)?)\b</string>
<key>name</key>
<string>support.type.prelude.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\b[a-z][a-zA-Z0-9_']*\b</string>
<key>name</key>
<string>variable.other.generic-type.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\b[A-Z][a-zA-Z0-9_']*\b</string>
<key>name</key>
<string>storage.type.haskell</string>
</dict>
<dict>
<key>match</key>
<string>\(\)</string>
<key>name</key>
<string>support.constant.unit.haskell</string>
</dict>
<dict>
<key>include</key>
<string>#comments</string>
</dict>
</array>
</dict>
</dict>
<key>scopeName</key>
<string>source.haskell</string>
<key>uuid</key>
<string>5C034675-1F6D-497E-8073-369D37E2FD7D</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment