mirror of
https://github.com/sharkdp/bat.git
synced 2025-08-17 11:32:54 +02:00
Merge pull request #3337 from JerryImMouse/syntax-vhdl
Add syntax highlighting for VHDL language
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -275,3 +275,6 @@
|
||||
[submodule "assets/themes/Catppuccin"]
|
||||
path = assets/themes/Catppuccin
|
||||
url = https://github.com/SchweGELBin/catppuccin-bat-sub.git
|
||||
[submodule "assets/syntaxes/02_Extra/SmartVHDL"]
|
||||
path = assets/syntaxes/02_Extra/SmartVHDL
|
||||
url = https://github.com/TheClams/SmartVHDL
|
||||
|
@ -38,6 +38,7 @@
|
||||
- Update quadlet syntax mapping rules to cover quadlets in subdirectories #3299 (@cyqsimon)
|
||||
- Add syntax Typst #3300 (@cskeeters)
|
||||
- Map `.mill` files to Scala syntax for Mill build tool configuration files #3311 (@krikera)
|
||||
- Add syntax highlighting for VHDL, see #3337 (@JerryImMouse)
|
||||
- Add syntax mapping for certbot certificate configuration #3338 (@cyqsimon)
|
||||
|
||||
## Themes
|
||||
|
1
assets/syntaxes/02_Extra/SmartVHDL
vendored
Submodule
1
assets/syntaxes/02_Extra/SmartVHDL
vendored
Submodule
Submodule assets/syntaxes/02_Extra/SmartVHDL added at b45507ddc8
74
tests/syntax-tests/highlighted/VHDL/test.vhdl
vendored
Normal file
74
tests/syntax-tests/highlighted/VHDL/test.vhdl
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
[38;2;117;113;94m--[0m[38;2;117;113;94m This is a single-line comment[0m
|
||||
|
||||
[38;2;249;38;114mlibrary[0m[38;2;248;248;242m [0m[38;2;248;248;242mIEEE[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;248;248;242mIEEE[0m[38;2;248;248;242m.[0m[38;2;248;248;242mSTD_LOGIC_1164[0m[38;2;248;248;242m.[0m[38;2;249;38;114mALL[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;248;248;242mIEEE[0m[38;2;248;248;242m.[0m[38;2;248;248;242mNUMERIC_STD[0m[38;2;248;248;242m.[0m[38;2;249;38;114mALL[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mentity[0m[38;2;248;248;242m [0m[38;2;166;226;46mSyntaxTest[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mgeneric[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mDATA_WIDTH [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239minteger[0m[38;2;248;248;242m [0m[38;2;249;38;114m:=[0m[38;2;248;248;242m [0m[38;2;190;132;255m8[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mport[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mclk [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mrst [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242ma[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;248;248;242mb [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic_vector[0m[38;2;248;248;242m([0m[38;2;248;248;242mDATA_WIDTH [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;249;38;114mdownto[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242msel [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mresult [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;249;38;114mout[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic_vector[0m[38;2;248;248;242m([0m[38;2;248;248;242mDATA_WIDTH [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;249;38;114mdownto[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mflag [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;249;38;114mout[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mSyntaxTest[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114marchitecture[0m[38;2;248;248;242m [0m[38;2;166;226;46mBehavioral[0m[38;2;248;248;242m [0m[38;2;249;38;114mof[0m[38;2;248;248;242m [0m[38;2;166;226;46mSyntaxTest[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114msignal[0m[38;2;248;248;242m tmp [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic_vector[0m[38;2;248;248;242m([0m[38;2;248;248;242mDATA_WIDTH [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;249;38;114mdownto[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114msignal[0m[38;2;248;248;242m done [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstd_logic[0m[38;2;248;248;242m [0m[38;2;249;38;114m:=[0m[38;2;248;248;242m [0m[38;2;190;132;255m'0'[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m [0m[38;2;166;226;46mstate_type[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242mIDLE[0m[38;2;248;248;242m,[0m[38;2;248;248;242m LOAD[0m[38;2;248;248;242m,[0m[38;2;248;248;242m EXECUTE[0m[38;2;248;248;242m,[0m[38;2;248;248;242m DONE[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114msignal[0m[38;2;248;248;242m state [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mstate_type[0m[38;2;248;248;242m [0m[38;2;249;38;114m:=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mIDLE[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mbegin[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mprocess[0m[38;2;248;248;242m([0m[38;2;248;248;242mclk[0m[38;2;248;248;242m,[0m[38;2;248;248;242m rst[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mvariable[0m[38;2;248;248;242m i [0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239minteger[0m[38;2;248;248;242m [0m[38;2;249;38;114m:=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m rst [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m'1'[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m tmp [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;249;38;114mothers[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;190;132;255m'0'[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m flag [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m [0m[38;2;190;132;255m'0'[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m IDLE[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melsif[0m[38;2;248;248;242m [0m[38;2;102;217;239mrising_edge[0m[38;2;248;248;242m([0m[38;2;248;248;242mclk[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcase[0m[38;2;248;248;242m state [0m[38;2;249;38;114mis[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m IDLE [0m[38;2;249;38;114m=>[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m sel [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m'1'[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m tmp [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m a [0m[38;2;249;38;114mand[0m[38;2;248;248;242m b[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m EXECUTE[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m tmp [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m a [0m[38;2;249;38;114mor[0m[38;2;248;248;242m b[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m LOAD[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m LOAD [0m[38;2;249;38;114m=>[0m
|
||||
[38;2;248;248;242m tmp [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m a [0m[38;2;249;38;114mxor[0m[38;2;248;248;242m b[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m EXECUTE[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m EXECUTE [0m[38;2;249;38;114m=>[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m i [0m[38;2;249;38;114m<[0m[38;2;248;248;242m DATA_WIDTH [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m tmp[0m[38;2;248;248;242m([0m[38;2;248;248;242mi[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m [0m[38;2;249;38;114mnot[0m[38;2;248;248;242m tmp[0m[38;2;248;248;242m([0m[38;2;248;248;242mi[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m i [0m[38;2;249;38;114m:=[0m[38;2;248;248;242m i [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m DONE[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m DONE [0m[38;2;249;38;114m=>[0m
|
||||
[38;2;248;248;242m flag [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m [0m[38;2;190;132;255m'1'[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m IDLE[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m [0m[38;2;249;38;114mothers[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m
|
||||
[38;2;248;248;242m state [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m IDLE[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;249;38;114mcase[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;249;38;114m process[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m result [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m tmp[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mBehavioral[0m[38;2;248;248;242m;[0m
|
74
tests/syntax-tests/source/VHDL/test.vhdl
vendored
Normal file
74
tests/syntax-tests/source/VHDL/test.vhdl
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
-- This is a single-line comment
|
||||
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.NUMERIC_STD.ALL;
|
||||
|
||||
entity SyntaxTest is
|
||||
generic (
|
||||
DATA_WIDTH : integer := 8
|
||||
);
|
||||
port (
|
||||
clk : in std_logic;
|
||||
rst : in std_logic;
|
||||
a, b : in std_logic_vector(DATA_WIDTH - 1 downto 0);
|
||||
sel : in std_logic;
|
||||
result : out std_logic_vector(DATA_WIDTH - 1 downto 0);
|
||||
flag : out std_logic
|
||||
);
|
||||
end SyntaxTest;
|
||||
|
||||
architecture Behavioral of SyntaxTest is
|
||||
|
||||
signal tmp : std_logic_vector(DATA_WIDTH - 1 downto 0);
|
||||
signal done : std_logic := '0';
|
||||
|
||||
type state_type is (IDLE, LOAD, EXECUTE, DONE);
|
||||
signal state : state_type := IDLE;
|
||||
|
||||
begin
|
||||
|
||||
process(clk, rst)
|
||||
variable i : integer := 0;
|
||||
begin
|
||||
if rst = '1' then
|
||||
tmp <= (others => '0');
|
||||
flag <= '0';
|
||||
state <= IDLE;
|
||||
|
||||
elsif rising_edge(clk) then
|
||||
case state is
|
||||
when IDLE =>
|
||||
if sel = '1' then
|
||||
tmp <= a and b;
|
||||
state <= EXECUTE;
|
||||
else
|
||||
tmp <= a or b;
|
||||
state <= LOAD;
|
||||
end if;
|
||||
|
||||
when LOAD =>
|
||||
tmp <= a xor b;
|
||||
state <= EXECUTE;
|
||||
|
||||
when EXECUTE =>
|
||||
if i < DATA_WIDTH then
|
||||
tmp(i) <= not tmp(i);
|
||||
i := i + 1;
|
||||
else
|
||||
state <= DONE;
|
||||
end if;
|
||||
|
||||
when DONE =>
|
||||
flag <= '1';
|
||||
state <= IDLE;
|
||||
|
||||
when others =>
|
||||
state <= IDLE;
|
||||
end case;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
result <= tmp;
|
||||
|
||||
end Behavioral;
|
Reference in New Issue
Block a user