model

package
v0.0.0-...-a29d1be Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT, MIT Imports: 9 Imported by: 0

Documentation

Overview

Package model 模式指令的实现。

Index

Constants

View Source
const (

	// 关联数据哈希长度
	HashSize = chash.Size160
)

Variables

This section is empty.

Functions

func Check

func Check(s, m []byte, ver int) ([]any, bool)

模式匹配校验。 返回值:(取值集, 是否匹配成功)

Types

type Float

type Float = instor.Float

引用:浮点数类型

type Insted

type Insted = instor.Insted

引用:指令信息包(已解析)

type Instor

type Instor = instor.Instor

引用:指令信息包(原始)

type Int

type Int = instor.Int

引用:整数类型

type Matcher

type Matcher func([]byte, wildpart) *Instor

匹配捡取器。 从模式区匹配指令中提取指令原始字节信息。 规则: - 某附参或关联数据通配时,其位即不存在(节省空间)。 - 如果附参通配,除非哈希匹配模式,否则数据必然通配。

type Modeler

type Modeler func(_ *State, s, m []byte) (int, int, bool)

模式处理器。 s 为源脚本字节序列。 m 为模式脚本字节序列。 返回值: (源脚本指令总长,模式指令总长,匹配成功与否)

type RegExp

type RegExp = instor.RegExp

引用:正则表达式

type State

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

模式匹配状态

func (*State) Data

func (s *State) Data() []any

获取提取的值集。

func (*State) Last

func (s *State) Last() []byte

获取最近一个匹配指令的长度。

func (*State) Matched

func (s *State) Matched(i int) any

获取匹配结果成员。 容错超出范围的检索,返回nil而非抛出异常(宽容)。

func (*State) PushData

func (s *State) PushData(data ...any)

向存储区添加数据。

func (*State) SetLast

func (s *State) SetLast(b []byte)

当前指令段暂存。

func (*State) SetMatched

func (s *State) SetMatched(data []any)

设置匹配结果。

Jump to

Keyboard shortcuts

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