regexp

module
v0.0.0-...-99cb562 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2015 License: MIT

README

experimental

#Regexp Factors

Installation

$ go get github.com/ikawaha/regexp/...

To draw parse trees, demo application uses graphviz . You need graphviz installed.

Usage

$ refact
usage: refact regexp
       refact -http=:6060
  -http string
        HTTP service address (e.g. ':6060')

Web App

demo

Programing Example

package main

import (
	"fmt"
	"os"
	"regexp/syntax"

	"github.com/ikawaha/regexp/factor"
)

func main() {
	if len(os.Args) != 2 {
		os.Exit(2)
	}
	re, err := syntax.Parse(os.Args[1], syntax.Perl)
	if err != nil {
		fmt.Fprintf(os.Stderr, "%v", err)
		return
	}
	f := factor.Analyze(re)
	fmt.Println("Exact", f.Exact)
	fmt.Println("Prefix", f.Prefix)
	fmt.Println("Suffix", f.Suffix)
	fmt.Println("Fact", f.Fact)
}

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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