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=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`),a=e(`architecture,entity,begin,case,port,else,elsif,end,for,function,if`),o=/[&|~><!\)\(*#%@+\/=?\:;}{,\.\^\-\[\]]/,s;function c(e,t){var c=e.next();if(r[c]){var d=r[c](e,t);if(d!==!1)return d}if(c==`"`)return t.tokenize=u(c),t.tokenize(e,t);if(c==`'`)return t.tokenize=l(c),t.tokenize(e,t);if(/[\[\]{}\(\),;\:\.]/.test(c))return s=c,null;if(/[\d']/.test(c))return e.eatWhile(/[\w\.']/),`number`;if(c==`-`&&e.eat(`-`))return e.skipToEnd(),`comment`;if(o.test(c))return e.eatWhile(o),`operator`;e.eatWhile(/[\w\$_]/);var f=e.current();return i.propertyIsEnumerable(f.toLowerCase())?(a.propertyIsEnumerable(f)&&(s=`newstatement`),`keyword`):n.propertyIsEnumerable(f)?`atom`:`variable`}function l(e){return function(t,n){for(var r=!1,i,a=!1;(i=t.next())!=null;){if(i==e&&!r){a=!0;break}r=!r&&i==`--`}return(a||!r)&&(n.tokenize=c),`string`}}function u(e){return function(t,n){for(var r=!1,i,a=!1;(i=t.next())!=null;){if(i==e&&!r){a=!0;break}r=!r&&i==`--`}return(a||!r)&&(n.tokenize=c),`string.special`}}function d(e,t,n,r,i){this.indented=e,this.column=t,this.type=n,this.align=r,this.prev=i}function f(e,t,n){return e.context=new d(e.indented,t,n,null,e.context)}function p(e){var t=e.context.type;return(t==`)`||t==`]`||t==`}`)&&(e.indented=e.context.indented),e.context=e.context.prev}var m={name:`vhdl`,startState:function(e){return{tokenize:null,context:new d(-e,0,`top`,!1),indented:0,startOfLine:!0}},token:function(e,t){var n=t.context;if(e.sol()&&(n.align??(n.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;s=null;var r=(t.tokenize||c)(e,t);if(r==`comment`||r==`meta`)return r;if(n.align??(n.align=!0),(s==`;`||s==`:`)&&n.type==`statement`)p(t);else if(s==`{`)f(t,e.column(),`}`);else if(s==`[`)f(t,e.column(),`]`);else if(s==`(`)f(t,e.column(),`)`);else if(s==`}`){for(;n.type==`statement`;)n=p(t);for(n.type==`}`&&(n=p(t));n.type==`statement`;)n=p(t)}else s==n.type?p(t):(n.type==`}`||n.type==`top`||n.type==`statement`&&s==`newstatement`)&&f(t,e.column(),`statement`);return t.startOfLine=!1,r},indent:function(e,t,n){if(e.tokenize!=c&&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{m as vhdl};