Skip to content

Commit 24aee53

Browse files
cfscript
1 parent 2d54697 commit 24aee53

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

src/languages/cfscript.js

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

43
/** @type {import('../types.d.ts').LanguageProto<'cfscript'>} */
54
export default {
65
id: 'cfscript',
7-
require: clike,
6+
base: clike,
87
alias: 'cfc',
9-
grammar ({ extend }) {
8+
grammar () {
109
// https://cfdocs.org/script
11-
const cfscript = extend('clike', {
10+
return {
1211
'comment': [
1312
{
1413
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
@@ -42,19 +41,16 @@ export default {
4241
/\b(?:any|array|binary|boolean|date|guid|numeric|query|string|struct|uuid|void|xml)\b/,
4342
alias: 'builtin',
4443
},
45-
});
46-
47-
insertBefore(cfscript, 'keyword', {
48-
// This must be declared before keyword because we use "function" inside the lookahead
49-
'function-variable': {
50-
pattern:
51-
/[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
52-
alias: 'function',
44+
$insert: {
45+
// This must be declared before keyword because we use "function" inside the lookahead
46+
'function-variable': {
47+
$before: 'keyword',
48+
pattern:
49+
/[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
50+
alias: 'function',
51+
},
5352
},
54-
});
55-
56-
delete cfscript['class-name'];
57-
58-
return cfscript;
53+
$delete: ['class-name'],
54+
};
5955
},
6056
};

0 commit comments

Comments
 (0)