workaround for unsupported regex features
This commit is contained in:
parent
03fe8a3576
commit
5d63adb2a7
4 changed files with 38 additions and 109 deletions
|
|
@ -47,29 +47,19 @@ var ForthHighlightRules = function() {
|
|||
this.$rules = { start: [ { include: '#forth' } ],
|
||||
'#comment':
|
||||
[ { token: 'comment.line.double-dash.forth',
|
||||
regex: '(?<=^|\\s)--\\s.*$',
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)(--\\s.*$)',
|
||||
regex: '(?:^|\\s)--\\s.*$',
|
||||
comment: 'line comments for iForth' },
|
||||
{ token: 'comment.line.backslash.forth',
|
||||
regex: '(?<=^|\\s)\\\\[\\s\\S]*$',
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)(\\\\[\\s\\S]*$)',
|
||||
regex: '(?:^|\\s)\\\\[\\s\\S]*$',
|
||||
comment: 'ANSI line comment' },
|
||||
{ token: 'comment.line.backslash-g.forth',
|
||||
regex: '(?<=^|\\s)\\\\[Gg] .*$',
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)(\\\\[Gg] .*$)',
|
||||
regex: '(?:^|\\s)\\\\[Gg] .*$',
|
||||
comment: 'gForth line comment' },
|
||||
{ token: 'comment.block.forth',
|
||||
regex: '(?<=^|\\s)\\(\\*(?=\\s)',
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)(\\(\\*)(?=\\s)',
|
||||
regex: '(?:^|\\s)\\(\\*(?=\\s|$)',
|
||||
push:
|
||||
[ { token: 'comment.block.forth',
|
||||
regex: '(?<=^|\\s)\\*\\)(?=\\s)',
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)(\\*\\))(?=\\s)',
|
||||
regex: '(?:^|\\s)\\*\\)(?=\\s|$)',
|
||||
next: 'pop' },
|
||||
{ defaultToken: 'comment.block.forth' } ],
|
||||
comment: 'multiline comments for iForth' },
|
||||
|
|
@ -84,24 +74,16 @@ var ForthHighlightRules = function() {
|
|||
{ defaultToken: 'comment.block.documentation.forth' } ],
|
||||
comment: 'documentation comments for iForth' },
|
||||
{ token: 'comment.line.parentheses.forth',
|
||||
regex: '(?<=^|\\s)\\.?\\( [^)]*\\)',
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)(\\.?\\( [^)]*\\))',
|
||||
regex: '(?:^|\\s)\\.?\\( [^)]*\\)',
|
||||
comment: 'ANSI line comment' } ],
|
||||
'#constant':
|
||||
[ { token: 'constant.language.forth',
|
||||
regex: '(?<=^|\\s)(?:TRUE|FALSE|BL|PI|CELL|C/L|R/O|W/O|R/W)(?=\\s)',
|
||||
regex: '(?:^|\\s)(?:TRUE|FALSE|BL|PI|CELL|C/L|R/O|W/O|R/W)(?=\\s|$)',
|
||||
caseInsensitive: true,
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?i:(?<=^|\\s)(TRUE|FALSE|BL|PI|CELL|C/L|R/O|W/O|R/W)(?=\\s))' },
|
||||
{ token: 'constant.numeric.forth',
|
||||
regex: '(?<=^|\\s)[$#%]?[-+]?[0-9]+(?:\\.[0-9]*e-?[0-9]+|\\.?[0-9a-fA-F]*)(?=\\s)',
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)([$#%]?[-+]?[0-9]+(\\.[0-9]*e(-?[0-9]+)|\\.?[0-9a-fA-F]*))(?=\\s)' },
|
||||
regex: '(?:^|\\s)[$#%]?[-+]?[0-9]+(?:\\.[0-9]*e-?[0-9]+|\\.?[0-9a-fA-F]*)(?=\\s|$)',
|
||||
{ token: 'constant.character.forth',
|
||||
regex: '(?<=^|\\s)(?:[&^]\\S|(?:"|\')\\S(?:"|\'))(?=\\s)',
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)(([&^]\\S)|(("|\')\\S("|\')))(?=\\s)' } ],
|
||||
regex: '(?:^|\\s)(?:[&^]\\S|(?:"|\')\\S(?:"|\'))(?=\\s|$)',
|
||||
'#forth':
|
||||
[ { include: '#constant' },
|
||||
{ include: '#comment' },
|
||||
|
|
@ -112,64 +94,45 @@ var ForthHighlightRules = function() {
|
|||
{ include: '#word-def' } ],
|
||||
'#storage':
|
||||
[ { token: 'storage.type.forth',
|
||||
regex: '(?<=^|\\s)(?:2CONSTANT|2VARIABLE|ALIAS|CONSTANT|CREATE-INTERPRET/COMPILE[:]?|CREATE|DEFER|FCONSTANT|FIELD|FVARIABLE|USER|VALUE|VARIABLE|VOCABULARY)(?=\\s)',
|
||||
regex: '(?:^|\\s)(?:2CONSTANT|2VARIABLE|ALIAS|CONSTANT|CREATE-INTERPRET/COMPILE[:]?|CREATE|DEFER|FCONSTANT|FIELD|FVARIABLE|USER|VALUE|VARIABLE|VOCABULARY)(?=\\s|$)',
|
||||
caseInsensitive: true,
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)(?i:(2CONSTANT|2VARIABLE|ALIAS|CONSTANT|CREATE-INTERPRET/COMPILE[:]?|CREATE|DEFER|FCONSTANT|FIELD|FVARIABLE|USER|VALUE|VARIABLE|VOCABULARY))(?=\\s)' } ],
|
||||
'#string':
|
||||
[ { token: 'string.quoted.double.forth',
|
||||
regex: '(?:(?<=ABORT" )|(?<=BREAK" )|(?<=\\." )|C" |0"|S\\\\?" )[^"]+"',
|
||||
regex: '(ABORT" |BREAK" |\\." |C" |0"|S\\\\?" )([^"]+")',
|
||||
caseInsensitive: true,
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?i:((?<=ABORT" )|(?<=BREAK" )|(?<=\\." )|(C" )|(0")|(S\\\\?" )))[^"]+"' },
|
||||
{ token: 'string.unquoted.forth',
|
||||
regex: '(?:(?<=INCLUDE)|(?<=NEEDS)|(?<=REQUIRE)|(?<=USE))[ ]\\S+(?=\\s)',
|
||||
regex: '(?:INCLUDE|NEEDS|REQUIRE|USE)[ ]\\S+(?=\\s|$)',
|
||||
caseInsensitive: true,
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?i:((?<=INCLUDE)|(?<=NEEDS)|(?<=REQUIRE)|(?<=USE)))[ ]\\S+(?=\\s)' } ],
|
||||
'#variable':
|
||||
[ { token: 'variable.language.forth',
|
||||
regex: '\\b(?:I|J)\\b',
|
||||
caseInsensitive: true } ],
|
||||
'#word':
|
||||
[ { token: 'keyword.control.immediate.forth',
|
||||
regex: '(?<=^|\\s)\\[(?:\\?DO|\\+LOOP|AGAIN|BEGIN|DEFINED|DO|ELSE|ENDIF|FOR|IF|IFDEF|IFUNDEF|LOOP|NEXT|REPEAT|THEN|UNTIL|WHILE)\\](?=\\s)',
|
||||
regex: '(?:^|\\s)\\[(?:\\?DO|\\+LOOP|AGAIN|BEGIN|DEFINED|DO|ELSE|ENDIF|FOR|IF|IFDEF|IFUNDEF|LOOP|NEXT|REPEAT|THEN|UNTIL|WHILE)\\](?=\\s|$)',
|
||||
caseInsensitive: true,
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)\\[(?i:(\\?DO|\\+LOOP|AGAIN|BEGIN|DEFINED|DO|ELSE|ENDIF|FOR|IF|IFDEF|IFUNDEF|LOOP|NEXT|REPEAT|THEN|UNTIL|WHILE))\\](?=\\s)' },
|
||||
{ token: 'keyword.other.immediate.forth',
|
||||
regex: '(?<=^|\\s)(?:COMPILE-ONLY|IMMEDIATE|IS|RESTRICT|TO|WHAT\'S|])(?=\\s)',
|
||||
regex: '(?:^|\\s)(?:COMPILE-ONLY|IMMEDIATE|IS|RESTRICT|TO|WHAT\'S|])(?=\\s|$)',
|
||||
caseInsensitive: true,
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)(?i:(COMPILE-ONLY|IMMEDIATE|IS|RESTRICT|TO|WHAT\'S|]))(?=\\s)' },
|
||||
{ token: 'keyword.control.compile-only.forth',
|
||||
regex: '(?<=^|\\s)(?:-DO|\\-LOOP|\\?DO|\\?LEAVE|\\+DO|\\+LOOP|ABORT\\"|AGAIN|AHEAD|BEGIN|CASE|DO|ELSE|ENDCASE|ENDIF|ENDOF|ENDTRY\\-IFERROR|ENDTRY|FOR|IF|IFERROR|LEAVE|LOOP|NEXT|RECOVER|REPEAT|RESTORE|THEN|TRY|U\\-DO|U\\+DO|UNTIL|WHILE)(?=\\s)',
|
||||
regex: '(?:^|\\s)(?:-DO|\\-LOOP|\\?DO|\\?LEAVE|\\+DO|\\+LOOP|ABORT\\"|AGAIN|AHEAD|BEGIN|CASE|DO|ELSE|ENDCASE|ENDIF|ENDOF|ENDTRY\\-IFERROR|ENDTRY|FOR|IF|IFERROR|LEAVE|LOOP|NEXT|RECOVER|REPEAT|RESTORE|THEN|TRY|U\\-DO|U\\+DO|UNTIL|WHILE)(?=\\s|$)',
|
||||
caseInsensitive: true,
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)(?i:(-DO|\\-LOOP|\\?DO|\\?LEAVE|\\+DO|\\+LOOP|ABORT\\"|AGAIN|AHEAD|BEGIN|CASE|DO|ELSE|ENDCASE|ENDIF|ENDOF|ENDTRY\\-IFERROR|ENDTRY|FOR|IF|IFERROR|LEAVE|LOOP|NEXT|RECOVER|REPEAT|RESTORE|THEN|TRY|U\\-DO|U\\+DO|UNTIL|WHILE))(?=\\s)' },
|
||||
{ token: 'keyword.other.compile-only.forth',
|
||||
regex: '(?<=^|\\s)(?:\\?DUP-0=-IF|\\?DUP-IF|\\)|\\[|\\[\'\\]|\\[CHAR\\]|\\[COMPILE\\]|\\[IS\\]|\\[TO\\]|<COMPILATION|<INTERPRETATION|ASSERT\\(|ASSERT0\\(|ASSERT1\\(|ASSERT2\\(|ASSERT3\\(|COMPILATION>|DEFERS|DOES>|INTERPRETATION>|OF|POSTPONE)(?=\\s)',
|
||||
regex: '(?:^|\\s)(?:\\?DUP-0=-IF|\\?DUP-IF|\\)|\\[|\\[\'\\]|\\[CHAR\\]|\\[COMPILE\\]|\\[IS\\]|\\[TO\\]|<COMPILATION|<INTERPRETATION|ASSERT\\(|ASSERT0\\(|ASSERT1\\(|ASSERT2\\(|ASSERT3\\(|COMPILATION>|DEFERS|DOES>|INTERPRETATION>|OF|POSTPONE)(?=\\s|$)',
|
||||
caseInsensitive: true,
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)(?i:(\\?DUP-0=-IF|\\?DUP-IF|\\)|\\[|\\[\'\\]|\\[CHAR\\]|\\[COMPILE\\]|\\[IS\\]|\\[TO\\]|<COMPILATION|<INTERPRETATION|ASSERT\\(|ASSERT0\\(|ASSERT1\\(|ASSERT2\\(|ASSERT3\\(|COMPILATION>|DEFERS|DOES>|INTERPRETATION>|OF|POSTPONE))(?=\\s)' },
|
||||
{ token: 'keyword.other.non-immediate.forth',
|
||||
regex: '(?<=^|\\s)(?:\'|<IS>|<TO>|CHAR|END-STRUCT|INCLUDE[D]?|LOAD|NEEDS|REQUIRE[D]?|REVISION|SEE|STRUCT|THRU|USE)(?=\\s)',
|
||||
regex: '(?:^|\\s)(?:\'|<IS>|<TO>|CHAR|END-STRUCT|INCLUDE[D]?|LOAD|NEEDS|REQUIRE[D]?|REVISION|SEE|STRUCT|THRU|USE)(?=\\s|$)',
|
||||
caseInsensitive: true,
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)(?i:(\'|<IS>|<TO>|CHAR|END-STRUCT|INCLUDE[D]?|LOAD|NEEDS|REQUIRE[D]?|REVISION|SEE|STRUCT|THRU|USE))(?=\\s)' },
|
||||
{ token: 'keyword.other.warning.forth',
|
||||
regex: '(?<=^|\\s)(?:~~|BREAK:|BREAK"|DBG)(?=\\s)',
|
||||
regex: '(?:^|\\s)(?:~~|BREAK:|BREAK"|DBG)(?=\\s|$)',
|
||||
caseInsensitive: true,
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=^|\\s)(?i:(~~|BREAK:|BREAK"|DBG))(?=\\s)' } ],
|
||||
'#word-def':
|
||||
[ { token:
|
||||
[ 'keyword.other.compile-only.forth',
|
||||
'keyword.other.compile-only.forth',
|
||||
'meta.block.forth',
|
||||
'entity.name.function.forth',
|
||||
'meta.block.forth',
|
||||
'keyword.other.compile-only.forth' ],
|
||||
regex: '(^:|\\s:)(\\s)(\\S+)(\\s)|(:NONAME)',
|
||||
'entity.name.function.forth' ],
|
||||
regex: '(:NONAME)|(^:|\\s:)(\\s)(\\S+)(?=\\s|$)',
|
||||
caseInsensitive: true,
|
||||
push:
|
||||
[ { token: 'keyword.other.compile-only.forth',
|
||||
|
|
|
|||
|
|
@ -638,12 +638,7 @@ var HTMLTwigHighlightRules = function() {
|
|||
'punctuation.separator.key-value.html' ],
|
||||
regex: '\\b(id)\\b(\\s*)(=)',
|
||||
push:
|
||||
[ { token: [],
|
||||
regex: '(?<=\'|")',
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<=\'|")',
|
||||
next: 'pop' },
|
||||
{ token: 'punctuation.definition.string.begin.html',
|
||||
[{ token: 'punctuation.definition.string.begin.html',
|
||||
regex: '"',
|
||||
push:
|
||||
[ { token: 'punctuation.definition.string.end.html',
|
||||
|
|
@ -661,7 +656,8 @@ var HTMLTwigHighlightRules = function() {
|
|||
{ include: '#embedded-code' },
|
||||
{ include: '#entities' },
|
||||
{ defaultToken: 'string.quoted.single.html' } ] },
|
||||
{ defaultToken: 'meta.attribute-with-value.id.html' } ] } ],
|
||||
{ defaultToken: 'meta.attribute-with-value.id.html' },
|
||||
{ token: '', regex: '', next: 'pop' } ] } ],
|
||||
'#tag-stuff':
|
||||
[ { include: '#tag-id-attribute' },
|
||||
{ include: '#tag-generic-attribute' },
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ var Mode = function() {
|
|||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.lineCommentStart = "#";
|
||||
this.blockComment = "";
|
||||
// Extra logic goes here.
|
||||
}).call(Mode.prototype);
|
||||
|
||||
|
|
|
|||
|
|
@ -60,32 +60,15 @@ var JuliaHighlightRules = function() {
|
|||
[ { token:
|
||||
[ 'punctuation.definition.comment.julia',
|
||||
'comment.line.number-sign.julia' ],
|
||||
regex: '(?<!\\$)(#)(?!\\{)(.*$)',
|
||||
TODO: 'FIXME: regexp doesn\'t have js equivalent',
|
||||
originalRegex: '(?<!\\$)(#)(?!\\{).*$\\n?' } ],
|
||||
regex: '(#)(?!\\{)(.*$)'} ],
|
||||
'#function_call':
|
||||
[ { todo:
|
||||
{ token: [ 'support.function.julia', 'text' ],
|
||||
regex: '([a-zA-Z0-9_]+!?)(\\w*\\()',
|
||||
push:
|
||||
[ { token: [ 'text', 'keyword.operator.transposed-func.julia' ],
|
||||
regex: '(\\))((?:(?:\'|\\.\')*\\.?\')?)',
|
||||
next: 'pop' },
|
||||
{ include: '$self' } ] } } ],
|
||||
[ { token: [ 'support.function.julia', 'text' ],
|
||||
regex: '([a-zA-Z0-9_]+!?)(\\w*\\()'} ],
|
||||
'#function_decl':
|
||||
[ { todo:
|
||||
{ token:
|
||||
[ 'keyword.other.julia',
|
||||
'meta.function.julia',
|
||||
'entity.name.function.julia',
|
||||
'meta.function.julia',
|
||||
'meta.function.julia' ],
|
||||
regex: '(function|macro)(\\s*)([a-zA-Z0-9_\\{]+!?)(\\w*)([(\\\\{])',
|
||||
push:
|
||||
[ { token: 'meta.function.julia', regex: '[)\\\\}]', next: 'pop' },
|
||||
{ include: '$self' },
|
||||
{ defaultToken: 'meta.function.julia' } ] } } ],
|
||||
'#keyword':
|
||||
[ { token: [ 'keyword.other.julia', 'meta.function.julia',
|
||||
'entity.name.function.julia', 'meta.function.julia','text' ],
|
||||
regex: '(function|macro)(\\s*)([a-zA-Z0-9_\\{]+!?)(\\w*)([(\\\\{])'} ],
|
||||
'#keyword':
|
||||
[ { token: 'keyword.other.julia',
|
||||
regex: '\\b(?:function|type|immutable|macro|quote|abstract|bitstype|typealias|module|baremodule|new)\\b' },
|
||||
{ token: 'keyword.control.julia',
|
||||
|
|
@ -114,26 +97,13 @@ var JuliaHighlightRules = function() {
|
|||
{ token: 'keyword.operator.dots.julia',
|
||||
regex: '\\.(?=[a-zA-Z])|\\.\\.+' },
|
||||
{ token: 'keyword.operator.interpolation.julia',
|
||||
regex: '\\$(?=.+)' },
|
||||
regex: '\\$#?(?=.)' },
|
||||
{ token: [ 'variable', 'keyword.operator.transposed-variable.julia' ],
|
||||
regex: '(\\w+)((?:\'|\\.\')*\\.?\')' },
|
||||
{ todo:
|
||||
{ token: 'test',
|
||||
regex: '\\[',
|
||||
push:
|
||||
[ { token: [ 'test', 'keyword.operator.transposed-matrix.julia' ],
|
||||
regex: '(\\])((?:\'|\\.\')*\\.?\')',
|
||||
next: 'pop' },
|
||||
{ include: '$self' },
|
||||
{ defaultToken: 'test' } ] } },
|
||||
{ todo:
|
||||
{ token: 'text',
|
||||
regex: '\\(',
|
||||
push:
|
||||
[ { token: [ 'text', 'keyword.operator.transposed-parens.julia' ],
|
||||
regex: '(\\))((?:\'|\\.\')*\\.?\')',
|
||||
next: 'pop' },
|
||||
{ include: '$self' } ] } } ],
|
||||
{ token: 'text',
|
||||
regex: '\\[|\\('},
|
||||
{ token: [ 'text', 'keyword.operator.transposed-matrix.julia' ],
|
||||
regex: "([\\]\\)])((?:'|\\.')*\\.?')"} ],
|
||||
'#string':
|
||||
[ { token: 'punctuation.definition.string.begin.julia',
|
||||
regex: '\'',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue