ipxlang

package
v0.0.0-...-e3cb19e Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2022 License: MIT Imports: 8 Imported by: 0

README

IPX language

Created to simplify working with data and the clickhouse database

Grammar


EXPR -> SUB_EXPR | SUB_EXPR 'or' EXPR | SUB_EXPR 'and' EXPR

SUB_EXPR -> '(' EXPR ')' | NOT | ARRAY_OP | COMPARE_OP | ALL

NOT -> '!' EXPR

ARRAY_OP -> IN | ALLIN | NOTIN

IN -> TYPE 'in' ID | TYPE 'in' FUNC

ALLIN -> TYPE 'all:in' ID | TYPE 'all:in' FUNC

NOTIN -> TYPE 'not:in' ID | TYPE 'not:in' FUNC

COMPARE_OP -> LIKE | EQ | NEQ | GT | LT | GE | LE

LIKE -> ID '~' STR | FUNC '~' STR

NEQ -> ID '!=' TYPE | ID '!=' ID | ID '!=' FUNC | FUNC '!=' FUNC | FUNC '!=' ID | FUNC '!=' TYPE

EQ -> ID '=' TYPE | ID '=' ID | ID '=' FUNC | FUNC '=' FUNC | FUNC '=' ID | FUNC '=' TYPE

GT -> ID '>' TYPE | ID '>' ID | ID '>' FUNC | FUNC '>' FUNC | FUNC '>' ID | FUNC '>' TYPE

LT -> ID '<' TYPE | ID '<' ID | ID '<' FUNC | FUNC '<' FUNC | FUNC '<' ID | FUNC '<' TYPE

GE -> ID '>=' TYPE | ID '>=' ID | ID '>=' FUNC | FUNC '>=' FUNC | FUNC '>=' ID | FUNC '>=' TYPE

LE -> ID '<=' TYPE | ID '<=' ID | ID '<=' FUNC | FUNC '<=' FUNC | FUNC '<=' ID | FUNC '<=' TYPE

ALL -> 'all'

FUNC -> ID '(' TYPE | ID, ... ')'

ID -> [a-zA-Z_][a-zA-Z0-9_]*

INT -> [0-9]*\.?[0-9]+

STR -> '[a-zA-Z0-9.?:]*?'

TYPE -> STR | INT

Documentation

Index

Constants

View Source
const (
	// Boolean ops
	OR int = iota
	AND
	NOT

	// Array ops
	IN
	ALLIN
	NOTIN

	// Compare ops
	LIKE
	EQ
	NEQ
	GT
	LT
	GE
	LE

	// Get all op
	ALL

	// Pairs
	OPENPAIR
	CLOSEPAIR

	// Identifier
	ID

	// Types
	STR
	INT
)

Variables

This section is empty.

Functions

func NewCompiler

func NewCompiler() error

Types

type Comp

type Comp struct {
	// contains filtered or unexported fields
}
var Compiler *Comp

func (*Comp) Compile

func (c *Comp) Compile(ctx context.Context, s string) (string, error)

Jump to

Keyboard shortcuts

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