Files
ijmuv-blog-release/frontend/assets/vhdl-COU4B5q5.js
2026-05-08 13:39:01 +08:00

1 line
3.2 KiB
JavaScript

function e(e){for(var t={},n=e.split(`,`),r=0;r<n.length;++r){var i=n[r].toUpperCase(),a=n[r].charAt(0).toUpperCase()+n[r].slice(1);t[n[r]]=!0,t[i]=!0,t[a]=!0}return t}function t(e){return e.eatWhile(/[\w\$_]/),`meta`}var n=e(`null`),r={"`":t,$:t},i=!1,a=e(`abs,access,after,alias,all,and,architecture,array,assert,attribute,begin,block,body,buffer,bus,case,component,configuration,constant,disconnect,downto,else,elsif,end,end block,end case,end component,end for,end generate,end if,end loop,end process,end record,end units,entity,exit,file,for,function,generate,generic,generic map,group,guarded,if,impure,in,inertial,inout,is,label,library,linkage,literal,loop,map,mod,nand,new,next,nor,null,of,on,open,or,others,out,package,package body,port,port map,postponed,procedure,process,pure,range,record,register,reject,rem,report,return,rol,ror,select,severity,signal,sla,sll,sra,srl,subtype,then,to,transport,type,unaffected,units,until,use,variable,wait,when,while,with,xnor,xor`),o=e(`architecture,entity,begin,case,port,else,elsif,end,for,function,if`),s=/[&|~><!\)\(*#%@+\/=?\:;}{,\.\^\-\[\]]/,c;function l(e,t){var i=e.next();if(r[i]){var l=r[i](e,t);if(l!==!1)return l}if(i==`"`)return t.tokenize=d(i),t.tokenize(e,t);if(i==`'`)return t.tokenize=u(i),t.tokenize(e,t);if(/[\[\]{}\(\),;\:\.]/.test(i))return c=i,null;if(/[\d']/.test(i))return e.eatWhile(/[\w\.']/),`number`;if(i==`-`&&e.eat(`-`))return e.skipToEnd(),`comment`;if(s.test(i))return e.eatWhile(s),`operator`;e.eatWhile(/[\w\$_]/);var f=e.current();return a.propertyIsEnumerable(f.toLowerCase())?(o.propertyIsEnumerable(f)&&(c=`newstatement`),`keyword`):n.propertyIsEnumerable(f)?`atom`:`variable`}function u(e){return function(t,n){for(var r=!1,a,o=!1;(a=t.next())!=null;){if(a==e&&!r){o=!0;break}r=!r&&a==`--`}return(o||!(r||i))&&(n.tokenize=l),`string`}}function d(e){return function(t,n){for(var r=!1,a,o=!1;(a=t.next())!=null;){if(a==e&&!r){o=!0;break}r=!r&&a==`--`}return(o||!(r||i))&&(n.tokenize=l),`string.special`}}function f(e,t,n,r,i){this.indented=e,this.column=t,this.type=n,this.align=r,this.prev=i}function p(e,t,n){return e.context=new f(e.indented,t,n,null,e.context)}function m(e){var t=e.context.type;return(t==`)`||t==`]`||t==`}`)&&(e.indented=e.context.indented),e.context=e.context.prev}var h={name:`vhdl`,startState:function(e){return{tokenize:null,context:new f(-e,0,`top`,!1),indented:0,startOfLine:!0}},token:function(e,t){var n=t.context;if(e.sol()&&(n.align??=!1,t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;c=null;var r=(t.tokenize||l)(e,t);if(r==`comment`||r==`meta`)return r;if(n.align??=!0,(c==`;`||c==`:`)&&n.type==`statement`)m(t);else if(c==`{`)p(t,e.column(),`}`);else if(c==`[`)p(t,e.column(),`]`);else if(c==`(`)p(t,e.column(),`)`);else if(c==`}`){for(;n.type==`statement`;)n=m(t);for(n.type==`}`&&(n=m(t));n.type==`statement`;)n=m(t)}else c==n.type?m(t):(n.type==`}`||n.type==`top`||n.type==`statement`&&c==`newstatement`)&&p(t,e.column(),`statement`);return t.startOfLine=!1,r},indent:function(e,t,n){if(e.tokenize!=l&&e.tokenize!=null)return 0;var r=t&&t.charAt(0),i=e.context,a=r==i.type;return i.type==`statement`?i.indented+(r==`{`?0:n.unit):i.align?i.column+ +!a:i.indented+(a?0:n.unit)},languageData:{indentOnInput:/^\s*[{}]$/,commentTokens:{line:`--`}}};export{h as vhdl};