grammar

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eval

func Eval(source string, options ...participle.ParseOption) (*api.Manifest, error)

Eval evaluates the source input against the grammar and returns an instance of *sloth.spec

Types

type Grammar

type Grammar struct {
	// Stmts is a list of Sloth grammar Statements
	Stmts []*Statement `@@*`
}

Grammar is the participle grammar use to parse the Sloth comment groups in source files

type Scope

type Scope struct {
	// Type is the specification struct a statement refers to
	Type  string `(Fyi @((".error" (".suggestion")? ))?)`
	Value string `` /* 128-byte string literal not displayed */
}

Scope defines the statement scope, similar to a code function

func (Scope) GetType

func (k Scope) GetType() string

GetType returns the type of the statement scope

type Statement

type Statement struct {
	Scope Scope  `@@`
	Value string `Whitespace* @(String (Whitespace|EOL)*)+`
}

Statement is any comment starting with @sloth keyword

Jump to

Keyboard shortcuts

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