grammar

package
v0.0.0-...-bb84b19 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

README

The grammar folder structure

This folder has two subdirectories (clean-start and recovery), checker.go and checker_test.go files.

Both clean-start and recovery folders have the same structure. They contain files with the context-free grammars abci_grammar_clean_start.md and abci_grammar_recovery.md, respectively. In addition, they have a subdirectory, grammar-auto, where the auto-generated code is stored. Namely, running make grammar-gen from the e2e directory will invoke the gogll program that will use abci_grammar_clean_start.md and abci_grammar_recovery.md grammars as input and produce lexer and parser for them. All the code gogll generates, is stored in the mentioned grammar-auto folder.

checker.go and checker_test.go files contain the logic of the GrammarChecker abstraction and its tests. The GrammarChecker abstraction is used to check whether a specific set of abci.Requests respects the ABCI grammar. It achieves this by using lexers and parsers generated by gogll. Namely, the only place where the auto-generated code is used is inside the func (g *GrammarChecker) verifyRecovery(execution string) []*Error function.

Documentation

Index

Constants

View Source
const Commit = "commit"

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

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

Checker is a checker that can verify whether a specific set of ABCI calls respects the ABCI grammar.

func NewGrammarChecker

func NewGrammarChecker(cfg *Config) *Checker

NewGrammarChecker returns a grammar checker object.

func (*Checker) Verify

func (g *Checker) Verify(reqs []*abci.Request, isCleanStart bool) (bool, error)

Verify verifies whether a list of request satisfy ABCI grammar.

type Config

type Config struct {
	// The number of errors checker outputs.
	NumberOfErrorsToShow int
}

Config allows for setting some parameters, mostly about error logging.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default config for GrammarChecker.

type Error

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

Error represents the error type checker returns.

func (*Error) String

func (e *Error) String() string

String returns string representation of an error.

Directories

Path Synopsis
clean-start
grammar-auto/lexer
Package lexer is generated by GoGLL.
Package lexer is generated by GoGLL.
grammar-auto/parser
Package parser is generated by gogll.
Package parser is generated by gogll.
grammar-auto/parser/bsr
Package bsr implements a Binary Subtree Representation set as defined in
Package bsr implements a Binary Subtree Representation set as defined in
grammar-auto/parser/slot
Package slot is generated by gogll.
Package slot is generated by gogll.
grammar-auto/parser/symbols
Package symbols is generated by gogll.
Package symbols is generated by gogll.
grammar-auto/sppf
Package sppf implements a Shared Packed Parse Forest as defined in:
Package sppf implements a Shared Packed Parse Forest as defined in:
grammar-auto/token
Package token is generated by GoGLL.
Package token is generated by GoGLL.
recovery
grammar-auto/lexer
Package lexer is generated by GoGLL.
Package lexer is generated by GoGLL.
grammar-auto/parser
Package parser is generated by gogll.
Package parser is generated by gogll.
grammar-auto/parser/bsr
Package bsr implements a Binary Subtree Representation set as defined in
Package bsr implements a Binary Subtree Representation set as defined in
grammar-auto/parser/slot
Package slot is generated by gogll.
Package slot is generated by gogll.
grammar-auto/parser/symbols
Package symbols is generated by gogll.
Package symbols is generated by gogll.
grammar-auto/sppf
Package sppf implements a Shared Packed Parse Forest as defined in:
Package sppf implements a Shared Packed Parse Forest as defined in:
grammar-auto/token
Package token is generated by GoGLL.
Package token is generated by GoGLL.

Jump to

Keyboard shortcuts

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