re2dfa

command module
v0.0.0-...-4619871 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2015 License: GPL-3.0 Imports: 9 Imported by: 0

README

re2dfa License Build Status

re2dfa transforms regular expressions into deterministic finite state machines and outputs Go source code containing the matching function.

Installation

go get github.com/opennota/re2dfa

Usage

re2dfa ^a+$ main.matchAPlus string

Benchmarks

Regular expression:

^(?:
    <[A-Za-z][A-Za-z0-9\-]*(?:\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\s*=\s*(?:[^"'=<>`\x00-\x20]+|'[^']*'|"[^"]*"))?)*\s*\/?> |

    <\/[A-Za-z][A-Za-z0-9\-]*\s*> |

    <!----> |

    <!--(?:-?[^>-])(?:-?[^-])*--> |

    <[?].*?[?]> |

    <![A-Z]+\s+[^>]*> |

    <!\[CDATA\[[\s\S]*?\]\]>
)

Benchmark results (Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz):

BenchmarkFSM1          300000         4049 ns/op          0 B/op        0 allocs/op
BenchmarkRegexp1        30000        48303 ns/op        112 B/op        7 allocs/op

Documentation

Overview

Transform regular expressions into finite state machines.

Directories

Path Synopsis
Package codegen implements generation of Go code from deterministic finite automata.
Package codegen implements generation of Go code from deterministic finite automata.
Package dfa provides a way to construct deterministic finite automata from non-deterministic finite automata.
Package dfa provides a way to construct deterministic finite automata from non-deterministic finite automata.
Package nfa provides a way to construct non-deterministic finite automata from regular expressions using the Thompson's construction algorithm.
Package nfa provides a way to construct non-deterministic finite automata from regular expressions using the Thompson's construction algorithm.
Package runerange provides operations on rune ranges.
Package runerange provides operations on rune ranges.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳