source: node_modules/highlight.js/lib/languages/dos.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2Language: Batch file (DOS)
3Author: Alexander Makarov <sam@rmcreative.ru>
4Contributors: Anton Kochkov <anton.kochkov@gmail.com>
5Website: https://en.wikipedia.org/wiki/Batch_file
6*/
7
8/** @type LanguageFn */
9function dos(hljs) {
10 const COMMENT = hljs.COMMENT(
11 /^\s*@?rem\b/, /$/,
12 {
13 relevance: 10
14 }
15 );
16 const LABEL = {
17 className: 'symbol',
18 begin: '^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)',
19 relevance: 0
20 };
21 return {
22 name: 'Batch file (DOS)',
23 aliases: [
24 'bat',
25 'cmd'
26 ],
27 case_insensitive: true,
28 illegal: /\/\*/,
29 keywords: {
30 keyword:
31 'if else goto for in do call exit not exist errorlevel defined ' +
32 'equ neq lss leq gtr geq',
33 built_in:
34 'prn nul lpt3 lpt2 lpt1 con com4 com3 com2 com1 aux ' +
35 'shift cd dir echo setlocal endlocal set pause copy ' +
36 'append assoc at attrib break cacls cd chcp chdir chkdsk chkntfs cls cmd color ' +
37 'comp compact convert date dir diskcomp diskcopy doskey erase fs ' +
38 'find findstr format ftype graftabl help keyb label md mkdir mode more move path ' +
39 'pause print popd pushd promt rd recover rem rename replace restore rmdir shift ' +
40 'sort start subst time title tree type ver verify vol ' +
41 // winutils
42 'ping net ipconfig taskkill xcopy ren del'
43 },
44 contains: [
45 {
46 className: 'variable',
47 begin: /%%[^ ]|%[^ ]+?%|![^ ]+?!/
48 },
49 {
50 className: 'function',
51 begin: LABEL.begin,
52 end: 'goto:eof',
53 contains: [
54 hljs.inherit(hljs.TITLE_MODE, {
55 begin: '([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*'
56 }),
57 COMMENT
58 ]
59 },
60 {
61 className: 'number',
62 begin: '\\b\\d+',
63 relevance: 0
64 },
65 COMMENT
66 ]
67 };
68}
69
70module.exports = dos;
Note: See TracBrowser for help on using the repository browser.