UNPKG

826 BJavaScriptView Raw
1Prism.languages.awk = {
2 'hashbang': {
3 pattern: /^#!.*/,
4 greedy: true,
5 alias: 'comment'
6 },
7 'comment': {
8 pattern: /#.*/,
9 greedy: true
10 },
11 'string': {
12 pattern: /(^|[^\\])"(?:[^\\"\r\n]|\\.)*"/,
13 lookbehind: true,
14 greedy: true
15 },
16 'regex': {
17 pattern: /((?:^|[^\w\s)])\s*)\/(?:[^\/\\\r\n]|\\.)*\//,
18 lookbehind: true,
19 greedy: true
20 },
21
22 'variable': /\$\w+/,
23 'keyword': /\b(?:BEGIN|BEGINFILE|END|ENDFILE|break|case|continue|default|delete|do|else|exit|for|function|getline|if|in|next|nextfile|printf?|return|switch|while)\b|@(?:include|load)\b/,
24
25 'function': /\b[a-z_]\w*(?=\s*\()/i,
26 'number': /\b(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?|0x[a-fA-F0-9]+)\b/,
27
28 'operator': /--|\+\+|!?~|>&|>>|<<|(?:\*\*|[<>!=+\-*/%^])=?|&&|\|[|&]|[?:]/,
29 'punctuation': /[()[\]{},;]/
30};
31
32Prism.languages.gawk = Prism.languages.awk;