<s> from __future__ import print_function , unicode_literals <EOL> from arpeggio import * <EOL> from arpeggio import RegExMatch as _ <EOL> from . peg import PEGVisitor <EOL> from . peg import ParserPEG as ParserPEGOrig <EOL> __all__ = [ '<STR_LIT>' ] <EOL> def peggrammar ( ) : return OneOrMore ( rule ) , EOF <EOL> def rule ( ) : return rule_name , ASSIGNMENT , ordered_choice <EOL> def ordered_choice ( ) : return sequence , ZeroOrMore ( SLASH , sequence ) <EOL> def sequence ( ) : return OneOrMore ( prefix ) <EOL> def prefix ( ) : return Optional ( [ AND , NOT ] ) , sufix <EOL> def sufix ( ) : return expression , Optional ( [ QUESTION , STAR , PLUS ] ) <EOL> def expression ( ) : return [ regex , rule_crossref , <EOL> ( OPEN , ordered_choice , CLOSE ) , <EOL> str_match ] , Not ( ASSIGNMENT ) <EOL> def ASSIGNMENT ( ) : return "<STR_LIT:=>" <EOL> def SLASH ( ) : return "<STR_LIT:/>" <EOL> def STAR ( ) : return "<STR_LIT:*>" <EOL> def QUESTION ( ) : return "<STR_LIT:?>" <EOL> def PLUS ( ) : return "<STR_LIT:+>" <EOL> def AND ( ) : return "<STR_LIT:&>" <EOL> def NOT ( ) : return "<STR_LIT:!>" <EOL> def OPEN ( ) : return "<STR_LIT:(>" <EOL> def CLOSE ( ) : return "<STR_LIT:)>" <EOL> def regex ( ) : return "<STR_LIT>" , _ ( r"<STR_LIT>" ) , "<STR_LIT:'>" <EOL> def rule_name ( ) : return _ ( r"<STR_LIT>" ) <EOL> def rule_crossref ( ) : return rule_name <EOL> def str_match ( ) : return _ ( r'<STR_LIT>' ) <EOL> def comment ( ) : return _ ( "<STR_LIT>" ) <EOL> class ParserPEG ( ParserPEGOrig ) : <EOL> def _from_peg ( self , language_def ) : <EOL> parser = ParserPython ( peggrammar , comment , reduce_tree = False , <EOL> debug = self . debug ) <EOL> parser . root_rule_name = self . root_rule_name <EOL> parse_tree = parser . parse ( language_def ) <EOL> return visit_parse_tree ( parse_tree , PEGVisitor ( self . root_rule_name , <EOL> self . comment_rule_name , <EOL> self . ignore_case , <EOL> debug = self . debug ) ) </s>
