VHDL: Add `private`, `view` keywords; Distinguish `attribute` from `keyword` (#3389)

This commit is contained in:
Wei Ting 2022-03-14 23:48:11 +08:00 committed by GitHub
parent ef0ec02a87
commit d1a5ce30e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 79 deletions

View File

@ -11,9 +11,12 @@ Prism.languages.vhdl = {
alias: 'function'
},
'string': /"(?:[^\\"\r\n]|\\(?:\r\n|[\s\S]))*"/,
'constant': /\b(?:library|use)\b/i,
'attribute': {
pattern: /\b'\w+/,
alias: 'attr-name'
},
// support for predefined attributes included
'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,
'keyword': /\b(?: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|private|procedure|process|pure|range|record|register|reject|report|return|select|severity|shared|signal|subtype|then|to|transport|type|unaffected|units|until|use|variable|view|wait|when|while|with)\b/i,
'boolean': /\b(?:false|true)\b/i,
'function': /\w+(?=\()/,
// decimal, based, physical, and exponential numbers supported

View File

@ -1 +1 @@
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:/[{}[\];(),.:]/};
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]))*"/,attribute:{pattern:/\b'\w+/,alias:"attr-name"},keyword:/\b(?: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|private|procedure|process|pure|range|record|register|reject|report|return|select|severity|shared|signal|subtype|then|to|transport|type|unaffected|units|until|use|variable|view|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:/[{}[\];(),.:]/};

View File

@ -0,0 +1,25 @@
T'BASE
T'IMAGE(X)
A'RANGE
A'RANGE(N)
A'REVERSE_RANGE
A'REVERSE_RANGE(N)
S'DELAYED(t)
E'INSTANCE_NAME
----------------------------------------------------
[
"T", ["attribute", "'BASE"],
"\r\nT", ["attribute", "'IMAGE"], ["punctuation", "("], "X", ["punctuation", ")"],
"\r\nA", ["attribute", "'RANGE"],
"\r\nA", ["attribute", "'RANGE"], ["punctuation", "("], "N", ["punctuation", ")"],
"\r\nA", ["attribute", "'REVERSE_RANGE"],
"\r\nA", ["attribute", "'REVERSE_RANGE"], ["punctuation", "("], "N", ["punctuation", ")"],
"\r\nS", ["attribute", "'DELAYED"], ["punctuation", "("], "t", ["punctuation", ")"],
"\r\nE", ["attribute", "'INSTANCE_NAME"]
]
----------------------------------------------------
Checks for attributes.

View File

@ -1,13 +0,0 @@
use
library
----------------------------------------------------
[
["constant", "use"],
["constant", "library"]
]
----------------------------------------------------
Checks for constants.

View File

@ -1,34 +1,3 @@
A'active
A'ascending
A'base
A'delayed
A'driving
A'driving_value
A'event
A'high
A'image
A'instance_name
A'last_active
A'last_event
A'last_value
A'left
A'leftof
A'length
A'low
A'path_name
A'pos
A'pred
A'quiet
A'range
A'reverse_range
A'right
A'rightof
A'simple_name
A'stable
A'succ
A'transaction
A'val
A'value
access
after
alias
@ -67,6 +36,7 @@ inertial
inout
is
label
library
linkage
literal
loop
@ -82,6 +52,7 @@ out
package
port
postponed
private
procedure
process
pure
@ -103,7 +74,9 @@ type
unaffected
units
until
use
variable
view
wait
when
while
@ -112,37 +85,6 @@ with
----------------------------------------------------
[
"A", ["keyword", "'active"],
"\r\nA", ["keyword", "'ascending"],
"\r\nA", ["keyword", "'base"],
"\r\nA", ["keyword", "'delayed"],
"\r\nA", ["keyword", "'driving"],
"\r\nA", ["keyword", "'driving_value"],
"\r\nA", ["keyword", "'event"],
"\r\nA", ["keyword", "'high"],
"\r\nA", ["keyword", "'image"],
"\r\nA", ["keyword", "'instance_name"],
"\r\nA", ["keyword", "'last_active"],
"\r\nA", ["keyword", "'last_event"],
"\r\nA", ["keyword", "'last_value"],
"\r\nA", ["keyword", "'left"],
"\r\nA", ["keyword", "'leftof"],
"\r\nA", ["keyword", "'length"],
"\r\nA", ["keyword", "'low"],
"\r\nA", ["keyword", "'path_name"],
"\r\nA", ["keyword", "'pos"],
"\r\nA", ["keyword", "'pred"],
"\r\nA", ["keyword", "'quiet"],
"\r\nA", ["keyword", "'range"],
"\r\nA", ["keyword", "'reverse_range"],
"\r\nA", ["keyword", "'right"],
"\r\nA", ["keyword", "'rightof"],
"\r\nA", ["keyword", "'simple_name"],
"\r\nA", ["keyword", "'stable"],
"\r\nA", ["keyword", "'succ"],
"\r\nA", ["keyword", "'transaction"],
"\r\nA", ["keyword", "'val"],
"\r\nA", ["keyword", "'value"],
["keyword", "access"],
["keyword", "after"],
["keyword", "alias"],
@ -181,6 +123,7 @@ with
["keyword", "inout"],
["keyword", "is"],
["keyword", "label"],
["keyword", "library"],
["keyword", "linkage"],
["keyword", "literal"],
["keyword", "loop"],
@ -196,6 +139,7 @@ with
["keyword", "package"],
["keyword", "port"],
["keyword", "postponed"],
["keyword", "private"],
["keyword", "procedure"],
["keyword", "process"],
["keyword", "pure"],
@ -217,7 +161,9 @@ with
["keyword", "unaffected"],
["keyword", "units"],
["keyword", "until"],
["keyword", "use"],
["keyword", "variable"],
["keyword", "view"],
["keyword", "wait"],
["keyword", "when"],
["keyword", "while"],
@ -226,4 +172,4 @@ with
----------------------------------------------------
Checks for all keywords.
Checks for all keywords.