main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | 'use strict'
|
---|
| 2 |
|
---|
| 3 | module.exports = magma
|
---|
| 4 | magma.displayName = 'magma'
|
---|
| 5 | magma.aliases = []
|
---|
| 6 | function magma(Prism) {
|
---|
| 7 | Prism.languages.magma = {
|
---|
| 8 | output: {
|
---|
| 9 | pattern:
|
---|
| 10 | /^(>.*(?:\r(?:\n|(?!\n))|\n))(?!>)(?:.+|(?:\r(?:\n|(?!\n))|\n)(?!>).*)(?:(?:\r(?:\n|(?!\n))|\n)(?!>).*)*/m,
|
---|
| 11 | lookbehind: true,
|
---|
| 12 | greedy: true
|
---|
| 13 | },
|
---|
| 14 | comment: {
|
---|
| 15 | pattern: /\/\/.*|\/\*[\s\S]*?\*\//,
|
---|
| 16 | greedy: true
|
---|
| 17 | },
|
---|
| 18 | string: {
|
---|
| 19 | pattern: /(^|[^\\"])"(?:[^\r\n\\"]|\\.)*"/,
|
---|
| 20 | lookbehind: true,
|
---|
| 21 | greedy: true
|
---|
| 22 | },
|
---|
| 23 | // http://magma.maths.usyd.edu.au/magma/handbook/text/82
|
---|
| 24 | keyword:
|
---|
| 25 | /\b(?:_|adj|and|assert|assert2|assert3|assigned|break|by|case|cat|catch|clear|cmpeq|cmpne|continue|declare|default|delete|diff|div|do|elif|else|end|eq|error|eval|exists|exit|for|forall|forward|fprintf|freeze|function|ge|gt|if|iload|import|in|intrinsic|is|join|le|load|local|lt|meet|mod|ne|not|notadj|notin|notsubset|or|print|printf|procedure|quit|random|read|readi|repeat|require|requirege|requirerange|restore|return|save|sdiff|select|subset|then|time|to|try|until|vprint|vprintf|vtime|when|where|while|xor)\b/,
|
---|
| 26 | boolean: /\b(?:false|true)\b/,
|
---|
| 27 | generator: {
|
---|
| 28 | pattern: /\b[a-z_]\w*(?=\s*<)/i,
|
---|
| 29 | alias: 'class-name'
|
---|
| 30 | },
|
---|
| 31 | function: /\b[a-z_]\w*(?=\s*\()/i,
|
---|
| 32 | number: {
|
---|
| 33 | pattern:
|
---|
| 34 | /(^|[^\w.]|\.\.)(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?:_[a-z]?)?(?=$|[^\w.]|\.\.)/,
|
---|
| 35 | lookbehind: true
|
---|
| 36 | },
|
---|
| 37 | operator: /->|[-+*/^~!|#=]|:=|\.\./,
|
---|
| 38 | punctuation: /[()[\]{}<>,;.:]/
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.