pkgbuild

package
v0.0.0-...-9f54f22 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package pkgbuild provides a lexer and parser for pkgbuild files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(reader io.Reader)

Parse the given PKGBUILD reader

Types

type Scanner

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

Scanner scans for tokens

func NewScanner

func NewScanner(reader io.Reader) *Scanner

NewScanner creates a new scanner instance

func (*Scanner) Next

func (s *Scanner) Next() bool

Next scans for the the next token

func (*Scanner) Scan

func (s *Scanner) Scan() Token

Scan for the the next token

type Token

type Token struct {
	Type   TokenType
	Tokens []Token
	Text   string
}

Token encapsulates components needed to track tokens

type TokenType

type TokenType int

TokenType is the set of lexical tokens of the PKGBUILD format.

const (
	ILLEGAL TokenType = iota

	EOF      // Errors or end of file
	EOL      // end of line handle both \r\n and \n
	WS       // one or more whitespaces
	COMMENT  // comments
	NAME     // variable name
	VALUE    // variable value
	ARRAY    // variable array value
	EQUAL    // variable equals
	VARIABLE // parent token composed of NAME, EQUAL, VALUE/ARRAY
)

List of token types

Jump to

Keyboard shortcuts

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