Skip to content

Commit 2c4e6cd

Browse files
Transform actionscript
1 parent f35f11d commit 2c4e6cd

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

src/languages/actionscript.js

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,30 @@
1-
import { insertBefore } from '../util/language-util.js';
21
import javascript from './javascript.js';
32

43
/** @type {import('../types.d.ts').LanguageProto<'actionscript'>} */
54
export default {
65
id: 'actionscript',
76
base: javascript,
8-
grammar ({ base }) {
9-
const className = /** @type {GrammarToken} */ (base['class-name']);
10-
className.alias = 'function';
11-
12-
delete base['doc-comment'];
13-
14-
// doesn't work with AS because AS is too complex
15-
delete base['parameter'];
16-
delete base['literal-property'];
17-
18-
insertBefore(base, 'string', {
19-
'xml': {
20-
pattern:
21-
/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,
22-
lookbehind: true,
23-
inside: 'markup',
24-
},
25-
});
26-
7+
grammar () {
278
return {
289
'keyword':
2910
/\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,
3011
'operator': /\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/,
12+
// doesn't work with AS because AS is too complex
13+
$delete: ['doc-comment', 'parameter', 'literal-property'],
14+
$merge: {
15+
'class-name': {
16+
alias: 'function',
17+
},
18+
},
19+
$insert: {
20+
'xml': {
21+
$before: 'string',
22+
pattern:
23+
/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,
24+
lookbehind: true,
25+
inside: 'markup',
26+
},
27+
},
3128
};
3229
},
3330
};
34-
35-
/**
36-
* @typedef {import('../types.d.ts').GrammarToken} GrammarToken
37-
*/

0 commit comments

Comments
 (0)