Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
1609c66
chaiscript
DmitrySharabin Oct 10, 2025
6ef4fd3
crystal
DmitrySharabin Oct 10, 2025
2da8558
csharp
DmitrySharabin Oct 10, 2025
fc88b69
flow
DmitrySharabin Oct 10, 2025
d4d17e6
fsharp
DmitrySharabin Oct 10, 2025
e1b9856
haml
DmitrySharabin Oct 10, 2025
c1be523
http
DmitrySharabin Oct 10, 2025
f81c22a
java
DmitrySharabin Oct 10, 2025
60721fe
vbnet
DmitrySharabin Oct 10, 2025
f61f120
squirrel
DmitrySharabin Oct 10, 2025
47e2c15
ruby
DmitrySharabin Oct 10, 2025
03e72fa
jsdoc
DmitrySharabin Oct 10, 2025
6a152b6
javascript
DmitrySharabin Oct 10, 2025
365e531
actionscript
DmitrySharabin Oct 10, 2025
b735cc6
birb
DmitrySharabin Oct 10, 2025
fee181c
bison
DmitrySharabin Oct 10, 2025
2d7f523
cfscript
DmitrySharabin Oct 10, 2025
e61af12
cilkc
DmitrySharabin Oct 10, 2025
3a63677
cilkcpp
DmitrySharabin Oct 10, 2025
2d9b1e4
d
DmitrySharabin Oct 10, 2025
d2588bf
dart
DmitrySharabin Oct 10, 2025
6b9173a
django
DmitrySharabin Oct 10, 2025
fa11e70
ejs
DmitrySharabin Oct 10, 2025
28a9227
elixir
DmitrySharabin Oct 10, 2025
aec12ea
erb
DmitrySharabin Oct 10, 2025
72d3fae
etlua
DmitrySharabin Oct 10, 2025
2fd8482
firestore-security-rules
DmitrySharabin Oct 10, 2025
3196cd4
ftl
DmitrySharabin Oct 10, 2025
2fdfc4f
go
DmitrySharabin Oct 10, 2025
b7a810b
gradle
DmitrySharabin Oct 10, 2025
3852955
graphql
DmitrySharabin Oct 10, 2025
d5a2e07
groovy
DmitrySharabin Oct 10, 2025
1787055
handlebars
DmitrySharabin Oct 10, 2025
4b8de24
haxe
DmitrySharabin Oct 10, 2025
c0dbb8e
icu-message-format
DmitrySharabin Oct 10, 2025
b7d759a
idris
DmitrySharabin Oct 10, 2025
79cb78c
inform7
DmitrySharabin Oct 10, 2025
84f87ba
javadoc
DmitrySharabin Oct 10, 2025
6e1dcd4
jolie
DmitrySharabin Oct 10, 2025
b36ae86
js-templates
DmitrySharabin Oct 10, 2025
7d6b304
jsonp
DmitrySharabin Oct 10, 2025
5237feb
kotlin
DmitrySharabin Oct 10, 2025
7fa04ea
less
DmitrySharabin Oct 10, 2025
3270297
lilypond
DmitrySharabin Oct 10, 2025
248bf28
liquid
DmitrySharabin Oct 10, 2025
c0f86f0
lisp
DmitrySharabin Oct 10, 2025
d087711
livescript
DmitrySharabin Oct 10, 2025
cd31eb9
markdown
DmitrySharabin Oct 10, 2025
6be1b80
markup
DmitrySharabin Oct 13, 2025
b584344
mongodb
DmitrySharabin Oct 10, 2025
41eb041
n4js
DmitrySharabin Oct 10, 2025
95c4505
naniscript
DmitrySharabin Oct 10, 2025
4f90571
objectivec
DmitrySharabin Oct 10, 2025
6b6075a
opencl
DmitrySharabin Oct 10, 2025
08a7f2a
phpdoc
DmitrySharabin Oct 10, 2025
2e32f71
plsql
DmitrySharabin Oct 10, 2025
04357a2
processing
DmitrySharabin Oct 10, 2025
a4ea99d
protobuf
DmitrySharabin Oct 10, 2025
e320fc7
pug
DmitrySharabin Oct 10, 2025
b90552e
puppet
DmitrySharabin Oct 10, 2025
4bc7026
purebasic
DmitrySharabin Oct 10, 2025
784c1aa
python
DmitrySharabin Oct 10, 2025
2de843f
qsharp
DmitrySharabin Oct 13, 2025
0416960
racket
DmitrySharabin Oct 13, 2025
813e60c
reason
DmitrySharabin Oct 13, 2025
c804232
rust
DmitrySharabin Oct 13, 2025
219af11
sas
DmitrySharabin Oct 13, 2025
62e85af
sass
DmitrySharabin Oct 13, 2025
e803587
scala
DmitrySharabin Oct 13, 2025
bb07b79
scss
DmitrySharabin Oct 13, 2025
3fc3f95
smarty
DmitrySharabin Oct 13, 2025
15f44d4
solidity
DmitrySharabin Oct 13, 2025
b521dd5
soy
DmitrySharabin Oct 13, 2025
54f61df
sparql
DmitrySharabin Oct 13, 2025
84d59f4
sqf
DmitrySharabin Oct 13, 2025
72bf307
stylus
DmitrySharabin Oct 13, 2025
be7c237
textile
DmitrySharabin Oct 13, 2025
b660e3a
treeview
DmitrySharabin Oct 13, 2025
64d2f08
twig
DmitrySharabin Oct 13, 2025
e8e0af2
v
DmitrySharabin Oct 13, 2025
486d8b9
vala
DmitrySharabin Oct 13, 2025
e4efaab
velocity
DmitrySharabin Oct 13, 2025
5b0e571
wiki
DmitrySharabin Oct 13, 2025
cdcf21b
rescript
DmitrySharabin Oct 13, 2025
8b09b0c
css
DmitrySharabin Oct 13, 2025
4ae29d0
c
DmitrySharabin Oct 13, 2025
3e6cef4
coffeescript
DmitrySharabin Oct 13, 2025
e02ed96
aspnet
DmitrySharabin Oct 13, 2025
cbc25aa
latte
DmitrySharabin Oct 13, 2025
0b2513d
tt2
DmitrySharabin Oct 13, 2025
4c9b470
pure
DmitrySharabin Oct 13, 2025
8985d72
cshtml
DmitrySharabin Oct 13, 2025
014d325
parser
DmitrySharabin Oct 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 17 additions & 24 deletions src/languages/actionscript.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,30 @@
import { insertBefore } from '../util/language-util.js';
import javascript from './javascript.js';

/** @type {import('../types.d.ts').LanguageProto<'actionscript'>} */
export default {
id: 'actionscript',
base: javascript,
grammar ({ base }) {
const className = /** @type {GrammarToken} */ (base['class-name']);
className.alias = 'function';

delete base['doc-comment'];

// doesn't work with AS because AS is too complex
delete base['parameter'];
delete base['literal-property'];

insertBefore(base, 'string', {
'xml': {
pattern:
/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,
lookbehind: true,
inside: 'markup',
},
});

grammar () {
return {
'keyword':
/\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/,
'operator': /\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/,

Check warning on line 11 in src/languages/actionscript.js

View workflow job for this annotation

GitHub Actions / lint

'>?' and '>?' can be replaced with '>{0,2}'

Check warning on line 11 in src/languages/actionscript.js

View workflow job for this annotation

GitHub Actions / lint

Unnecessary escape character: \/
// doesn't work with AS because AS is too complex
$delete: ['doc-comment', 'parameter', 'literal-property'],
$merge: {
'class-name': {
alias: 'function',
},
},
$insert: {
'xml': {
$before: 'string',
pattern:
/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,

Check warning on line 23 in src/languages/actionscript.js

View workflow job for this annotation

GitHub Actions / lint

Unnecessary escape character: \/
lookbehind: true,
inside: 'markup',
},
},
};
},
};

/**
* @typedef {import('../types.d.ts').GrammarToken} GrammarToken
*/
69 changes: 32 additions & 37 deletions src/languages/aspnet.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { insertBefore } from '../util/language-util.js';
import csharp from './csharp.js';
import markup from './markup.js';

Expand All @@ -16,42 +15,11 @@ export default {
pattern: /<%\s*?[$=%#:]{0,2}|%>/,
alias: 'tag',
},
$rest: /** @type {Grammar['$rest']} */ ('csharp'),
$rest: 'csharp',
},
});

const tag =
/** @type {GrammarToken & { inside: { 'attr-value': { inside: Grammar } } }} */ (
base['tag']
);

// Regexp copied from markup, with a negative look-ahead added
tag.pattern =
/<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/;

// match directives of attribute value foo="<% Bar %>"
insertBefore(tag.inside['attr-value'].inside, 'punctuation', {
'directive': directive,
});

insertBefore(base, 'comment', {
'asp-comment': {
pattern: /<%--[\s\S]*?--%>/,
alias: ['asp', 'comment'],
},
});

// script runat="server" contains csharp, not javascript
insertBefore(base, 'script' in base ? 'script' : 'tag', {
'asp-script': {
pattern: /(<script(?=.*runat=['"]?server\b)[^>]*>)[\s\S]*?(?=<\/script>)/i,
lookbehind: true,
alias: ['asp', 'script'],
inside: 'csharp',
},
});

return /** @type {Grammar} */ ({
return {
'page-directive': {
pattern: /<%\s*@.*%>/,
alias: 'tag',
Expand All @@ -61,15 +29,42 @@ export default {
/<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i,
alias: 'tag',
},
$rest: /** @type {Grammar['$rest']} */ (tag.inside),
$rest: /** @type {GrammarToken} */ (base['tag']).inside,
},
},
'directive': directive,
});
$merge: {
'tag': {
// Regexp copied from markup, with a negative look-ahead added
pattern:
/<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/,
},
},
$insertBefore: {
'tag/attr-value/punctuation': {
// match directives of attribute value foo="<% Bar %>"
'directive': directive,
},
'comment': {
'asp-comment': {
pattern: /<%--[\s\S]*?--%>/,
alias: ['asp', 'comment'],
},
},
// script runat="server" contains csharp, not javascript
['script' in base ? 'script' : 'tag']: {
'asp-script': {
pattern: /(<script(?=.*runat=['"]?server\b)[^>]*>)[\s\S]*?(?=<\/script>)/i,
lookbehind: true,
alias: ['asp', 'script'],
inside: 'csharp',
},
},
},
};
},
};

/**
* @typedef {import('../types.d.ts').Grammar} Grammar
* @typedef {import('../types.d.ts').GrammarToken} GrammarToken
*/
19 changes: 9 additions & 10 deletions src/languages/birb.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import { insertBefore } from '../util/language-util.js';
import clike from './clike.js';

/** @type {import('../types.d.ts').LanguageProto<'birb'>} */
export default {
id: 'birb',
base: clike,
grammar ({ base }) {
insertBefore(base, 'function', {
'metadata': {
pattern: /<\w+>/,
greedy: true,
alias: 'symbol',
},
});

grammar () {
return {
'string': {
pattern: /r?("|')(?:\\.|(?!\1)[^\\])*\1/,
Expand All @@ -29,6 +20,14 @@ export default {
/\b(?:assert|break|case|class|const|default|else|enum|final|follows|for|grab|if|nest|new|next|noSeeb|return|static|switch|throw|var|void|while)\b/,
'operator': /\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?|:/,
'variable': /\b[a-z_]\w*\b/,
$insert: {
'metadata': {
$before: 'function',
pattern: /<\w+>/,
greedy: true,
alias: 'symbol',
},
},
};
},
};
74 changes: 35 additions & 39 deletions src/languages/bison.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,49 @@
import { insertBefore } from '../util/language-util.js';
import c from './c.js';

/** @type {import('../types.d.ts').LanguageProto<'bison'>} */
export default {
id: 'bison',
base: c,
grammar ({ base }) {
insertBefore(base, 'comment', {
'bison': {
// This should match all the beginning of the file
// including the prologue(s), the bison declarations and
// the grammar rules.
pattern: /^(?:[^%]|%(?!%))*%%[\s\S]*?%%/,
inside: {
'c': {
// Allow for one level of nested braces
pattern: /%\{[\s\S]*?%\}|\{(?:\{[^}]*\}|[^{}])*\}/,
inside: /** @type {Grammar} */ ({
'delimiter': {
pattern: /^%?\{|%?\}$/,
alias: 'punctuation',
},
'bison-variable': {
pattern: /[$@](?:<[^\s>]+>)?[\w$]+/,
alias: 'variable',
inside: {
'punctuation': /<|>/,
return {
$insert: {
'bison': {
$before: 'comment',
// This should match all the beginning of the file
// including the prologue(s), the bison declarations and
// the grammar rules.
pattern: /^(?:[^%]|%(?!%))*%%[\s\S]*?%%/,
inside: {
'c': {
// Allow for one level of nested braces
pattern: /%\{[\s\S]*?%\}|\{(?:\{[^}]*\}|[^{}])*\}/,
inside: {
'delimiter': {
pattern: /^%?\{|%?\}$/,
alias: 'punctuation',
},
'bison-variable': {
pattern: /[$@](?:<[^\s>]+>)?[\w$]+/,
alias: 'variable',
inside: {
'punctuation': /<|>/,
},
},
$rest: 'c',
},
$rest: /** @type {Grammar['$rest']} */ ('c'),
}),
},
'comment': base.comment,
'string': base.string,
'property': /\S+(?=:)/,
'keyword': /%\w+/,
'number': {
pattern: /(^|[^@])\b(?:0x[\da-f]+|\d+)/i,
lookbehind: true,
},
'comment': base.comment,
'string': base.string,
'property': /\S+(?=:)/,
'keyword': /%\w+/,
'number': {
pattern: /(^|[^@])\b(?:0x[\da-f]+|\d+)/i,
lookbehind: true,
},
'punctuation': /%[%?]|[|:;\[\]<>]/,
},
'punctuation': /%[%?]|[|:;\[\]<>]/,
},
},
});

return {};
};
},
};

/**
* @typedef {import('../types.d.ts').Grammar} Grammar
*/
Loading
Loading