Blame view

assets/plugins/google-code-prettify/lang-vhdl.js 2.18 KB
cf76164e6   Ting Chan   20190709
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  /**
   * @fileoverview
   * Registers a language handler for VHDL '93.
   *
   * Based on the lexical grammar and keywords at
   * http://www.iis.ee.ethz.ch/~zimmi/download/vhdl93_syntax.html
   *
   * @author benoit@ryder.fr
   */
  
  PR['registerLangHandler'](
      PR['createSimpleLexer'](
          [
           // Whitespace
           [PR['PR_PLAIN'], /^[\t
  \r \xA0]+/, null, '\t
  \r \xA0']
          ],
          [
           // String, character or bit string
           [PR['PR_STRING'], /^(?:[BOX]?"(?:[^\"]|"")*"|'.')/i],
           // Comment, from two dashes until end of line.
           [PR['PR_COMMENT'], /^--[^\r
  ]*/],
           [PR['PR_KEYWORD'], /^(?:abs|access|after|alias|all|and|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|mod|nand|new|next|nor|not|null|of|on|open|or|others|out|package|port|postponed|procedure|process|pure|range|record|register|reject|rem|report|return|rol|ror|select|severity|shared|signal|sla|sll|sra|srl|subtype|then|to|transport|type|unaffected|units|until|use|variable|wait|when|while|with|xnor|xor)(?=[^\w-]|$)/i, null],
           // Type, predefined or standard
           [PR['PR_TYPE'], /^(?:bit|bit_vector|character|boolean|integer|real|time|string|severity_level|positive|natural|signed|unsigned|line|text|std_u?logic(?:_vector)?)(?=[^\w-]|$)/i, null],
           // Predefined attributes
           [PR['PR_TYPE'], /^\'(?: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)(?=[^\w-]|$)/i, null],
           // Number, decimal or based literal
           [PR['PR_LITERAL'], /^\d+(?:_\d+)*(?:#[\w\\.]+#(?:[+\-]?\d+(?:_\d+)*)?|(?:\.\d+(?:_\d+)*)?(?:E[+\-]?\d+(?:_\d+)*)?)/i],
           // Identifier, basic or extended
           [PR['PR_PLAIN'], /^(?:[a-z]\w*|\\[^\\]*\\)/i],
           // Punctuation
           [PR['PR_PUNCTUATION'], /^[^\w\t
  \r \xA0\"\'][^\w\t
  \r \xA0\-\"\']*/]
          ]),
      ['vhdl', 'vhd']);