Skip to main content

Greenery allows manipulation of Regular Expressions as Finite State Machines

Project description

See http://qntm.org/fsm, http://qntm.org/lego, http://qntm.org/greenery

Implements tools for parsing and manipulating regular expressions and their sub-components
(greenery.lego), and for producing finite-state machines that implement them (greenery.fsm).


USAGE

Import the parts of the greenery subsystem that you wish to use, eg:

from greenery.lego import (parse, lego)
regex = parse( "a*b" )
assert isinstance( regex, lego )

This style will work with either version 1.x or version 2.0+ of greenery installed; both versions
contain the greenery.fsm and greenery.lego packages.


COMPATIBILITY

Version 2.0 provides exactly the same functionality as 1.x, but restores the ability to import and
use greenery.lego and greenery.fsm separately as the default. In the 1.x versions, executing:

import greenery
regex = greenery.parse( "a*b" )

would import all of greenery.fsm.* and greenery.lego.* into the greenery namespace.

To restore version 1.0 behavior for legacy code, use the greenery.v1 compatibility interface:

import greenery.v1 as greenery
regex = greenery.parse( "a*b" )

To make version 1.x style code work with either version 1.x or version 2.x, use:

try:
import greenery.v1 as greenery
except ImportError:
import greenery
# ...greenery version 1 code...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

greenery-2.0.tar.gz (32.1 kB view details)

Uploaded Source

File details

Details for the file greenery-2.0.tar.gz.

File metadata

  • Download URL: greenery-2.0.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for greenery-2.0.tar.gz
Algorithm Hash digest
SHA256 30e913d6980f5a71c077432675bcf0c9af5288832f5ec59f5a121cbf63228fa5
MD5 444ea4c00a522208514dc0845de6f0b5
BLAKE2b-256 4a92b946cf4f4d3fd65ff17d32ea0120ef1aaea6524d9aeaeb9a35632e99f4fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page