ipx

package module
v0.0.0-...-2a68138 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: MIT Imports: 5 Imported by: 0

README

Instalation

go get github.com/CakeBaker1/ipx/libs/go@latest

Usage

import (
  ipx "github.com/CakeBaker1/ipx/libs/go"
)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValid

func IsValid(input string) (bool, error)

func MarshalExprToJSON

func MarshalExprToJSON(expr *Expr) (string, error)

Types

type Expr

type Expr struct {
	Type   ExprType `json:"type"`
	Left   *Expr    `json:"left,omitempty"`
	Right  *Expr    `json:"right,omitempty"`
	Key    string   `json:"key,omitempty"`
	Op     string   `json:"op,omitempty"`
	Value  string   `json:"value,omitempty"`
	Values []string `json:"values,omitempty"`
}

func Parse

func Parse(input string) (*Expr, error)

type ExprType

type ExprType int
const (
	EXPR_MATCH ExprType = iota
	EXPR_AND
	EXPR_OR
	EXPR_NOT
)

func (ExprType) MarshalJSON

func (t ExprType) MarshalJSON() ([]byte, error)

type Lexer

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

func NewLexer

func NewLexer(input string) *Lexer

func (*Lexer) NextToken

func (l *Lexer) NextToken() (Token, error)

type Parser

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

func NewParser

func NewParser(input string) *Parser

func (*Parser) Parse

func (p *Parser) Parse() (*Expr, error)

type Token

type Token struct {
	Type  TokenType
	Value string
	Start int
	End   int
}

type TokenType

type TokenType int
const (
	TOKEN_EOF TokenType = iota
	TOKEN_IDENT
	TOKEN_STRING
	TOKEN_AND
	TOKEN_OR
	TOKEN_NOT
	TOKEN_COLON
	TOKEN_ASSIGN
	TOKEN_LPAREN
	TOKEN_RPAREN
	TOKEN_LBRACKET
	TOKEN_RBRACKET
	TOKEN_COMMA
)

Jump to

Keyboard shortcuts

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