diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:10:37 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:11:17 +0200 |
commit | 7a3df06eb573d36142bd1a8e03c5ce8752d300b3 (patch) | |
tree | 70bfaea8884c374876f607774850a3a51c0cb381 /node_modules/highlight.js/lib/languages/abnf.js | |
parent | aca1143cb9eed16cf37f04e475e4257418dd18ac (diff) |
fix build issues and add typedoc
Diffstat (limited to 'node_modules/highlight.js/lib/languages/abnf.js')
-rw-r--r-- | node_modules/highlight.js/lib/languages/abnf.js | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/node_modules/highlight.js/lib/languages/abnf.js b/node_modules/highlight.js/lib/languages/abnf.js new file mode 100644 index 000000000..9c5f7b7a6 --- /dev/null +++ b/node_modules/highlight.js/lib/languages/abnf.js @@ -0,0 +1,70 @@ +module.exports = function(hljs) { + var regexes = { + ruleDeclaration: "^[a-zA-Z][a-zA-Z0-9-]*", + unexpectedChars: "[!@#$^&',?+~`|:]" + }; + + var keywords = [ + "ALPHA", + "BIT", + "CHAR", + "CR", + "CRLF", + "CTL", + "DIGIT", + "DQUOTE", + "HEXDIG", + "HTAB", + "LF", + "LWSP", + "OCTET", + "SP", + "VCHAR", + "WSP" + ]; + + var commentMode = hljs.COMMENT(";", "$"); + + var terminalBinaryMode = { + className: "symbol", + begin: /%b[0-1]+(-[0-1]+|(\.[0-1]+)+){0,1}/ + }; + + var terminalDecimalMode = { + className: "symbol", + begin: /%d[0-9]+(-[0-9]+|(\.[0-9]+)+){0,1}/ + }; + + var terminalHexadecimalMode = { + className: "symbol", + begin: /%x[0-9A-F]+(-[0-9A-F]+|(\.[0-9A-F]+)+){0,1}/, + }; + + var caseSensitivityIndicatorMode = { + className: "symbol", + begin: /%[si]/ + }; + + var ruleDeclarationMode = { + begin: regexes.ruleDeclaration + '\\s*=', + returnBegin: true, + end: /=/, + relevance: 0, + contains: [{className: "attribute", begin: regexes.ruleDeclaration}] + }; + + return { + illegal: regexes.unexpectedChars, + keywords: keywords.join(" "), + contains: [ + ruleDeclarationMode, + commentMode, + terminalBinaryMode, + terminalDecimalMode, + terminalHexadecimalMode, + caseSensitivityIndicatorMode, + hljs.QUOTE_STRING_MODE, + hljs.NUMBER_MODE + ] + }; +};
\ No newline at end of file |