function a(t){return RegExp("^(("+t.join(")|(")+"))\\b")}var i=["Clamp","Constructor","EnforceRange","Exposed","ImplicitThis","Global","PrimaryGlobal","LegacyArrayClass","LegacyUnenumerableNamedProperties","LenientThis","NamedConstructor","NewObject","NoInterfaceObject","OverrideBuiltins","PutForwards","Replaceable","SameObject","TreatNonObjectAsNull","TreatNullAs","EmptyString","Unforgeable","Unscopeable"],s=a(i),o="unsigned.short.long.unrestricted.float.double.boolean.byte.octet.Promise.ArrayBuffer.DataView.Int8Array.Int16Array.Int32Array.Uint8Array.Uint16Array.Uint32Array.Uint8ClampedArray.Float32Array.Float64Array.ByteString.DOMString.USVString.sequence.object.RegExp.Error.DOMException.FrozenArray.any.void".split("."),u=a(o),c=["attribute","callback","const","deleter","dictionary","enum","getter","implements","inherit","interface","iterable","legacycaller","maplike","partial","required","serializer","setlike","setter","static","stringifier","typedef","optional","readonly","or"],f=a(c),l=["true","false","Infinity","NaN","null"],d=a(l),y=a(["callback","dictionary","enum","interface"]),p=a(["typedef"]),b=/^[:<=>?]/,h=/^-?([1-9][0-9]*|0[Xx][0-9A-Fa-f]+|0[0-7]*)/,g=/^-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)/,m=/^_?[A-Za-z][0-9A-Z_a-z-]*/,A=/^_?[A-Za-z][0-9A-Z_a-z-]*(?=\s*;)/,D=/^"[^"]*"/,k=/^\/\*.*?\*\//,E=/^\/\*.*/,C=/^.*?\*\//;function N(t,e){if(t.eatSpace())return null;if(e.inComment)return t.match(C)?(e.inComment=!1,"comment"):(t.skipToEnd(),"comment");if(t.match("//"))return t.skipToEnd(),"comment";if(t.match(k))return"comment";if(t.match(E))return e.inComment=!0,"comment";if(t.match(/^-?[0-9\.]/,!1)&&(t.match(h)||t.match(g)))return"number";if(t.match(D))return"string";if(e.startDef&&t.match(m))return"def";if(e.endDef&&t.match(A))return e.endDef=!1,"def";if(t.match(f))return"keyword";if(t.match(u)){var r=e.lastToken,n=(t.match(/^\s*(.+?)\b/,!1)||[])[1];return r===":"||r==="implements"||n==="implements"||n==="="?"builtin":"type"}return t.match(s)?"builtin":t.match(d)?"atom":t.match(m)?"variable":t.match(b)?"operator":(t.next(),null)}const T={name:"webidl",startState:function(){return{inComment:!1,lastToken:"",startDef:!1,endDef:!1}},token:function(t,e){var r=N(t,e);if(r){var n=t.current();e.lastToken=n,r==="keyword"?(e.startDef=y.test(n),e.endDef=e.endDef||p.test(n)):e.startDef=!1}return r},languageData:{autocomplete:i.concat(o).concat(c).concat(l)}};export{T as t};
