Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(dart) highlight built-in nullable types #2598

Merged
merged 8 commits into from
Jun 11, 2020
Merged
Changes from 1 commit
Commits
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
17 changes: 14 additions & 3 deletions src/languages/dart.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,28 @@ export default function(hljs) {
hljs.C_NUMBER_MODE, STRING
];

var BUILT_IN_TYPES =
joshgoebel marked this conversation as resolved.
Show resolved Hide resolved
// dart:core
'Comparable DateTime Duration Function Iterable Iterator List Map Match Object Pattern RegExp Set Stopwatch ' +
'String StringBuffer StringSink Symbol Type Uri bool double int num ' +
// dart:html
'Element ElementList';

var KEYWORDS = {
keyword: 'abstract as assert async await break case catch class const continue covariant default deferred do ' +
'dynamic else enum export extends extension external factory false final finally for Function get hide if ' +
'implements import in inferface is late library mixin new null on operator part required rethrow return set ' +
'show static super switch sync this throw true try typedef var void while with yield',
built_in:
// non-nullable built-in types
BUILT_IN_TYPES + ' ' +
// nullable built-in types
BUILT_IN_TYPES.split(' ').map((e) => { e + '?' }).join(' ') + ' ' +
joshgoebel marked this conversation as resolved.
Show resolved Hide resolved
// dart:core
'Comparable DateTime Duration Function Iterable Iterator List Map Match Never Null Object Pattern RegExp ' +
'Set Stopwatch String StringBuffer StringSink Symbol Type Uri bool double dynamic int num print ' +
'Never Null dynamic print ' +
// dart:html
'Element ElementList document querySelector querySelectorAll window'
'document querySelector querySelectorAll window',
$pattern: /[A-Za-z][A-Za-z0-9_]+\??/
};

return {
Expand Down