This is a cython-based python binding of PIRE.
What is not wrapped:
- It is impossible yet to subclass
Feature
s andScanner
s in python and pass the extension back to C++; - Most low-level operations with
Fsm
; mmap
- andAction
-related methods and functions;- Run for pair of scanners;
Feature
andEncoding
classes.
Interface of the binding is similar to the original one. Differences:
- All C++-space global template functions are wrapped as python instance methods.
Fsm::operator * ()
is wrapped asFsm.Iterated()
.- All scanners' states are represented as classes similar to
Pire::RunHelper
. Encoding
,Feature
andOption
abstractions are replaced with singleOptions
abstraction, which is used to tweak Lexer behavior.Options
can be either parsed from string such as "aiyu" or composed of predefined constants such asI
andUTF8
.- Instead of
lexer.AddFeature(Capture(42))
you uselexer.AddCapturing(42)
. - Unsuccessful glue operation raises
OverflowError
instead of returning empty scanner.