parser

package
v0.0.0-...-daa2006 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

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

Lexer tokenizes the source code.

func NewLexer

func NewLexer(input string) *Lexer

NewLexer creates a new Lexer instance.

func (*Lexer) NextToken

func (l *Lexer) NextToken() Token

NextToken returns the next token from the input.

type Parser

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

Parser parses tokens into an AST.

func NewParser

func NewParser(l *Lexer) *Parser

NewParser creates a new Parser instance.

func (*Parser) ParseFile

func (p *Parser) ParseFile() (*ast.File, error)

ParseFile parses the entire input into a File AST node.

type Token

type Token struct {
	Type    TokenType
	Literal string
	Line    int
	Column  int
}

Token represents a single token in the DSL.

type TokenType

type TokenType string

TokenType defines the type of a token.

const (
	IDENT       TokenType = "IDENT"
	STRING      TokenType = "STRING"
	LBRACE      TokenType = "LBRACE"
	RBRACE      TokenType = "RBRACE"
	COLON       TokenType = "COLON"
	AT          TokenType = "AT"
	LPAREN      TokenType = "LPAREN"
	RPAREN      TokenType = "RPAREN"
	HTTP_METHOD TokenType = "HTTP_METHOD"
	PATH        TokenType = "PATH"
	EOF         TokenType = "EOF"
	ILLEGAL     TokenType = "ILLEGAL"
)

Jump to

Keyboard shortcuts

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