Functors primitives: Module parsing.functors
¶
-
class
pyrser.parsing.functors.
Functor
[source]¶ Bases:
object
Dummy Base class for all parse tree classes.
- common property:
- pt if contain a Functor ptlist if contain a list of Functor
-
class
pyrser.parsing.functors.
Directive2
(name, param: [(<class 'object'>, <class 'type'>)], pt: pyrser.parsing.functors.Functor)[source]¶
-
class
pyrser.parsing.functors.
RewritingRules
(name: str='')[source]¶ Bases:
pyrser.parsing.functors.Functor
Allow to write rewriting rules that transform the AST before code generation/interpretation.
-
class
pyrser.parsing.functors.
SkipIgnore
(convention: str='')[source]¶ Bases:
pyrser.parsing.functors.Functor
Call Ignore Convention primitive functor.
-
__init__
(self, convention: str= '')[source]¶ TODO: Could be better to implement Directive thru functors???
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
PeekChar
(c: str)[source]¶ Bases:
pyrser.parsing.functors.Functor
,pyrser.parsing.functors.Leaf
!!’A’ bnf primitive functor.
-
class
pyrser.parsing.functors.
PeekText
(c: str)[source]¶ Bases:
pyrser.parsing.functors.Functor
,pyrser.parsing.functors.Leaf
!!”TXT” bnf primitive functor.
-
class
pyrser.parsing.functors.
Text
(txt: str)[source]¶ Bases:
pyrser.parsing.functors.Functor
,pyrser.parsing.functors.Leaf
“TXT” bnf primitive functor.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
Char
(c: str)[source]¶ Bases:
pyrser.parsing.functors.Functor
,pyrser.parsing.functors.Leaf
‘A’ bnf primitive functor.
-
class
pyrser.parsing.functors.
Range
(begin: str, end: str)[source]¶ Bases:
pyrser.parsing.functors.Functor
,pyrser.parsing.functors.Leaf
‘A’..’Z’ bnf primitive functor.
-
class
pyrser.parsing.functors.
UntilChar
(c: str)[source]¶ Bases:
pyrser.parsing.functors.Functor
,pyrser.parsing.functors.Leaf
->’A’ bnf primitive functor.
-
class
pyrser.parsing.functors.
Seq
(*ptlist: pyrser.parsing.functors.Functor)[source]¶ Bases:
pyrser.parsing.functors.Functor
A B C bnf primitive as a functor.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
Scope
(begin: pyrser.parsing.functors.Seq, end: pyrser.parsing.functors.Seq, pt: pyrser.parsing.functors.Seq)[source]¶ Bases:
pyrser.parsing.functors.Functor
functor to wrap SCOPE/rule directive or just [].
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
LookAhead
(pt: pyrser.parsing.functors.Functor)[source]¶ Bases:
pyrser.parsing.functors.Functor
!!A bnf primitive as a functor.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
Neg
(pt: pyrser.parsing.functors.Functor)[source]¶ Bases:
pyrser.parsing.functors.Functor
!A bnf primitive as a functor.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
Complement
(pt: pyrser.parsing.functors.Functor)[source]¶ Bases:
pyrser.parsing.functors.Functor
~A bnf primitive as a functor.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
Until
(pt: pyrser.parsing.functors.Functor)[source]¶ Bases:
pyrser.parsing.functors.Functor
->A bnf primitive as a functor.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
Call
(callObject, *params)[source]¶ Bases:
pyrser.parsing.functors.Functor
Functor wrapping a BasicParser method call in a BNF clause.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
CallTrue
(callObject, *params)[source]¶ Bases:
pyrser.parsing.functors.Call
Functor to wrap arbitrary callable object in BNF clause.
-
class
pyrser.parsing.functors.
Capture
(tagname: str, pt: pyrser.parsing.functors.Functor)[source]¶ Bases:
pyrser.parsing.functors.Functor
Functor to handle capture nodes.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
DeclNode
(tagname: str)[source]¶ Bases:
pyrser.parsing.functors.Functor
Functor to handle node declaration with __scope__:N.
-
class
pyrser.parsing.functors.
Bind
(tagname: str, pt: pyrser.parsing.functors.Functor)[source]¶ Bases:
pyrser.parsing.functors.Functor
Functor to handle the binding of a resulting nodes to an existing name.
-
class
pyrser.parsing.functors.
Alt
(*ptlist: pyrser.parsing.functors.Seq)[source]¶ Bases:
pyrser.parsing.functors.Functor
A | B bnf primitive as a functor.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
RepOptional
(pt: pyrser.parsing.functors.Seq)[source]¶ Bases:
pyrser.parsing.functors.Functor
[]? bnf primitive as a functor.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
Rep0N
(pt: pyrser.parsing.functors.Seq)[source]¶ Bases:
pyrser.parsing.functors.Functor
[]* bnf primitive as a functor.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
Rep1N
(pt: pyrser.parsing.functors.Seq)[source]¶ Bases:
pyrser.parsing.functors.Functor
[]+ bnf primitive as a functor.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
Error
(msg: str, **kwargs)[source]¶ Bases:
pyrser.parsing.functors.Functor
Raise an error.
-
class
pyrser.parsing.functors.
Rule
(name: str)[source]¶ Bases:
pyrser.parsing.functors.Functor
,pyrser.parsing.functors.Leaf
Call a rule by its name.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
Hook
(name: str, param: [(<class 'object'>, <class 'type'>)])[source]¶ Bases:
pyrser.parsing.functors.Functor
,pyrser.parsing.functors.Leaf
Call a hook by his name.
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
MetaDirectiveWrapper
[source]¶ Bases:
type
metaclass of all DirectiveWrapper subclasses. ensure that begin and end exists in subclasses as method
-
class
pyrser.parsing.functors.
DirectiveWrapper
[source]¶ Bases:
pyrser.parsing.functors.Functor
functor to wrap begin/end directive
-
class
pyrser.parsing.functors.
Directive
(directive: pyrser.parsing.functors.DirectiveWrapper, param: [(<class 'object'>, <class 'type'>)], pt: pyrser.parsing.functors.Functor)[source]¶ Bases:
pyrser.parsing.functors.Functor
functor to wrap directive HOOKS
-
to_dsl
(self, level= 0)¶
-
-
class
pyrser.parsing.functors.
MetaDecoratorWrapper
[source]¶ Bases:
type
metaclass of all DecoratorWrapper subclasses. ensure that begin and end exists in subclasses as method