parser

package
v0.0.0-...-190a898 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2018 License: LGPL-3.0-or-later Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAlpha

func IsAlpha(c byte) bool

IsAlpha is a tool function that returns whether the byte is an alphabet

func IsDigit

func IsDigit(c byte) bool

IsDigit is a tool function that returns whether the byte is a digit

func IsFirst

func IsFirst(c byte) bool

IsFirst is a tool function that returns whether the byte is an alphabet or an underline

func IsLetter

func IsLetter(c byte) bool

IsLetter is a tool function that returns whether the byte is an alphabet or an underline or a digit

func IsLower

func IsLower(c byte) bool

IsLower is a tool function that returns whether the byte is an alphabet in lower case

func IsSpace

func IsSpace(c byte) bool

IsSpace is a tool function that returns whether the byte is a space related rune

func IsUpper

func IsUpper(c byte) bool

IsUpper is a tool function that returns whether the byte is an alphabet in upper case

func ParseChar

func ParseChar(r []byte) (c rune, l int)

ParseChar parses the input to a char after escape

func ParseDec

func ParseDec(r []byte, L int) (i int64, l int)

ParseDec parses the input to a decimal number

func ParseExponent

func ParseExponent(r []byte) (i int64, l int)

ParseExponent parses the exponent part of a float

func ParseFloat

func ParseFloat(r []byte) (f float64, l int)

ParseFloat parses the input to a float

func ParseFraction

func ParseFraction(r []byte) (f float64, l int)

ParseFraction parses the fraction part of a float

func ParseHex

func ParseHex(r []byte, L int) (i int64, l int)

ParseHex parses the input to a hexadecimal number

func ParseInt

func ParseInt(r []byte) (i int64, l int)

ParseInt parses the input to a decimal integer

func ParseOct

func ParseOct(r []byte, L int) (i int64, l int)

ParseOct parses the input to an octal number

Types

type Pattern

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

Pattern defines all the lexical rules rule describes the rule by an actual function str defines the key word directly

func (*Pattern) Add

func (p *Pattern) Add(f func([]byte) (interface{}, int))

Add adds a lexical rule to a Scanner

func (*Pattern) AddString

func (p *Pattern) AddString(s string)

AddString adds a key word to a Scanner

func (*Pattern) NewScanner

func (p *Pattern) NewScanner(s []byte, t bool) *Scanner

NewScanner generates a specific Scanner to input code by Pattern(lexical rules)

type Scanner

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

Scanner defines a lexical analyzer ptn is the lexical rule tkn is the raw code to be analyze skp decides whether to skip space

func (*Scanner) Over

func (s *Scanner) Over() bool

Over tells whether there is data which is not analyzed yet

func (*Scanner) Scan

func (s *Scanner) Scan() (interface{}, int, error)

Scan try to analyze ONE lexical unit on raw data and prune the analyzed raw data

func (*Scanner) Skip

func (s *Scanner) Skip()

Skip ignores all the coming space

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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