regex

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2020 License: MIT Imports: 4 Imported by: 7

Documentation

Overview

Package regex provides a regex based lexer using a readable list of named patterns.

eg.

Ident = [[:ascii:]][\w\d]*
Whitespace = \s+

Index

Constants

This section is empty.

Variables

This section is empty.

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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