charclass

package
v0.0.0-...-65f6afe Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package charclass provide functions for handling character class regular expressions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CharClass

type CharClass struct {
	// Map represents individual elements
	Map map[rune]bool
	// RangeTable represents ranges
	*unicode.RangeTable
	// Negated indicates that the char class expression is negated.
	Negated bool
	// Special is empty or otherwise indicates a special class, with expectation that
	// method unicode.${Special} exists. The regex notation taken from GNU Grep
	// is translated into unicode package name conventions (e.g. "[:alpha:]" -> "IsLetter").
	// "[:alnum:]" is a special special case and is represented by the value "[:alnum:]" without translation.
	Special string
}

CharClass represents a char class

func Parse

func Parse(arg string) (*CharClass, error)

Parse parses a charclass string. TODO(salikh): Support mixed special classes (both specials and regular chars).

func (*CharClass) String

func (cc *CharClass) String() string

String converts the CharClass instance into a canonical string representation that can be parsed back to the CharClass.

Jump to

Keyboard shortcuts

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