package regex
import "github.com/alecthomas/participle/lexer/regex"
Package regex provides a regex based lexer using a readable list of named patterns.
eg.
Ident = [[:ascii:]][\w\d]* Whitespace = \s+
Index ¶
Functions ¶
func New ¶
func New(grammar string) (lexer.Definition, error)
New creates a regex lexer from a readable list of named patterns.
This accepts a grammar where each line is a named regular expression in the form:
# <comment> <name> = <regexp>
eg.
Ident = [[:ascii:]][\w\d]* Whitespace = \s+
Order is relevant. Comments may only occur at the beginning of a line. The regular expression will have surrounding whitespace trimmed before being parsed. Lower-case rules are ignored.
Source Files ¶
- Version
- v0.7.1 (latest)
- Published
- Nov 26, 2020
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 1 month ago –
Tools for package owners.