From 006b15b467a5cd835a6eab1b49023100bdc8f2e6 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 13 Oct 2023 19:32:56 +0200 Subject: refactor(components): rewrite Code component and usePrism hook * move Prism styles to Sass placeholders to avoid repeats * let usePrism consumer define its plugins (remove default ones) * remove `plugins` prop from Code component * add new props to Code component to let consumer configure plugins (and handle plugin list from the given options) However there are some problems with Prism plugins: line-highlight and treeview does not seems to be loaded. I don't want to use Babel instead of SWC so I have no solution for now. --- public/prism/prism-vhdl.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'public/prism/prism-vhdl.js') diff --git a/public/prism/prism-vhdl.js b/public/prism/prism-vhdl.js index 3ec6bce..6ede816 100644 --- a/public/prism/prism-vhdl.js +++ b/public/prism/prism-vhdl.js @@ -11,10 +11,13 @@ 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, + /\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 -- cgit v1.2.3