Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions components/prism-vhdl.js
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion components/prism-vhdl.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions tests/languages/vhdl/attribute_feature.test
@@ -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.
13 changes: 0 additions & 13 deletions tests/languages/vhdl/constant_feature.test

This file was deleted.

72 changes: 9 additions & 63 deletions tests/languages/vhdl/keyword_feature.test
@@ -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
Expand Down Expand Up @@ -67,6 +36,7 @@ inertial
inout
is
label
library
linkage
literal
loop
Expand All @@ -82,6 +52,7 @@ out
package
port
postponed
private
procedure
process
pure
Expand All @@ -103,7 +74,9 @@ type
unaffected
units
until
use
variable
view
wait
when
while
Expand All @@ -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"],
Expand Down Expand Up @@ -181,6 +123,7 @@ with
["keyword", "inout"],
["keyword", "is"],
["keyword", "label"],
["keyword", "library"],
["keyword", "linkage"],
["keyword", "literal"],
["keyword", "loop"],
Expand All @@ -196,6 +139,7 @@ with
["keyword", "package"],
["keyword", "port"],
["keyword", "postponed"],
["keyword", "private"],
["keyword", "procedure"],
["keyword", "process"],
["keyword", "pure"],
Expand All @@ -217,7 +161,9 @@ with
["keyword", "unaffected"],
["keyword", "units"],
["keyword", "until"],
["keyword", "use"],
["keyword", "variable"],
["keyword", "view"],
["keyword", "wait"],
["keyword", "when"],
["keyword", "while"],
Expand All @@ -226,4 +172,4 @@ with

----------------------------------------------------

Checks for all keywords.
Checks for all keywords.