aboutsummaryrefslogtreecommitdiffstats
path: root/public/prism/prism-vhdl.min.js
blob: 8adb6a31ddd6fae3dc54fdd26b826f6e74e435ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Prism.languages.vhdl = {
  comment: /--.+/,
  'vhdl-vectors': {
    pattern: /\b[oxb]"[\da-f_]+"|"[01uxzwlh-]+"/i,
    alias: 'number',
  },
  'quoted-function': { pattern: /"\S+?"(?=\()/, alias: 'function' },
  string: /"(?:[^\\"\r\n]|\\(?:\r\n|[\s\S]))*"/,
  constant: /\b(?:library|use)\b/i,
  keyword:
    /\b(?:'active|'ascending|'base|'delayed|'driving|'driving_value|'event|'high|'image|'instance_name|'last_active|'last_event|'last_value|'left|'leftof|'length|'low|'path_name|'pos|'pred|'quiet|'range|'reverse_range|'right|'rightof|'simple_name|'stable|'succ|'transaction|'val|'value|access|after|alias|all|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|new|next|null|of|on|open|others|out|package|port|postponed|procedure|process|pure|range|record|register|reject|report|return|select|severity|shared|signal|subtype|then|to|transport|type|unaffected|units|until|use|variable|wait|when|while|with)\b/i,
  boolean: /\b(?:false|true)\b/i,
  function: /\w+(?=\()/,
  number: /'[01uxzwlh-]'|\b(?:\d+#[\da-f_.]+#|\d[\d_.]*)(?:e[-+]?\d+)?/i,
  operator:
    /[<>]=?|:=|[-+*/&=]|\b(?:abs|and|mod|nand|nor|not|or|rem|rol|ror|sla|sll|sra|srl|xnor|xor)\b/i,
  punctuation: /[{}[\];(),.:]/,
};
x? // The main loop is approximately the same as /(?:\s*(?:[*,]|->)\s*<TERMINAL>)*/ which is, obviously, a lot // simpler. The difference is that if a comma is the last iteration of the loop, then the terminal must be // followed by a long identifier. pattern: RegExp( /((?:^|[^:]):\s*)<TERMINAL>(?:\s*(?:(?:\*|->)\s*<TERMINAL>|,\s*<TERMINAL>(?:(?=<NOT-LAST>)|(?!<NOT-LAST>)\s+<LONG-ID>)))*/.source .replace(/<NOT-LAST>/g, function () { return /\s*(?:[*,]|->)/.source; }) .replace(/<TERMINAL>/g, function () { return /(?:'[\w']*|<LONG-ID>|\((?:[^()]|\([^()]*\))*\)|\{(?:[^{}]|\{[^{}]*\})*\})(?:\s+<LONG-ID>)*/ .source; }) .replace(/<LONG-ID>/g, function () { return /(?!<KEYWORD>)[a-z\d_][\w'.]*/.source; }) .replace(/<KEYWORD>/g, function () { return keywords.source; }), 'i' ), lookbehind: true, greedy: true, inside: null, // see below }, { pattern: /((?:^|[^\w'])(?:datatype|exception|functor|signature|structure|type)\s+)[a-z_][\w'.]*/i, lookbehind: true, }, ], function: { pattern: /((?:^|[^\w'])fun\s+)[a-z_][\w'.]*/i, lookbehind: true, }, keyword: keywords, variable: { pattern: /(^|[^\w'])'[\w']*/, lookbehind: true, }, number: /~?\b(?:\d+(?:\.\d+)?(?:e~?\d+)?|0x[\da-f]+)\b/i, word: { pattern: /\b0w(?:\d+|x[\da-f]+)\b/i, alias: 'constant', }, boolean: /\b(?:false|true)\b/i, operator: /\.\.\.|:[>=:]|=>?|->|[<>]=?|[!+\-*/^#|@~]/, punctuation: /[(){}\[\].:,;]/, }; Prism.languages.sml['class-name'][0].inside = Prism.languages.sml; Prism.languages.smlnj = Prism.languages.sml; })(Prism);