lexer

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package lexer implements a lexical scanner for Cypher.

Cypher introduces several lexical elements absent from SQL-family languages:

  • Backtick-quoted identifiers: `My Identifier`
  • Parameter syntax: $name or the legacy {name} form
  • Relationship arrow tokens: -> and <-
  • Variable-length range syntax inside relationship patterns: [*1..3]
  • The regex-match operator: =~

The lexer is a standard one-character-lookahead scanner built on the same structure as the tsqlparser lexer: a Lexer struct with position/readPosition and a rune-at-a-time readChar/peekChar API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tokenize

func Tokenize(input string) []token.Token

Tokenize returns all tokens produced by scanning input, including EOF.

Types

type Lexer

type Lexer struct {
	// contains filtered or unexported fields
}

Lexer holds the scanning state for a single Cypher input string.

func New

func New(input string) *Lexer

New creates a new Lexer for the given input string and primes the first character.

func (*Lexer) NextToken

func (l *Lexer) NextToken() token.Token

NextToken returns the next token from the input stream.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL