synta

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: AGPL-3.0 Imports: 4 Imported by: 2

README

Synta

Synta è uno strumento a linea di comando per svolgere svariate operazioni sul formato di definizione regolare usato internamente a CartaBinaria per vincolare le nomenclature dei file. Per ulteriori informazioni, si veda la relativa pagina wiki

Documentation

Index

Constants

View Source
const (
	SegmentTypeIdentifier = iota
	SegmentTypeOptional
)

Variables

View Source
var IdentifierRegexp = regexp.MustCompile("[a-z]+")

A regexp which describes an identifier

Functions

This section is empty.

Types

type Definition

type Definition struct {
	Comments []string
	Regexp   *regexp.Regexp
}

A Definition is a named regexp along with comments to clarify the regexp's purpose It corresponds to the <commdef> BNF definition

type Filename

type Filename struct {
	Segments  []Segment
	Extension Identifier
}

Filename represents the flename defintion, made up of a series of segments and a file extension

type Identifier

type Identifier string

An Identifier is a lowercase alphabetical string. It corresponds to the <id> BNF definition

type Segment

type Segment struct {
	Kind        SegmentType
	Value       *Identifier
	Subsegments []Segment
}

A Segment is a section of the main filename It corresponds to the <segment> BNF definition

type SegmentType

type SegmentType uint

type State

type State uint8
const (
	State0 State = iota
	State1
	State2
	State3
	State4
	State5
	State6
	State7
	State8
)

type Synta

type Synta struct {
	Definitions map[Identifier]Definition
	Filename    Filename
}

Synta represents the contents of a Synta file It corresponds to the <language> BNF definition The last segment of the Filename is the extension

func Clear

func Clear(synta Synta) (s Synta)

Clear returns a new Synta structure without any unused definitions

func MustSynta

func MustSynta(contents string) Synta

func ParseSynta

func ParseSynta(contents string) (s Synta, err error)

ParseSynta attempts to parse a file's contents into a Synta internal representation. If an error is encountered the parsing is aborted and the error returned

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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