highlightjs-redbol
Advanced tools
Comparing version 1.0.3 to 2.0.0
@@ -1,36 +0,2 @@ | ||
hljs.registerLanguage("redbol",(()=>{"use strict";return e=>{var a={ | ||
className:"string",begin:"\\^(\\(([0-9a-fA-F]+|del)\\)|.)"};return{ | ||
aliases:["rebol","red","red/system"],keywords:{ | ||
lexemes:"[a-zA-Z_][a-zA-Z0-9_\\-\\!]*", | ||
keyword:"make set print probe|10 func function does has do while until unless|10 if either|10 else for foreach|10 forall|10 forskip|10 remove-each until while case loop repeat|10 switch at insert append tail head back repend next to thru collect keep return throw catch continue break open close load reduce|10 rejoin|10 insert bind parse|10 union intersect unique charset extend object context", | ||
literal:"off on yes no true false null none not all any end integer!", | ||
built_in:"random absolute add divide multiply negate remainder subtract pick reverse select find" | ||
},illegal:/(\/\*|\/\/)/,contains:[{className:"string",illegal:"\\n",variants:[{ | ||
begin:'"',end:'"'},{begin:'%"',end:'"'}],contains:[a]},{className:"string", | ||
begin:"{",end:"}",contains:[a]},{className:"string", | ||
begin:"%[^\\s\\n\\[\\]\\(\\)]+"},{className:"string", | ||
begin:"[A-Za-z][\\w]{1,9}:(/{0,3}[^\\s\\n\\[\\]\\(\\)]+|//)"},{ | ||
className:"string",begin:"<",end:">",illegal:"\\n"},{className:"string", | ||
begin:"[^\\s\\n:/\\[\\]\\(\\)]+@[^\\s\\n:/\\[\\]\\(\\)]+"},{ | ||
className:"variable",begin:"/[^\\s\\n\\[\\]\\(\\)]*"},{className:"literal", | ||
begin:/[a-zA-Z]+[a-zA-Z0-9_\-\!]*\!/},{className:"literal", | ||
begin:/\'[a-zA-Z_]+[a-zA-Z0-9_\-\!]*/},{className:"string", | ||
begin:"2#\\{(([01]\\s*){8})*\\}"},{className:"string", | ||
begin:"(16)?#\\{\\s*([0-9a-fA-F]{2,2}\\s*)*\\}"},{className:"string", | ||
begin:"64#\\{[0-9a-zA-Z+/=\\s]*\\}"},{className:"doctag",begin:";-.*", | ||
illegal:"\\n"},{className:"comment",begin:";.*",illegal:"\\n"},{ | ||
className:"comment",begin:"\\s: ",end:"\\n"},{className:"doctag", | ||
begin:/^(>>|red>>)/},{className:"doctag",begin:/^[\*]{2}[\*]*\s/,end:/\n/},{ | ||
className:"number",begin:/[-+]?\d+x[-+]?\d+/},{className:"number", | ||
begin:"\\d{1,2}\\-([A-Za-z]{3}|January|Febuary|March|April|May|June|July|August|September|October|November|December)\\-\\d{4}(/\\d{1,2}[:]\\d{1,2}([:]\\d{1,2}(\\.\\d{1,5})?)?([+-]\\d{1,2}[:]\\d{1,2})?)?" | ||
},{className:"number", | ||
begin:/([-+]?[:]\d{1,2}([aApP][mM])?)|([-+]?[:]\d{1,2}[.]\d{0,9})|([-+]?\d{1,2}[:]\\d{1,2}([aApP][mM])?)|([-+]?\d{1,2}[:]\d{1,2}[.]\d{0,9})|([-+]?\d{1,2}[:]\d{1,2}[:]\d{1,2}([.]\d{0,9})?([aApP][mM])?)(?!\w)/ | ||
},{className:"number",begin:"(\\d{0,3}[.]\\d{0,3}[.]\\d{0,3}([.]\\d{0,3}){0,7})" | ||
},{className:"built_in", | ||
begin:/(\s|\t)+(==|!=|<=|>=|<>|<|>|>>|>>>|<<|\+|-|=|\*|%|\/|\b(and|or|xor))(?=\s|\(|\[|\)|\]|\/|;|\"|{|$)/ | ||
},{className:"section",begin:/[a-zA-Z_\-]+[a-zA-Z0-9_\-]*:/},{ | ||
className:"section",begin:/:[a-zA-Z_\-]+[a-zA-Z0-9_\-]*/},{className:"regexp", | ||
begin:/(\[|\]|\(|\))+|\#\(|\#\[/},{className:"string", | ||
begin:/\#[^\s\n\[\]\(\)\/]*/},{className:"number", | ||
begin:'([0-9A-F]+)h(?=\\s|\\)|\\]|/|;|\\"|{\\[|\\(|$)'},{className:"number", | ||
begin:"-?[a-zA-Z]*\\$\\d+(\\.\\d*)?"},e.C_NUMBER_MODE]}}})()); | ||
/* Version: 2.0.0 https://github.com/oldes/highlightjs-redbol */ | ||
hljs.registerLanguage("rebol",function e(s){let a='\\s\\n\\[\\]\\(\\)\\"{}/;',n='\\s\\n\\[\\]\\(\\)\\"{};',i="(?<=^|["+a+"])",g="(?=$|["+a+"])",r="[^"+a+"]+",c={className:"subst",begin:"\\^(\\(([0-9a-fA-F]+|del|tab)\\)|.)"},l={className:"string",begin:"%{",end:"}%"},b={className:"string",begin:"%%{",end:"}%%",contains:[l]},t={className:"string",begin:"%%%{",end:"}%%%",contains:[b,l]},m={className:"doctag",begin:";[-@].*",illegal:"\\n"},d={className:"comment",begin:";.*",illegal:"\\n"},o="[-+]?(1\\.#INF|1\\.#NaN)|[-+]?(?:\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?";return{aliases:["rebol","red","red/system"],case_insensitive:!0,illegal:/(\/\*|\/\/)/,contains:[m,d,{className:"doctag",begin:/^(>>|red>>)/},{className:"doctag",begin:/^[\*]{2}[\*]*\s/,end:/\n/},{className:"regexp",begin:/(\[|\]|\(|\))+|\#\(|\#\[/},{className:"string",begin:"2#\\{",end:"\\}",contains:[m,d,{className:"string",begin:"\\s*(([01]\\s*){8})+"}]},{className:"string",begin:"(16)?#\\{",end:"\\}",contains:[m,d,{className:"string",begin:"\\s*([0-9a-fA-F]{2,2}\\s*)+"}]},{className:"string",begin:"64#\\{[0-9a-zA-Z+/=\\s]*\\}"},{className:"number",variants:[{begin:"(0|16)#[0-9a-fA-F]+"},{begin:"2#[01]+"},{begin:"8#[0-7]+"},{begin:"10#[0-9]+"},]},{className:"number",begin:"(\\d{0,3}[.]\\d{0,3}[.]\\d{0,3})([.]\\d{1,3}){0,9}",contains:[{className:"emphasis",begin:/(\.\d{1,3})+/}]},{className:"number",begin:"("+o+")x("+o+")"},{className:"number",begin:"[+-]?([a-zA-Z]{3})?\\$[-+]?(?:\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?"},{className:"char",begin:'#"',end:'"',contains:[c]},{className:"string",illegal:"\\n",variants:[{begin:'"',end:'"'},{begin:'%"',end:'"'}],contains:[c]},{className:"string",begin:"{",end:"}",contains:[c]},{className:"string",begin:"%%%%{",end:"}%%%%",contains:[t,b,l]},t,b,l,{className:"string",begin:"%[^\\s\\n\\[\\]\\(\\)]+"},{className:"string",begin:i+"[^"+n+":\\d]+:[^"+n+"]+"},{className:"section",begin:"[/@]"+r},{className:"section",begin:i+"'"+r},{className:"variable",begin:i+r+":"},{className:"variable",begin:i+":"+r},{className:"operator",begin:i+"(==|!==|!=|<=|>=|=?|<>|<|>|>>|>>>|<<|\\+\\+|\\+|\\-\\-|\\-|=|\\*|%|\\/\\/|\\/|and|or|xor|!)"+g},{className:"string",begin:"<",end:">",illegal:"\\n"},{className:"string",begin:"[^\\s\\n:/\\[\\]\\(\\)]+@[^\\s\\n:/\\[\\]\\(\\)]+"},{className:"type",begin:i+r+"[!?]"+g},{className:"number",begin:"\\d{1,2}\\-([A-Za-z]{3}|January|Febuary|March|April|May|June|July|August|September|October|November|December)\\-\\d{4}(/\\d{1,2}[:]\\d{1,2}([:]\\d{1,2}(\\.\\d{1,5})?)?([+-]\\d{1,2}[:]\\d{1,2})?)?"},{className:"number",begin:/([-+]?\d{0,5}([:]\d{1,9}){1,2}([.,]\d{0,9})?(am|pm)?)(?!\w)/},{className:"string",begin:"#"+r},{className:"keyword",begin:i+"(if|either|unless|any|all|quit|return|exit|continue|break|try|catch|throw|make|to|as|set|print|prin|probe|for|foreach|forall|forskip|until|do|while|case|loop|repeat|switch|reduce|reform|join|ajoin|copy|binary|does|has|wrap|function|func|closure|bind|parse|wait)"+g},{className:"number",begin:'\\b([0-9A-F]+)h(?=\\s|\\)|\\]|/|;|\\"|{\\[|\\(|$)'},{className:"number",begin:"\\b"+o},{begin:i+r}]}}); |
{ | ||
"name": "highlightjs-redbol", | ||
"version": "1.0.3", | ||
"version": "2.0.0", | ||
"description": "Red & Rebol syntax highlighting plugin for highlight.js", | ||
"main": "src/languages/redbol.js", | ||
"scripts": { | ||
"test": "mocha --reporter spec" | ||
}, | ||
"repository": { | ||
@@ -27,13 +24,5 @@ "type": "git", | ||
"homepage": "https://github.com/oldes/highlightjs-redbol#readme", | ||
"devDependencies": { | ||
"highlightjs": "^9.10.0", | ||
"mocha": "^8.2.1", | ||
"should": "^13.2.3" | ||
}, | ||
"dependencies": { | ||
"highlightjs": "^9.10.0" | ||
}, | ||
"directories": { | ||
"test": "test" | ||
"highlight.js": "^11.9.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# [Rebol][1] & [Red][2] language grammar for [highlight.js](https://highlightjs.org/) | ||
# [Rebol][1] & [Red][2] language grammar for [highlight.js][5](version 11.9.0) | ||
@@ -6,3 +6,2 @@ [![version](https://badgen.net/npm/v/highlightjs-redbol)](https://www.npmjs.com/package/highlightjs-redbol) | ||
[![minified size](https://badgen.net/bundlephobia/min/highlightjs-redbol)](https://unpkg.com/highlightjs-redbol/dist/redbol.min.js) | ||
[![Build Status](https://travis-ci.org/Oldes/highlightjs-redbol.svg?branch=master)](https://travis-ci.org/Oldes/highlightjs-redbol) | ||
@@ -18,8 +17,7 @@ ## Usage | ||
```html | ||
<script type="text/javascript" src="/path/to/highlight.min.js"></script> | ||
<script type="text/javascript" charset="UTF-8" | ||
src="/path/to/highlightjs-redbol/dist/redbol.min.js"></script> | ||
<script type="text/javascript"> | ||
hljs.initHighlightingOnLoad(); | ||
</script> | ||
<link rel="stylesheet" href="/path/to/styles/default.min.css"> | ||
<script src="/path/to/highlight.min.js"></script> | ||
<script src="/path/to/redbol.min.js"></script> | ||
<script>hljs.highlightAll();</script> | ||
<pre><code class="language-rebol">...</code></pre> | ||
``` | ||
@@ -30,4 +28,3 @@ | ||
```html | ||
<script type="text/javascript" | ||
src="https://unpkg.com/highlightjs-redbol/dist/redbol.min.js"></script> | ||
<script src="https://unpkg.com/highlightjs-redbol/dist/redbol.min.js"></script> | ||
``` | ||
@@ -42,7 +39,6 @@ | ||
```javascript | ||
var hljs = require('highlightjs'); | ||
var hljsCypher = require('highlightjs-redbol'); | ||
var hljs = require('highlight.js'); | ||
var hljsRedbol = require('highlightjs-redbol'); | ||
hljs.registerLanguage("redbol", hljsRedbol); | ||
hljs.initHighlightingOnLoad(); | ||
hljs.highlightAll(); | ||
``` | ||
@@ -52,3 +48,3 @@ | ||
You need to import both Highlight.js and third-party language like Cypher: | ||
You need to import both Highlight.js and third-party language like Redbol: | ||
@@ -58,5 +54,4 @@ ```js | ||
import 'highlight.js/scss/darcula.scss' # your favourite theme | ||
import hljs from 'highlight.js' | ||
import redbol from './redbol' | ||
import hljs from 'highlight.js' | ||
hljs.registerLanguage('redbol', redbol); | ||
@@ -68,3 +63,3 @@ class Highlighter extends Component | ||
super(props); | ||
hljs.initHighlightingOnLoad(); | ||
hljs.highlightAll(); | ||
} | ||
@@ -78,3 +73,3 @@ | ||
<pre ref={(node) => this.node = node}> | ||
<code className="redbol"> | ||
<code className="rebol"> | ||
{children} | ||
@@ -101,10 +96,13 @@ </code> | ||
- The official site for the Highlight.js library is <https://highlightjs.org/>. | ||
- The official site for the Highlight.js library is [https://highlightjs.org][5]. | ||
- The Highlight.js GitHub project: <https://github.com/highlightjs/highlight.js> | ||
- Learn more about Red: [https://www.red-lang.org][1] | ||
- Learn more about Rebol: [http://www.rebol.com][2] or [Oldes' fork][3] | ||
- Learn more about Red: [https://www.red-lang.org][2] | ||
- Learn more about Rebol: [http://www.rebol.com][1] or [Oldes' fork][3] | ||
- Project pages: [https://oldes.github.io/highlightjs-redbol/][6] | ||
[1]: https://www.red-lang.org | ||
[2]: http://www.rebol.com | ||
[1]: http://www.rebol.com | ||
[2]: https://www.red-lang.org | ||
[3]: https://oldes.github.io/Rebol3 | ||
[4]: https://github.com/oldes/highlightjs-redbol/blob/master/LICENSE | ||
[5]: https://highlightjs.org | ||
[6]: https://oldes.github.io/highlightjs-redbol/ |
@@ -1,15 +0,40 @@ | ||
/** | ||
* Language: Rebol & Red languages | ||
/* | ||
* Language: Rebol & Red | ||
* Category: common, scripting | ||
* Source: https://github.com/oldes/highlightjs-redbol | ||
* Version: 2.0.0 | ||
* Contributors: | ||
* Oldes <oldes.huhuman@gmail.com> | ||
*/ | ||
(function(){ | ||
var hljsGrammar = (function () { | ||
'use strict'; | ||
module.exports = function (hljs) | ||
{ | ||
var CHAR_INLINE = { | ||
className: 'string', | ||
begin: '\\^(\\(([0-9a-fA-F]+|del)\\)|.)', | ||
function rebol(hljs) { | ||
const LEX_DELIMIT = '\\s\\n\\[\\]\\(\\)\\"{}/;'; | ||
const LEX_DELIMIT2 = '\\s\\n\\[\\]\\(\\)\\"{};'; // without / | ||
const LOOK_BEHIND_DELIMIT = '(?<=^|['+ LEX_DELIMIT +'])'; | ||
const LOOK_AHEAD_DELIMIT = '(?=$|['+ LEX_DELIMIT +'])'; | ||
const NOT_DELIMIT = '[^'+ LEX_DELIMIT +']+'; | ||
const ANY_WORD = { | ||
// className: 'literal', | ||
begin: LOOK_BEHIND_DELIMIT+NOT_DELIMIT, | ||
} | ||
const CHAR_INLINE = { | ||
className: 'subst', | ||
begin: '\\^(\\(([0-9a-fA-F]+|del|tab)\\)|.)', | ||
}; | ||
var STRING = { | ||
const CHAR = { | ||
className: 'char', | ||
begin: '#"', | ||
end: '"', | ||
contains: [ | ||
CHAR_INLINE | ||
] | ||
}; | ||
const STRING = { | ||
className: 'string', | ||
@@ -25,3 +50,3 @@ illegal: '\\n', | ||
}; | ||
var STRING_MULTILINE = { | ||
const STRING_MULTILINE = { | ||
className: 'string', | ||
@@ -31,25 +56,54 @@ begin: '{', end: '}', | ||
} | ||
var TAG = { | ||
const STRING_RAW_1 = { | ||
className: 'string', | ||
begin: '%{', end: '}%' | ||
} | ||
const STRING_RAW_2 = { | ||
className: 'string', | ||
begin: '%%{', end: '}%%', | ||
contains: [STRING_RAW_1] | ||
} | ||
const STRING_RAW_3 = { | ||
className: 'string', | ||
begin: '%%%{', end: '}%%%', | ||
contains: [STRING_RAW_2, STRING_RAW_1] | ||
} | ||
const STRING_RAW_4 = { | ||
className: 'string', | ||
begin: '%%%%{', end: '}%%%%', | ||
contains: [STRING_RAW_3, STRING_RAW_2, STRING_RAW_1] | ||
} | ||
const TAG = { | ||
className: 'string', | ||
begin: '<', end: '>', | ||
illegal: '\\n', | ||
}; | ||
var FILE = { | ||
const FILE_QUOTED = { | ||
className: 'string', | ||
illegal: '\\n', | ||
begin: '%"', end: '"', | ||
contains: [CHAR_INLINE] | ||
}; | ||
const FILE = { | ||
className: 'string', | ||
begin: '%[^\\s\\n\\[\\]\\(\\)]+' | ||
}; | ||
var EMAIL = { | ||
const EMAIL = { | ||
className: 'string', | ||
begin: '[^\\s\\n:/\\[\\]\\(\\)]+@[^\\s\\n:/\\[\\]\\(\\)]+' | ||
}; | ||
var URL = { | ||
const URL = { | ||
className: 'string', | ||
begin: '[A-Za-z][\\w]{1,9}:(/{0,3}[^\\s\\n\\[\\]\\(\\)]+|//)' | ||
} | ||
var COMMENT1 = { | ||
begin: LOOK_BEHIND_DELIMIT+'[^'+LEX_DELIMIT2+':\\d]+:[^'+LEX_DELIMIT2+']+' | ||
}; | ||
const COMMENT1 = { | ||
className: 'doctag', | ||
begin: ';-.*', | ||
begin: ';[-@].*', | ||
illegal: '\\n' | ||
}; | ||
var COMMENT2 = { | ||
const COMMENT2 = { | ||
className: 'comment', | ||
@@ -59,8 +113,8 @@ begin: ';.*', | ||
}; | ||
var COMMENT_SPECIAL = { | ||
className: 'comment', | ||
begin: '\\s: ', end: '\\n', | ||
//contains: [hljs.C_NUMBER_MODE] | ||
}; | ||
var COMMENT_SPECIAL2 = { | ||
// const COMMENT_SPECIAL = { | ||
// className: 'comment', | ||
// begin: '\\s: ', end: '\\n', | ||
// //contains: [hljs.C_NUMBER_MODE] | ||
// }; | ||
const COMMENT_PROMPT = { | ||
className: 'doctag', | ||
@@ -70,3 +124,3 @@ begin: /^(>>|red>>)/, | ||
}; | ||
var COMMENT_ERROR = { | ||
const COMMENT_ERROR = { | ||
className: 'doctag', | ||
@@ -76,98 +130,168 @@ begin: /^[\*]{2}[\*]*\s/, end: /\n/, | ||
}; | ||
var BINARY64 = { | ||
const BRACKET = { | ||
className: 'regexp', | ||
begin: /(\[|\]|\(|\))+|\#\(|\#\[/ //colors also start of serialized values and maps | ||
}; | ||
const BIN2 = { | ||
className: 'string', | ||
begin: '\\s*(([01]\\s*){8})+' | ||
}; | ||
const BIN16 = { | ||
className: 'string', | ||
begin: '\\s*([0-9a-fA-F]{2,2}\\s*)+' | ||
}; | ||
const BINARY64 = { | ||
className: 'string', | ||
begin: '64#\\{[0-9a-zA-Z+/=\\s]*\\}' | ||
}; | ||
var BINARY16 = { | ||
const BINARY16 = { | ||
className: 'string', | ||
begin: '(16)?#\\{\\s*([0-9a-fA-F]{2,2}\\s*)*\\}' | ||
begin: '(16)?#\\{', end: '\\}', | ||
contains: [COMMENT1, COMMENT2, BIN16] | ||
}; | ||
var BINARY2 = { | ||
const BINARY2 = { | ||
className: 'string', | ||
begin: '2#\\{(([01]\\s*){8})*\\}' | ||
begin: '2#\\{', end: '\\}', | ||
contains: [COMMENT1, COMMENT2, BIN2] | ||
}; | ||
var PAIR = { | ||
const NUMBER_BIN = { | ||
className: 'number', | ||
begin: /[-+]?\d+x[-+]?\d+/ | ||
variants: [ | ||
{begin: '(0|16)#[0-9a-fA-F]+'}, | ||
{begin: '2#[01]+'}, | ||
{begin: '8#[0-7]+'}, | ||
{begin: '10#[0-9]+'}, | ||
], | ||
}; | ||
var DATE = { | ||
const DECIMAL_RE = '[-+]?(1\\.#INF|1\\.#NaN)|[-+]?(?:\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?'; | ||
const NUMBER_DECIMAL = { | ||
className: 'number', | ||
begin: '\\d{1,2}\\-([A-Za-z]{3}|January|Febuary|March|April|May|June|July|August|September|October|November|December)\\-\\d{4}(/\\d{1,2}[:]\\d{1,2}([:]\\d{1,2}(\\.\\d{1,5})?)?([+-]\\d{1,2}[:]\\d{1,2})?)?' | ||
} | ||
var TIME = { | ||
begin: '\\b'+DECIMAL_RE | ||
}; | ||
const NUMBER_MONEY = { | ||
className: 'number', | ||
begin: /([-+]?[:]\d{1,2}([aApP][mM])?)|([-+]?[:]\d{1,2}[.]\d{0,9})|([-+]?\d{1,2}[:]\\d{1,2}([aApP][mM])?)|([-+]?\d{1,2}[:]\d{1,2}[.]\d{0,9})|([-+]?\d{1,2}[:]\d{1,2}[:]\d{1,2}([.]\d{0,9})?([aApP][mM])?)(?!\w)/ | ||
begin: '[+-]?([a-zA-Z]{3})?\\$[-+]?(?:\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?' | ||
}; | ||
var TUPLE = { | ||
const PAIR = { | ||
className: 'number', | ||
begin: '(\\d{0,3}[.]\\d{0,3}[.]\\d{0,3}([.]\\d{0,3}){0,7})' | ||
begin: '(' + DECIMAL_RE + ')x(' + DECIMAL_RE + ')' | ||
}; | ||
var NUMBER_HEX = { | ||
const DATE = { | ||
className: 'number', | ||
begin: '([0-9A-F]+)h(?=\\s|\\)|\\]|/|;|\\\"|{\\[|\\(|$)' | ||
begin: '\\d{1,2}\\-([A-Za-z]{3}|January|Febuary|March|April|May|June|July|August|September|October|November|December)\\-\\d{4}(/\\d{1,2}[:]\\d{1,2}([:]\\d{1,2}(\\.\\d{1,5})?)?([+-]\\d{1,2}[:]\\d{1,2})?)?' | ||
} | ||
const TIME = { | ||
className: 'number', | ||
begin: /([-+]?\d{0,5}([:]\d{1,9}){1,2}([.,]\d{0,9})?(am|pm)?)(?!\w)/ | ||
}; | ||
var NUMBER_MONEY = { | ||
const TUPLE_IVALID = { | ||
className: 'emphasis', | ||
begin: /(\.\d{1,3})+/ | ||
}; | ||
const TUPLE = { | ||
className: 'number', | ||
begin: '-?[a-zA-Z]*\\$\\d+(\\.\\d*)?' | ||
begin: '(\\d{0,3}[.]\\d{0,3}[.]\\d{0,3})([.]\\d{1,3}){0,9}', | ||
contains: [TUPLE_IVALID] | ||
}; | ||
var SET_WORD = { | ||
const SET_WORD = { | ||
className: 'variable', | ||
begin: LOOK_BEHIND_DELIMIT+NOT_DELIMIT+":", | ||
}; | ||
const GET_WORD = { | ||
className: 'variable', | ||
begin: LOOK_BEHIND_DELIMIT+':'+NOT_DELIMIT, | ||
}; | ||
const LIT_WORD = { | ||
className: 'section', | ||
begin: /[a-zA-Z_\-]+[a-zA-Z0-9_\-]*:/ | ||
begin: LOOK_BEHIND_DELIMIT+"'"+NOT_DELIMIT, | ||
}; | ||
var GET_WORD = { | ||
const REFINEMENT = { | ||
className: 'section', | ||
begin: /:[a-zA-Z_\-]+[a-zA-Z0-9_\-]*/ | ||
}; | ||
var REFINEMENT = { | ||
className: 'variable', | ||
begin: '/[^\\s\\n\\[\\]\\(\\)]*' | ||
begin: '[/@]'+NOT_DELIMIT, // sharing refinement and ref datatypes! | ||
} | ||
var LIT_WORD = { | ||
className: 'literal', | ||
begin: /\'[a-zA-Z_]+[a-zA-Z0-9_\-\!]*/ //not complete, but should be fine so far | ||
}; | ||
var ISSUE = { | ||
const ISSUE = { | ||
className: 'string', | ||
begin: /\#[^\s\n\[\]\(\)\/]*/ //not exact, but should be fine so far | ||
begin: '#'+NOT_DELIMIT, | ||
}; | ||
var DATATYPE = { | ||
className: 'literal', | ||
begin: /[a-zA-Z]+[a-zA-Z0-9_\-\!]*\!/ //just simple case to cover words like: integer! float! and such | ||
const DATATYPE = { | ||
className: 'type', | ||
begin: LOOK_BEHIND_DELIMIT+NOT_DELIMIT+"[!?]"+LOOK_AHEAD_DELIMIT, | ||
}; | ||
var OPERATOR = { | ||
className: 'built_in', | ||
begin: /(\s|\t)+(==|!=|<=|>=|<>|<|>|>>|>>>|<<|\+|-|=|\*|%|\/|\b(and|or|xor))(?=\s|\(|\[|\)|\]|\/|;|\"|{|$)/ | ||
const OPERATOR = { | ||
className: 'operator', | ||
begin: LOOK_BEHIND_DELIMIT | ||
+'(==|!==|!=|<=|>=|=?|<>|<|>|>>|>>>|<<|\\+\\+|\\+|\\-\\-|\\-|=|\\*|%|\\/\\/|\\/|and|or|xor|!)' | ||
+LOOK_AHEAD_DELIMIT, | ||
}; | ||
var BRACKET = { | ||
className: 'regexp', | ||
begin: /(\[|\]|\(|\))+|\#\(|\#\[/ //colors also start of serialized values and maps | ||
const KEYWORD = { | ||
className: 'keyword', | ||
begin: LOOK_BEHIND_DELIMIT | ||
+'(if|either|unless|any|all|quit|return|exit|continue|break|try|catch|throw|make|to|as|set|print|prin|probe|' | ||
+'for|foreach|forall|forskip|until|do|while|case|loop|repeat|switch|' | ||
+'reduce|reform|join|ajoin|copy|binary|' | ||
//+'load|transcode|read|write|open|close|' | ||
+'does|has|wrap|function|func|closure|bind|parse|wait)' | ||
+LOOK_AHEAD_DELIMIT, | ||
}; | ||
const RED_NUMBER_HEX = { | ||
className: 'number', | ||
begin: '\\b([0-9A-F]+)h(?=\\s|\\)|\\]|/|;|\\\"|{\\[|\\(|$)' | ||
}; | ||
return { | ||
aliases: ['rebol', 'red', 'red/system'], | ||
keywords: { | ||
lexemes: '[a-zA-Z_][a-zA-Z0-9_\\-\\!]*', | ||
keyword: | ||
'make set print probe|10 func function does has do while until unless|10 if either|10 else '+ | ||
'for foreach|10 forall|10 forskip|10 remove-each until while case loop repeat|10 switch '+ | ||
'at insert append tail head back repend next to thru collect keep return throw catch continue break '+ | ||
'open close load reduce|10 rejoin|10 insert bind parse|10 '+ | ||
'union intersect unique charset extend object context', | ||
literal: | ||
'off on yes no true false null none not all any end integer!', | ||
built_in: | ||
'random absolute add divide multiply negate remainder subtract pick reverse '+ | ||
'select find' | ||
}, | ||
case_insensitive: true, | ||
illegal: /(\/\*|\/\/)/, | ||
contains: [ | ||
STRING, STRING_MULTILINE, FILE, URL, TAG, EMAIL, REFINEMENT, DATATYPE, LIT_WORD, | ||
BINARY2, BINARY16, BINARY64, | ||
COMMENT1, COMMENT2, COMMENT_SPECIAL, COMMENT_SPECIAL2, COMMENT_ERROR, | ||
PAIR, DATE, TIME, TUPLE, | ||
OPERATOR, | ||
SET_WORD, GET_WORD, BRACKET, ISSUE, | ||
NUMBER_HEX, NUMBER_MONEY, | ||
hljs.C_NUMBER_MODE | ||
COMMENT1, // ;-- or ;@@ | ||
COMMENT2, // ;... | ||
COMMENT_PROMPT, COMMENT_ERROR, | ||
BRACKET, // []() but also #() and #[] | ||
BINARY2, // 2#{01010000} | ||
BINARY16, // #{DEADF00D} or 16#{DEAD F00D} | ||
BINARY64, // 64#{3q3wDQ==} | ||
NUMBER_BIN, // 2#0101 0#DEAD 8#677 10#999 | ||
TUPLE, // 1.2.3 1..3 | ||
PAIR, // 1x1 1.1x222 1e2x100 | ||
NUMBER_MONEY, // $2 EUR$2 -USD$1.5 (currency ID not implemented in Rebol3 yet!) | ||
CHAR, // #"a" #"^-" #"^(tab)" | ||
STRING, // "aa" {b^/b} | ||
STRING_MULTILINE, | ||
STRING_RAW_4, STRING_RAW_3, STRING_RAW_2, STRING_RAW_1, | ||
FILE, // %foo %"with space" | ||
URL, // https://localhost:8080/foo?a=1 | ||
REFINEMENT, // /refinement | ||
LIT_WORD, // 'word | ||
SET_WORD, // word: | ||
GET_WORD, // :word | ||
OPERATOR, // == <> >= ... | ||
TAG, // <a> | ||
EMAIL, // user@domain.com | ||
DATATYPE, // integer! but also any-string? | ||
// COMMENT_SPECIAL, | ||
DATE, TIME, | ||
ISSUE, | ||
KEYWORD, | ||
RED_NUMBER_HEX, | ||
NUMBER_DECIMAL, | ||
ANY_WORD | ||
] | ||
}; | ||
} | ||
}; | ||
} | ||
return rebol; | ||
})(); | ||
hljs.registerLanguage('rebol', hljsGrammar); | ||
})(); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
27116
0
313
14
1
100
1
+ Addedhighlight.js@^11.9.0
+ Addedhighlight.js@11.9.0(transitive)
- Removedhighlightjs@^9.10.0
- Removedhighlightjs@9.16.2(transitive)