var s,u=d("abs.acos.aj.aj0.all.and.any.asc.asin.asof.atan.attr.avg.avgs.bin.by.ceiling.cols.cor.cos.count.cov.cross.csv.cut.delete.deltas.desc.dev.differ.distinct.div.do.each.ej.enlist.eval.except.exec.exit.exp.fby.fills.first.fkeys.flip.floor.from.get.getenv.group.gtime.hclose.hcount.hdel.hopen.hsym.iasc.idesc.if.ij.in.insert.inter.inv.key.keys.last.like.list.lj.load.log.lower.lsq.ltime.ltrim.mavg.max.maxs.mcount.md5.mdev.med.meta.min.mins.mmax.mmin.mmu.mod.msum.neg.next.not.null.or.over.parse.peach.pj.plist.prd.prds.prev.prior.rand.rank.ratios.raze.read0.read1.reciprocal.reverse.rload.rotate.rsave.rtrim.save.scan.select.set.setenv.show.signum.sin.sqrt.ss.ssr.string.sublist.sum.sums.sv.system.tables.tan.til.trim.txf.type.uj.ungroup.union.update.upper.upsert.value.var.view.views.vs.wavg.where.where.while.within.wj.wj1.wsum.xasc.xbar.xcol.xcols.xdesc.xexp.xgroup.xkey.xlog.xprev.xrank".split(".")),m=/[|/&^!+:\\\-*%$=~#;@><,?_\'\"\[\(\]\)\s{}]/;function d(t){return RegExp("^("+t.join("|")+")$")}function a(t,e){var i=t.sol(),o=t.next();if(s=null,i){if(o=="/")return(e.tokenize=p)(t,e);if(o=="\\")return t.eol()||/\s/.test(t.peek())?(t.skipToEnd(),/^\\\s*$/.test(t.current())?(e.tokenize=f)(t):e.tokenize=a,"comment"):(e.tokenize=a,"builtin")}if(/\s/.test(o))return t.peek()=="/"?(t.skipToEnd(),"comment"):"null";if(o=='"')return(e.tokenize=v)(t,e);if(o=="`")return t.eatWhile(/[A-Za-z\d_:\/.]/),"macroName";if(o=="."&&/\d/.test(t.peek())||/\d/.test(o)){var n=null;return t.backUp(1),t.match(/^\d{4}\.\d{2}(m|\.\d{2}([DT](\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)?)?)/)||t.match(/^\d+D(\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)/)||t.match(/^\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?/)||t.match(/^\d+[ptuv]{1}/)?n="temporal":(t.match(/^0[NwW]{1}/)||t.match(/^0x[\da-fA-F]*/)||t.match(/^[01]+[b]{1}/)||t.match(/^\d+[chijn]{1}/)||t.match(/-?\d*(\.\d*)?(e[+\-]?\d+)?(e|f)?/))&&(n="number"),n&&(!(o=t.peek())||m.test(o))?n:(t.next(),"error")}return/[A-Za-z]|\./.test(o)?(t.eatWhile(/[A-Za-z._\d]/),u.test(t.current())?"keyword":"variable"):/[|/&^!+:\\\-*%$=~#;@><\.,?_\']/.test(o)||/[{}\(\[\]\)]/.test(o)?null:"error"}function p(t,e){return t.skipToEnd(),/^\/\s*$/.test(t.current())?(e.tokenize=x)(t,e):e.tokenize=a,"comment"}function x(t,e){var i=t.sol()&&t.peek()=="\\";return t.skipToEnd(),i&&/^\\\s*$/.test(t.current())&&(e.tokenize=a),"comment"}function f(t){return t.skipToEnd(),"comment"}function v(t,e){for(var i=!1,o,n=!1;o=t.next();){if(o=='"'&&!i){n=!0;break}i=!i&&o=="\\"}return n&&(e.tokenize=a),"string"}function c(t,e,i){t.context={prev:t.context,indent:t.indent,col:i,type:e}}function r(t){t.indent=t.context.indent,t.context=t.context.prev}const k={name:"q",startState:function(){return{tokenize:a,context:null,indent:0,col:0}},token:function(t,e){t.sol()&&(e.context&&e.context.align==null&&(e.context.align=!1),e.indent=t.indentation());var i=e.tokenize(t,e);if(i!="comment"&&e.context&&e.context.align==null&&e.context.type!="pattern"&&(e.context.align=!0),s=="(")c(e,")",t.column());else if(s=="[")c(e,"]",t.column());else if(s=="{")c(e,"}",t.column());else if(/[\]\}\)]/.test(s)){for(;e.context&&e.context.type=="pattern";)r(e);e.context&&s==e.context.type&&r(e)}else s=="."&&e.context&&e.context.type=="pattern"?r(e):/atom|string|variable/.test(i)&&e.context&&(/[\}\]]/.test(e.context.type)?c(e,"pattern",t.column()):e.context.type=="pattern"&&!e.context.align&&(e.context.align=!0,e.context.col=t.column()));return i},indent:function(t,e,i){var o=e&&e.charAt(0),n=t.context;if(/[\]\}]/.test(o))for(;n&&n.type=="pattern";)n=n.prev;var l=n&&o==n.type;return n?n.type=="pattern"?n.col:n.align?n.col+(l?0:1):n.indent+(l?0:i.unit):0},languageData:{commentTokens:{line:"/"}}};export{k as t};
