diff --git a/src/languages/dos.js b/src/languages/dos.js index fe14cae6a4..aae5220cae 100644 --- a/src/languages/dos.js +++ b/src/languages/dos.js @@ -12,11 +12,30 @@ export default function(hljs) { /^\s*@?rem\b/, /$/, { relevance: 10 } ); + + // for matching comments starting with :: + const COMMENT_2 = hljs.COMMENT( + /^::.*$/, /$/, + { relevance: 10 } + ); const LABEL = { className: 'symbol', - begin: '^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)', + begin: '^:[A-Za-z._?][A-Za-z0-9_$#@~.?]*', + relevance: 0 + }; + + const DISK_CHANGE = { + className: 'symbol', + begin: '^[A-Za-z]:\\?$', + relevance: 0 + }; + + const OUTPUT_REDIRECT = { + className: 'symbol', + begin: '[1-2]?[>]>{1}\s*[^&\s]+', relevance: 0 }; + const KEYWORDS = [ "if", "else", @@ -141,6 +160,8 @@ export default function(hljs) { built_in: BUILT_INS }, contains: [ + COMMENT, + COMMENT_2, { className: 'variable', begin: /%%[^ ]|%[^ ]+?%|![^ ]+?!/ @@ -148,18 +169,30 @@ export default function(hljs) { { className: 'function', begin: LABEL.begin, - end: 'goto:eof', + end: /\n/, contains: [ hljs.inherit(hljs.TITLE_MODE, { begin: '([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*' }), - COMMENT + COMMENT, + COMMENT_2 ] }, + { + className: 'function', + begin: DISK_CHANGE.begin, + end: /\n/, + contains: [ hljs.inherit(hljs.TITLE_MODE, { begin: '([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*' }) ] + }, + { + className: 'function', + begin: OUTPUT_REDIRECT.begin, + end: /\n/, + contains: [ hljs.inherit(hljs.TITLE_MODE, { begin: '([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*' }) ] + }, { className: 'number', begin: '\\b\\d+', relevance: 0 }, - COMMENT ] }; }