@atlaskit/editor-plugin-code-block-advanced 3.1.2 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/cjs/nodeviews/languages/actionscript/languageSupport.js +33 -0
- package/dist/cjs/nodeviews/languages/actionscript/parser.js +38 -0
- package/dist/cjs/nodeviews/languages/languageMap.js +17 -0
- package/dist/es2019/nodeviews/languages/actionscript/languageSupport.js +28 -0
- package/dist/es2019/nodeviews/languages/actionscript/parser.js +29 -0
- package/dist/es2019/nodeviews/languages/languageMap.js +15 -0
- package/dist/esm/nodeviews/languages/actionscript/languageSupport.js +28 -0
- package/dist/esm/nodeviews/languages/actionscript/parser.js +31 -0
- package/dist/esm/nodeviews/languages/languageMap.js +15 -0
- package/dist/types/nodeviews/languages/actionscript/languageSupport.d.ts +10 -0
- package/dist/types/nodeviews/languages/actionscript/parser.d.ts +2 -0
- package/dist/types-ts4.5/nodeviews/languages/actionscript/languageSupport.d.ts +10 -0
- package/dist/types-ts4.5/nodeviews/languages/actionscript/parser.d.ts +2 -0
- package/package.json +6 -2
- package/src/nodeviews/languages/actionscript/actionscript.grammar +32 -0
- package/src/nodeviews/languages/actionscript/languageSupport.ts +27 -0
- package/src/nodeviews/languages/actionscript/parser.ts +23 -0
- package/src/nodeviews/languages/languageMap.ts +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block-advanced
|
|
2
2
|
|
|
3
|
+
## 3.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`ed1db63e29a76`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ed1db63e29a76) -
|
|
8
|
+
[ux] Editor: add basic syntax highlighting for actionscript inside code block
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 3.1.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.actionscriptLanguageSupport = actionscriptLanguageSupport;
|
|
7
|
+
var _language = require("@codemirror/language");
|
|
8
|
+
var _highlight = require("@lezer/highlight");
|
|
9
|
+
var _parser = require("./parser");
|
|
10
|
+
/**
|
|
11
|
+
* Returns a LanguageSupport instance for ActionScript.
|
|
12
|
+
*
|
|
13
|
+
* @returns {LanguageSupport} The language support for ActionScript.
|
|
14
|
+
* @example
|
|
15
|
+
* import { actionscriptLanguageSupport } from './languageSupport';
|
|
16
|
+
* const support = actionscriptLanguageSupport();
|
|
17
|
+
*/
|
|
18
|
+
function actionscriptLanguageSupport() {
|
|
19
|
+
// --- Syntax highlighting rules for ActionScript ---
|
|
20
|
+
var actionScriptHighlight = (0, _highlight.styleTags)({
|
|
21
|
+
'var function': _highlight.tags.controlKeyword,
|
|
22
|
+
Comment: _highlight.tags.comment,
|
|
23
|
+
Number: _highlight.tags.number,
|
|
24
|
+
Identifier: _highlight.tags.variableName,
|
|
25
|
+
String: _highlight.tags.string
|
|
26
|
+
});
|
|
27
|
+
var actionscriptLanguage = _language.LRLanguage.define({
|
|
28
|
+
parser: _parser.parser.configure({
|
|
29
|
+
props: [actionScriptHighlight]
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
return new _language.LanguageSupport(actionscriptLanguage);
|
|
33
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parser = void 0;
|
|
7
|
+
var _lr = require("@lezer/lr");
|
|
8
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
9
|
+
|
|
10
|
+
var spec_Identifier = {
|
|
11
|
+
__proto__: null,
|
|
12
|
+
var: 8,
|
|
13
|
+
function: 14
|
|
14
|
+
};
|
|
15
|
+
var parser = exports.parser = _lr.LRParser.deserialize({
|
|
16
|
+
version: 14,
|
|
17
|
+
states: "$tQYQPOOOOQO'#Cl'#ClOOQO'#Ci'#CiOOQO'#Cd'#CdQYQPOOOkQPO'#CjOpQPO'#CnOuQPO'#CiOOQO-E6b-E6bOzQPO,59UO!SQPO,59YOOQO,59T,59TOOQO1G.p1G.pO!XQPO1G.pO!dQPO1G.tO!iQPO7+$[O!nQPO'#CpO!vQPO7+$`OOQO<<Gv<<GvO!{QPO'#CeO#QQPO,59[O#YQPO<<GzOOQO,59P,59POOQO-E6c-E6cO#_QPO'#CsOOQOAN=fAN=fOOQO,59_,59_O#fQPO,59_OOQO1G.y1G.y",
|
|
18
|
+
stateData: '#m~O[OSPOS~ORPOSTOTPOUPOVUO~ORXO~ORYO~OaZO~O_]Oa[O~Oc^O~ORPOTPOUPO~OR`O~OabO~OecOfdX~OfeO~ORfO~OecOfda~OhhO~OijO~PYOilO~PYO',
|
|
19
|
+
goto: '!fhPPPPPPPPisPPPy!PP!VP!PP!`PP!cQSOSWSkRkhQd`RgdXROShkXQOShkWVOShkR_]Ra^Rie',
|
|
20
|
+
nodeNames: '⚠ Comment Program Identifier var Number String function',
|
|
21
|
+
maxTerm: 25,
|
|
22
|
+
skippedNodes: [0, 1],
|
|
23
|
+
repeatNodeCount: 2,
|
|
24
|
+
tokenData:
|
|
25
|
+
// eslint-disable-next-line
|
|
26
|
+
"&`~RfX^!gpq!grs#[xy$fyz$k|}$p!P!Q$u!Q![%d!]!^%l!_!`%q!c!}%v#T#o%v#o#p&U#q#r&Z#y#z!g$f$g!g#BY#BZ!g$IS$I_!g$I|$JO!g$JT$JU!g$KV$KW!g&FU&FV!g~!lY[~X^!gpq!g#y#z!g$f$g!g#BY#BZ!g$IS$I_!g$I|$JO!g$JT$JU!g$KV$KW!g&FU&FV!g~#_UOY#qZr#qs#O#q#P;'S#q;'S;=`$`<%lO#q~#tVOY#qZr#qrs$Zs#O#q#P;'S#q;'S;=`$`<%lO#q~$`OU~~$cP;=`<%l#q~$kOc~~$pOf~~$uOe~~$xP!P!Q${~%QSP~OY${Z;'S${;'S;=`%^<%lO${~%aP;=`<%l${~%iPT~!Q![%d~%qOa~~%vO_~~%{RR~!Q![%v!c!}%v#T#o%v~&ZOh~~&`Oi~",
|
|
27
|
+
tokenizers: [0],
|
|
28
|
+
topRules: {
|
|
29
|
+
Program: [0, 2]
|
|
30
|
+
},
|
|
31
|
+
specialized: [{
|
|
32
|
+
term: 3,
|
|
33
|
+
get: function get(value) {
|
|
34
|
+
return spec_Identifier[value] || -1;
|
|
35
|
+
}
|
|
36
|
+
}],
|
|
37
|
+
tokenPrec: 0
|
|
38
|
+
});
|
|
@@ -8,6 +8,7 @@ exports.mapLanguageToCodeMirror = void 0;
|
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _language = require("@codemirror/language");
|
|
10
10
|
var _languageData = require("@codemirror/language-data");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
12
13
|
// getLanguageIdentifier defines `language.alias[0]`
|
|
13
14
|
var mapLanguageToCodeMirror = exports.mapLanguageToCodeMirror = function mapLanguageToCodeMirror(language) {
|
|
@@ -111,6 +112,22 @@ var mapLanguageToCodeMirror = exports.mapLanguageToCodeMirror = function mapLang
|
|
|
111
112
|
});
|
|
112
113
|
}
|
|
113
114
|
});
|
|
115
|
+
case 'actionscript':
|
|
116
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_code_syntax_highlight_actionscript')) {
|
|
117
|
+
return _language.LanguageDescription.of({
|
|
118
|
+
name: 'ActionScript',
|
|
119
|
+
load: function load() {
|
|
120
|
+
return Promise.resolve().then(function () {
|
|
121
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlaskit/editor-plugin-code-block-advanced-lang-actionscript" */
|
|
122
|
+
'./actionscript/languageSupport'));
|
|
123
|
+
}).then(function (m) {
|
|
124
|
+
return m.actionscriptLanguageSupport();
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
} else {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
114
131
|
default:
|
|
115
132
|
return _languageData.languages.find(function (l) {
|
|
116
133
|
return l.alias.includes(language) || l.name.toLowerCase() === (language === null || language === void 0 ? void 0 : language.toLowerCase());
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LRLanguage, LanguageSupport } from '@codemirror/language';
|
|
2
|
+
import { styleTags, tags } from '@lezer/highlight';
|
|
3
|
+
import { parser } from './parser';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns a LanguageSupport instance for ActionScript.
|
|
7
|
+
*
|
|
8
|
+
* @returns {LanguageSupport} The language support for ActionScript.
|
|
9
|
+
* @example
|
|
10
|
+
* import { actionscriptLanguageSupport } from './languageSupport';
|
|
11
|
+
* const support = actionscriptLanguageSupport();
|
|
12
|
+
*/
|
|
13
|
+
export function actionscriptLanguageSupport() {
|
|
14
|
+
// --- Syntax highlighting rules for ActionScript ---
|
|
15
|
+
const actionScriptHighlight = styleTags({
|
|
16
|
+
'var function': tags.controlKeyword,
|
|
17
|
+
Comment: tags.comment,
|
|
18
|
+
Number: tags.number,
|
|
19
|
+
Identifier: tags.variableName,
|
|
20
|
+
String: tags.string
|
|
21
|
+
});
|
|
22
|
+
const actionscriptLanguage = LRLanguage.define({
|
|
23
|
+
parser: parser.configure({
|
|
24
|
+
props: [actionScriptHighlight]
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
return new LanguageSupport(actionscriptLanguage);
|
|
28
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
import { LRParser } from '@lezer/lr';
|
|
3
|
+
const spec_Identifier = {
|
|
4
|
+
__proto__: null,
|
|
5
|
+
var: 8,
|
|
6
|
+
function: 14
|
|
7
|
+
};
|
|
8
|
+
export const parser = LRParser.deserialize({
|
|
9
|
+
version: 14,
|
|
10
|
+
states: "$tQYQPOOOOQO'#Cl'#ClOOQO'#Ci'#CiOOQO'#Cd'#CdQYQPOOOkQPO'#CjOpQPO'#CnOuQPO'#CiOOQO-E6b-E6bOzQPO,59UO!SQPO,59YOOQO,59T,59TOOQO1G.p1G.pO!XQPO1G.pO!dQPO1G.tO!iQPO7+$[O!nQPO'#CpO!vQPO7+$`OOQO<<Gv<<GvO!{QPO'#CeO#QQPO,59[O#YQPO<<GzOOQO,59P,59POOQO-E6c-E6cO#_QPO'#CsOOQOAN=fAN=fOOQO,59_,59_O#fQPO,59_OOQO1G.y1G.y",
|
|
11
|
+
stateData: '#m~O[OSPOS~ORPOSTOTPOUPOVUO~ORXO~ORYO~OaZO~O_]Oa[O~Oc^O~ORPOTPOUPO~OR`O~OabO~OecOfdX~OfeO~ORfO~OecOfda~OhhO~OijO~PYOilO~PYO',
|
|
12
|
+
goto: '!fhPPPPPPPPisPPPy!PP!VP!PP!`PP!cQSOSWSkRkhQd`RgdXROShkXQOShkWVOShkR_]Ra^Rie',
|
|
13
|
+
nodeNames: '⚠ Comment Program Identifier var Number String function',
|
|
14
|
+
maxTerm: 25,
|
|
15
|
+
skippedNodes: [0, 1],
|
|
16
|
+
repeatNodeCount: 2,
|
|
17
|
+
tokenData:
|
|
18
|
+
// eslint-disable-next-line
|
|
19
|
+
"&`~RfX^!gpq!grs#[xy$fyz$k|}$p!P!Q$u!Q![%d!]!^%l!_!`%q!c!}%v#T#o%v#o#p&U#q#r&Z#y#z!g$f$g!g#BY#BZ!g$IS$I_!g$I|$JO!g$JT$JU!g$KV$KW!g&FU&FV!g~!lY[~X^!gpq!g#y#z!g$f$g!g#BY#BZ!g$IS$I_!g$I|$JO!g$JT$JU!g$KV$KW!g&FU&FV!g~#_UOY#qZr#qs#O#q#P;'S#q;'S;=`$`<%lO#q~#tVOY#qZr#qrs$Zs#O#q#P;'S#q;'S;=`$`<%lO#q~$`OU~~$cP;=`<%l#q~$kOc~~$pOf~~$uOe~~$xP!P!Q${~%QSP~OY${Z;'S${;'S;=`%^<%lO${~%aP;=`<%l${~%iPT~!Q![%d~%qOa~~%vO_~~%{RR~!Q![%v!c!}%v#T#o%v~&ZOh~~&`Oi~",
|
|
20
|
+
tokenizers: [0],
|
|
21
|
+
topRules: {
|
|
22
|
+
Program: [0, 2]
|
|
23
|
+
},
|
|
24
|
+
specialized: [{
|
|
25
|
+
term: 3,
|
|
26
|
+
get: value => spec_Identifier[value] || -1
|
|
27
|
+
}],
|
|
28
|
+
tokenPrec: 0
|
|
29
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LanguageDescription, LanguageSupport } from '@codemirror/language';
|
|
2
2
|
import { languages } from '@codemirror/language-data';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
// getLanguageIdentifier defines `language.alias[0]`
|
|
4
5
|
export const mapLanguageToCodeMirror = language => {
|
|
5
6
|
if (!language || language === 'none') {
|
|
@@ -90,6 +91,20 @@ export const mapLanguageToCodeMirror = language => {
|
|
|
90
91
|
'cm6-graphql').then(m => m.graphqlLanguageSupport());
|
|
91
92
|
}
|
|
92
93
|
});
|
|
94
|
+
case 'actionscript':
|
|
95
|
+
if (fg('platform_editor_code_syntax_highlight_actionscript')) {
|
|
96
|
+
return LanguageDescription.of({
|
|
97
|
+
name: 'ActionScript',
|
|
98
|
+
load() {
|
|
99
|
+
return import( /* webpackChunkName: "@atlaskit-internal_@atlaskit/editor-plugin-code-block-advanced-lang-actionscript" */
|
|
100
|
+
'./actionscript/languageSupport').then(m => {
|
|
101
|
+
return m.actionscriptLanguageSupport();
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
} else {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
93
108
|
default:
|
|
94
109
|
return languages.find(l => {
|
|
95
110
|
return l.alias.includes(language) || l.name.toLowerCase() === (language === null || language === void 0 ? void 0 : language.toLowerCase());
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LRLanguage, LanguageSupport } from '@codemirror/language';
|
|
2
|
+
import { styleTags, tags } from '@lezer/highlight';
|
|
3
|
+
import { parser } from './parser';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns a LanguageSupport instance for ActionScript.
|
|
7
|
+
*
|
|
8
|
+
* @returns {LanguageSupport} The language support for ActionScript.
|
|
9
|
+
* @example
|
|
10
|
+
* import { actionscriptLanguageSupport } from './languageSupport';
|
|
11
|
+
* const support = actionscriptLanguageSupport();
|
|
12
|
+
*/
|
|
13
|
+
export function actionscriptLanguageSupport() {
|
|
14
|
+
// --- Syntax highlighting rules for ActionScript ---
|
|
15
|
+
var actionScriptHighlight = styleTags({
|
|
16
|
+
'var function': tags.controlKeyword,
|
|
17
|
+
Comment: tags.comment,
|
|
18
|
+
Number: tags.number,
|
|
19
|
+
Identifier: tags.variableName,
|
|
20
|
+
String: tags.string
|
|
21
|
+
});
|
|
22
|
+
var actionscriptLanguage = LRLanguage.define({
|
|
23
|
+
parser: parser.configure({
|
|
24
|
+
props: [actionScriptHighlight]
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
return new LanguageSupport(actionscriptLanguage);
|
|
28
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
import { LRParser } from '@lezer/lr';
|
|
3
|
+
var spec_Identifier = {
|
|
4
|
+
__proto__: null,
|
|
5
|
+
var: 8,
|
|
6
|
+
function: 14
|
|
7
|
+
};
|
|
8
|
+
export var parser = LRParser.deserialize({
|
|
9
|
+
version: 14,
|
|
10
|
+
states: "$tQYQPOOOOQO'#Cl'#ClOOQO'#Ci'#CiOOQO'#Cd'#CdQYQPOOOkQPO'#CjOpQPO'#CnOuQPO'#CiOOQO-E6b-E6bOzQPO,59UO!SQPO,59YOOQO,59T,59TOOQO1G.p1G.pO!XQPO1G.pO!dQPO1G.tO!iQPO7+$[O!nQPO'#CpO!vQPO7+$`OOQO<<Gv<<GvO!{QPO'#CeO#QQPO,59[O#YQPO<<GzOOQO,59P,59POOQO-E6c-E6cO#_QPO'#CsOOQOAN=fAN=fOOQO,59_,59_O#fQPO,59_OOQO1G.y1G.y",
|
|
11
|
+
stateData: '#m~O[OSPOS~ORPOSTOTPOUPOVUO~ORXO~ORYO~OaZO~O_]Oa[O~Oc^O~ORPOTPOUPO~OR`O~OabO~OecOfdX~OfeO~ORfO~OecOfda~OhhO~OijO~PYOilO~PYO',
|
|
12
|
+
goto: '!fhPPPPPPPPisPPPy!PP!VP!PP!`PP!cQSOSWSkRkhQd`RgdXROShkXQOShkWVOShkR_]Ra^Rie',
|
|
13
|
+
nodeNames: '⚠ Comment Program Identifier var Number String function',
|
|
14
|
+
maxTerm: 25,
|
|
15
|
+
skippedNodes: [0, 1],
|
|
16
|
+
repeatNodeCount: 2,
|
|
17
|
+
tokenData:
|
|
18
|
+
// eslint-disable-next-line
|
|
19
|
+
"&`~RfX^!gpq!grs#[xy$fyz$k|}$p!P!Q$u!Q![%d!]!^%l!_!`%q!c!}%v#T#o%v#o#p&U#q#r&Z#y#z!g$f$g!g#BY#BZ!g$IS$I_!g$I|$JO!g$JT$JU!g$KV$KW!g&FU&FV!g~!lY[~X^!gpq!g#y#z!g$f$g!g#BY#BZ!g$IS$I_!g$I|$JO!g$JT$JU!g$KV$KW!g&FU&FV!g~#_UOY#qZr#qs#O#q#P;'S#q;'S;=`$`<%lO#q~#tVOY#qZr#qrs$Zs#O#q#P;'S#q;'S;=`$`<%lO#q~$`OU~~$cP;=`<%l#q~$kOc~~$pOf~~$uOe~~$xP!P!Q${~%QSP~OY${Z;'S${;'S;=`%^<%lO${~%aP;=`<%l${~%iPT~!Q![%d~%qOa~~%vO_~~%{RR~!Q![%v!c!}%v#T#o%v~&ZOh~~&`Oi~",
|
|
20
|
+
tokenizers: [0],
|
|
21
|
+
topRules: {
|
|
22
|
+
Program: [0, 2]
|
|
23
|
+
},
|
|
24
|
+
specialized: [{
|
|
25
|
+
term: 3,
|
|
26
|
+
get: function get(value) {
|
|
27
|
+
return spec_Identifier[value] || -1;
|
|
28
|
+
}
|
|
29
|
+
}],
|
|
30
|
+
tokenPrec: 0
|
|
31
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LanguageDescription, LanguageSupport } from '@codemirror/language';
|
|
2
2
|
import { languages } from '@codemirror/language-data';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
// getLanguageIdentifier defines `language.alias[0]`
|
|
4
5
|
export var mapLanguageToCodeMirror = function mapLanguageToCodeMirror(language) {
|
|
5
6
|
if (!language || language === 'none') {
|
|
@@ -96,6 +97,20 @@ export var mapLanguageToCodeMirror = function mapLanguageToCodeMirror(language)
|
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
});
|
|
100
|
+
case 'actionscript':
|
|
101
|
+
if (fg('platform_editor_code_syntax_highlight_actionscript')) {
|
|
102
|
+
return LanguageDescription.of({
|
|
103
|
+
name: 'ActionScript',
|
|
104
|
+
load: function load() {
|
|
105
|
+
return import( /* webpackChunkName: "@atlaskit-internal_@atlaskit/editor-plugin-code-block-advanced-lang-actionscript" */
|
|
106
|
+
'./actionscript/languageSupport').then(function (m) {
|
|
107
|
+
return m.actionscriptLanguageSupport();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
} else {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
99
114
|
default:
|
|
100
115
|
return languages.find(function (l) {
|
|
101
116
|
return l.alias.includes(language) || l.name.toLowerCase() === (language === null || language === void 0 ? void 0 : language.toLowerCase());
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LanguageSupport } from '@codemirror/language';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a LanguageSupport instance for ActionScript.
|
|
4
|
+
*
|
|
5
|
+
* @returns {LanguageSupport} The language support for ActionScript.
|
|
6
|
+
* @example
|
|
7
|
+
* import { actionscriptLanguageSupport } from './languageSupport';
|
|
8
|
+
* const support = actionscriptLanguageSupport();
|
|
9
|
+
*/
|
|
10
|
+
export declare function actionscriptLanguageSupport(): LanguageSupport;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LanguageSupport } from '@codemirror/language';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a LanguageSupport instance for ActionScript.
|
|
4
|
+
*
|
|
5
|
+
* @returns {LanguageSupport} The language support for ActionScript.
|
|
6
|
+
* @example
|
|
7
|
+
* import { actionscriptLanguageSupport } from './languageSupport';
|
|
8
|
+
* const support = actionscriptLanguageSupport();
|
|
9
|
+
*/
|
|
10
|
+
export declare function actionscriptLanguageSupport(): LanguageSupport;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block-advanced",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@atlaskit/editor-plugin-selection-marker": "^3.0.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
41
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
42
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
42
|
+
"@atlaskit/tmp-editor-statsig": "^11.3.0",
|
|
43
43
|
"@atlaskit/tokens": "^6.0.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@codemirror/autocomplete": "6.18.4",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"@codemirror/state": "6.5.1",
|
|
50
50
|
"@codemirror/view": "6.36.2",
|
|
51
51
|
"@lezer/highlight": "1.2.1",
|
|
52
|
+
"@lezer/lr": "^1.4.2",
|
|
52
53
|
"@xiechao/codemirror-lang-handlebars": "^1.0.4",
|
|
53
54
|
"cm6-graphql": "0.2.0",
|
|
54
55
|
"codemirror-lang-elixir": "4.0.0"
|
|
@@ -99,6 +100,9 @@
|
|
|
99
100
|
"platform-feature-flags": {
|
|
100
101
|
"platform_editor_breakout_resizing_hello_release": {
|
|
101
102
|
"type": "boolean"
|
|
103
|
+
},
|
|
104
|
+
"platform_editor_code_syntax_highlight_actionscript": {
|
|
105
|
+
"type": "boolean"
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// top level contains statements
|
|
2
|
+
@top Program { statement* }
|
|
3
|
+
// statement can be variable declaration, function declaration or expression
|
|
4
|
+
statement { variableDeclaration | functionDeclaration | expressionStatement }
|
|
5
|
+
// basic variable declaration grammar
|
|
6
|
+
variableDeclaration { kw<"var"> Identifier ("=" expression)? ";" }
|
|
7
|
+
// basic function declaration structure
|
|
8
|
+
functionDeclaration { kw<"function"> Identifier "(" paramList ")" block }
|
|
9
|
+
// separated by ,
|
|
10
|
+
paramList { Identifier ("," Identifier)* }
|
|
11
|
+
// a block is statements surrounded by braces
|
|
12
|
+
block { "{" statement* "}" }
|
|
13
|
+
// expression statement can be simple as express followed by ;
|
|
14
|
+
expressionStatement { expression ";" }
|
|
15
|
+
// expression can be Identifier or primitives
|
|
16
|
+
expression { Identifier | Number | String }
|
|
17
|
+
|
|
18
|
+
// declare keyword to avoid conflicts
|
|
19
|
+
kw<term> { @specialize[@name={term}]<Identifier, term> }
|
|
20
|
+
|
|
21
|
+
@skip { space | Comment }
|
|
22
|
+
|
|
23
|
+
// tokens can use build-in character sets with @xyz
|
|
24
|
+
@tokens {
|
|
25
|
+
identifierChar { @asciiLetter }
|
|
26
|
+
word { identifierChar (identifierChar | @digit)* }
|
|
27
|
+
Identifier { word }
|
|
28
|
+
Number { (@digit)+ }
|
|
29
|
+
space { @whitespace+ }
|
|
30
|
+
Comment { "//" ![\n]* }
|
|
31
|
+
String { '"' ![\\\n"]+ '"' }
|
|
32
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LRLanguage, LanguageSupport } from '@codemirror/language';
|
|
2
|
+
import { styleTags, tags } from '@lezer/highlight';
|
|
3
|
+
|
|
4
|
+
import { parser } from './parser';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns a LanguageSupport instance for ActionScript.
|
|
8
|
+
*
|
|
9
|
+
* @returns {LanguageSupport} The language support for ActionScript.
|
|
10
|
+
* @example
|
|
11
|
+
* import { actionscriptLanguageSupport } from './languageSupport';
|
|
12
|
+
* const support = actionscriptLanguageSupport();
|
|
13
|
+
*/
|
|
14
|
+
export function actionscriptLanguageSupport() {
|
|
15
|
+
// --- Syntax highlighting rules for ActionScript ---
|
|
16
|
+
const actionScriptHighlight = styleTags({
|
|
17
|
+
'var function': tags.controlKeyword,
|
|
18
|
+
Comment: tags.comment,
|
|
19
|
+
Number: tags.number,
|
|
20
|
+
Identifier: tags.variableName,
|
|
21
|
+
String: tags.string
|
|
22
|
+
});
|
|
23
|
+
const actionscriptLanguage = LRLanguage.define({
|
|
24
|
+
parser: parser.configure({ props: [actionScriptHighlight] }),
|
|
25
|
+
});
|
|
26
|
+
return new LanguageSupport(actionscriptLanguage);
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
import { LRParser } from '@lezer/lr';
|
|
3
|
+
|
|
4
|
+
const spec_Identifier = { __proto__: null, var: 8, function: 14 };
|
|
5
|
+
export const parser = LRParser.deserialize({
|
|
6
|
+
version: 14,
|
|
7
|
+
states:
|
|
8
|
+
"$tQYQPOOOOQO'#Cl'#ClOOQO'#Ci'#CiOOQO'#Cd'#CdQYQPOOOkQPO'#CjOpQPO'#CnOuQPO'#CiOOQO-E6b-E6bOzQPO,59UO!SQPO,59YOOQO,59T,59TOOQO1G.p1G.pO!XQPO1G.pO!dQPO1G.tO!iQPO7+$[O!nQPO'#CpO!vQPO7+$`OOQO<<Gv<<GvO!{QPO'#CeO#QQPO,59[O#YQPO<<GzOOQO,59P,59POOQO-E6c-E6cO#_QPO'#CsOOQOAN=fAN=fOOQO,59_,59_O#fQPO,59_OOQO1G.y1G.y",
|
|
9
|
+
stateData:
|
|
10
|
+
'#m~O[OSPOS~ORPOSTOTPOUPOVUO~ORXO~ORYO~OaZO~O_]Oa[O~Oc^O~ORPOTPOUPO~OR`O~OabO~OecOfdX~OfeO~ORfO~OecOfda~OhhO~OijO~PYOilO~PYO',
|
|
11
|
+
goto: '!fhPPPPPPPPisPPPy!PP!VP!PP!`PP!cQSOSWSkRkhQd`RgdXROShkXQOShkWVOShkR_]Ra^Rie',
|
|
12
|
+
nodeNames: '⚠ Comment Program Identifier var Number String function',
|
|
13
|
+
maxTerm: 25,
|
|
14
|
+
skippedNodes: [0, 1],
|
|
15
|
+
repeatNodeCount: 2,
|
|
16
|
+
tokenData:
|
|
17
|
+
// eslint-disable-next-line
|
|
18
|
+
"&`~RfX^!gpq!grs#[xy$fyz$k|}$p!P!Q$u!Q![%d!]!^%l!_!`%q!c!}%v#T#o%v#o#p&U#q#r&Z#y#z!g$f$g!g#BY#BZ!g$IS$I_!g$I|$JO!g$JT$JU!g$KV$KW!g&FU&FV!g~!lY[~X^!gpq!g#y#z!g$f$g!g#BY#BZ!g$IS$I_!g$I|$JO!g$JT$JU!g$KV$KW!g&FU&FV!g~#_UOY#qZr#qs#O#q#P;'S#q;'S;=`$`<%lO#q~#tVOY#qZr#qrs$Zs#O#q#P;'S#q;'S;=`$`<%lO#q~$`OU~~$cP;=`<%l#q~$kOc~~$pOf~~$uOe~~$xP!P!Q${~%QSP~OY${Z;'S${;'S;=`%^<%lO${~%aP;=`<%l${~%iPT~!Q![%d~%qOa~~%vO_~~%{RR~!Q![%v!c!}%v#T#o%v~&ZOh~~&`Oi~",
|
|
19
|
+
tokenizers: [0],
|
|
20
|
+
topRules: { Program: [0, 2] },
|
|
21
|
+
specialized: [{ term: 3, get: (value: 'var' | 'function') => spec_Identifier[value] || -1 }],
|
|
22
|
+
tokenPrec: 0,
|
|
23
|
+
});
|
|
@@ -2,6 +2,7 @@ import { LanguageDescription, LanguageSupport } from '@codemirror/language';
|
|
|
2
2
|
import { languages } from '@codemirror/language-data';
|
|
3
3
|
|
|
4
4
|
import type { LanguageAlias } from '@atlaskit/code';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
|
|
6
7
|
type LanguageAliasValue = LanguageAlias[0];
|
|
7
8
|
|
|
@@ -101,6 +102,22 @@ export const mapLanguageToCodeMirror = (language: LanguageAliasValue) => {
|
|
|
101
102
|
).then((m) => m.graphqlLanguageSupport());
|
|
102
103
|
},
|
|
103
104
|
});
|
|
105
|
+
case 'actionscript':
|
|
106
|
+
if (fg('platform_editor_code_syntax_highlight_actionscript')) {
|
|
107
|
+
return LanguageDescription.of({
|
|
108
|
+
name: 'ActionScript',
|
|
109
|
+
load() {
|
|
110
|
+
return import(
|
|
111
|
+
/* webpackChunkName: "@atlaskit-internal_@atlaskit/editor-plugin-code-block-advanced-lang-actionscript" */
|
|
112
|
+
'./actionscript/languageSupport'
|
|
113
|
+
).then((m) => {
|
|
114
|
+
return m.actionscriptLanguageSupport();
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
104
121
|
default:
|
|
105
122
|
return languages.find((l) => {
|
|
106
123
|
return l.alias.includes(language) || l.name.toLowerCase() === language?.toLowerCase();
|