ast

package
v0.0.0-...-2c8557b Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RULE = iota
	PREFIX
	INFIX
	INTEGER
	STRING
	REGEX
	BOOL
	ASSIGNMENT
	IDENTITY
	VARIABLE
	KEYWORD
	BYTES
	IMPORT
	SET
	FOR
)

Variables

This section is empty.

Functions

func IsModuleCall

func IsModuleCall(node Node) bool

IsModuleCall returns true if the expression node is a module call, e.g. pe.entry_point

func IsPrimitive

func IsPrimitive(node Node) bool

IsPrimitive returns true if the node is a primitive value like an Integer, Float, String, Variable, or Bool

Types

type Assignment

type Assignment struct {
	Left       string
	Right      Node
	Attributes map[int]Node
}

func (*Assignment) BytePattern

func (a *Assignment) BytePattern() (*BytePattern, error)

BytePattern returns a byte slice which represents the pattern to search for, an offset for use if the pattern is partial and located somewhere in the full pattern, a bool to say if this is case insensitive or not, and an error.

func (Assignment) String

func (a Assignment) String() string

func (*Assignment) Type

func (a *Assignment) Type() int

type Bool

type Bool struct {
	Token *lexer.Token
	Value bool
}

func (Bool) String

func (b Bool) String() string

func (*Bool) Type

func (b *Bool) Type() int

type BytePattern

type BytePattern struct {
	Patterns        [][]byte
	Offsets         []int
	Nocase          bool
	IsPartial       bool
	PartialPatterns [][]int
	Re              *regexp.Regexp
}

type Bytes

type Bytes struct {
	Token *lexer.Token
	Items []string
}

func (*Bytes) BytePattern

func (b *Bytes) BytePattern() ([][]int, error)

func (Bytes) String

func (b Bytes) String() string

func (*Bytes) Type

func (b *Bytes) Type() int

type For

type For struct {
	Expr      *lexer.Token
	StringSet Node
	Var       string
	Body      Node
}

func (For) String

func (f For) String() string

func (For) Type

func (f For) Type() int

type Identity

type Identity struct {
	Token *lexer.Token
	Value string
}

func (Identity) String

func (i Identity) String() string

func (*Identity) Type

func (i *Identity) Type() int

type Import

type Import struct {
	Token *lexer.Token
	Value string
}

func (Import) String

func (i Import) String() string

func (*Import) Type

func (i *Import) Type() int

type Infix

type Infix struct {
	Token *lexer.Token
	Left  Node
	Right Node
}

func (Infix) String

func (i Infix) String() string

func (*Infix) Type

func (i *Infix) Type() int

type Integer

type Integer struct {
	Token *lexer.Token
	Value int64
}

func (Integer) String

func (i Integer) String() string

func (*Integer) Type

func (i *Integer) Type() int

type Keyword

type Keyword struct {
	Token     *lexer.Token
	Value     string
	Attribute Node
}

func (Keyword) String

func (k Keyword) String() string

func (*Keyword) Type

func (k *Keyword) Type() int

type Node

type Node interface {
	Type() int
	String() string
}

type Prefix

type Prefix struct {
	Token *lexer.Token
	Right Node
}

func (Prefix) String

func (p Prefix) String() string

func (*Prefix) Type

func (p *Prefix) Type() int

type Regex

type Regex struct {
	Token *lexer.Token
	Value string
}

func (*Regex) BytePattern

func (r *Regex) BytePattern() ([]byte, error)

func (Regex) String

func (r Regex) String() string

func (*Regex) Type

func (r *Regex) Type() int

type Rule

type Rule struct {
	Private   bool
	Global    bool
	Name      string
	Tags      []string
	Condition Node
	Strings   []Node
	Meta      []Node
}

func (Rule) String

func (r Rule) String() string

func (*Rule) Type

func (r *Rule) Type() int

type Set

type Set struct {
	Nodes []Node
}

func (Set) String

func (s Set) String() string

func (*Set) Type

func (s *Set) Type() int

type String

type String struct {
	Token *lexer.Token
	Value string
}

func (String) String

func (s String) String() string

func (*String) Type

func (s *String) Type() int

type Variable

type Variable struct {
	Token *lexer.Token
	Value string
}

func (Variable) String

func (v Variable) String() string

func (*Variable) Type

func (v *Variable) Type() int

Jump to

Keyboard shortcuts

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