var e=function(e){return RegExp(`^(?:`+e.join(`|`)+`)$`,`i`)},t=function(e){i=null;var t=e.next();if(t===`"`)return e.match(/^.*?"/),`string`;if(t===`'`)return e.match(/^.*?'/),`string`;if(/[{}\(\),\.;\[\]]/.test(t))return i=t,`punctuation`;if(t===`/`&&e.eat(`/`))return e.skipToEnd(),`comment`;if(l.test(t))return e.eatWhile(l),null;if(e.eatWhile(/[_\w\d]/),e.eat(`:`))return e.eatWhile(/[\w\d_\-]/),`atom`;var n=e.current();return a.test(n)?`builtin`:o.test(n)?`def`:s.test(n)||c.test(n)?`keyword`:`variable`},n=function(e,t,n){return e.context={prev:e.context,indent:e.indent,col:n,type:t}},r=function(e){return e.indent=e.context.indent,e.context=e.context.prev},i,a=e(`abs.acos.allShortestPaths.asin.atan.atan2.avg.ceil.coalesce.collect.cos.cot.count.degrees.e.endnode.exp.extract.filter.floor.haversin.head.id.keys.labels.last.left.length.log.log10.lower.ltrim.max.min.node.nodes.percentileCont.percentileDisc.pi.radians.rand.range.reduce.rel.relationship.relationships.replace.reverse.right.round.rtrim.shortestPath.sign.sin.size.split.sqrt.startnode.stdev.stdevp.str.substring.sum.tail.tan.timestamp.toFloat.toInt.toString.trim.type.upper`.split(`.`)),o=e([`all`,`and`,`any`,`contains`,`exists`,`has`,`in`,`none`,`not`,`or`,`single`,`xor`]),s=e(`as.asc.ascending.assert.by.case.commit.constraint.create.csv.cypher.delete.desc.descending.detach.distinct.drop.else.end.ends.explain.false.fieldterminator.foreach.from.headers.in.index.is.join.limit.load.match.merge.null.on.optional.order.periodic.profile.remove.return.scan.set.skip.start.starts.then.true.union.unique.unwind.using.when.where.with.call.yield`.split(`.`)),c=e(`access.active.assign.all.alter.as.catalog.change.copy.create.constraint.constraints.current.database.databases.dbms.default.deny.drop.element.elements.exists.from.grant.graph.graphs.if.index.indexes.label.labels.management.match.name.names.new.node.nodes.not.of.on.or.password.populated.privileges.property.read.relationship.relationships.remove.replace.required.revoke.role.roles.set.show.start.status.stop.suspended.to.traverse.type.types.user.users.with.write`.split(`.`)),l=/[*+\-<>=&|~%^]/,u={name:`cypher`,startState:function(){return{tokenize:t,context:null,indent:0,col:0}},token:function(e,t){if(e.sol()&&(t.context&&t.context.align==null&&(t.context.align=!1),t.indent=e.indentation()),e.eatSpace())return null;var a=t.tokenize(e,t);if(a!==`comment`&&t.context&&t.context.align==null&&t.context.type!==`pattern`&&(t.context.align=!0),i===`(`)n(t,`)`,e.column());else if(i===`[`)n(t,`]`,e.column());else if(i===`{`)n(t,`}`,e.column());else if(/[\]\}\)]/.test(i)){for(;t.context&&t.context.type===`pattern`;)r(t);t.context&&i===t.context.type&&r(t)}else i===`.`&&t.context&&t.context.type===`pattern`?r(t):/atom|string|variable/.test(a)&&t.context&&(/[\}\]]/.test(t.context.type)?n(t,`pattern`,e.column()):t.context.type===`pattern`&&!t.context.align&&(t.context.align=!0,t.context.col=e.column()));return a},indent:function(e,t,n){var r=t&&t.charAt(0),i=e.context;if(/[\]\}]/.test(r))for(;i&&i.type===`pattern`;)i=i.prev;var a=i&&r===i.type;return i?i.type===`keywords`?null:i.align?i.col+(a?0:1):i.indent+(a?0:n.unit):0}};export{u as cypher};