#NEWLINE# def _build_rule( self ) : #NEWLINE# #INDENT# name = self . name #NEWLINE# if __debug__ : #NEWLINE# #INDENT# trace ( ( 'Builder: build rule for %s' % name ) ) #NEWLINE# #UNINDENT# if ( ( name [ 0 ] != '<' ) or ( name [ ( - 1 ) ] != '>' ) ) : #NEWLINE# #INDENT# raise ParserException ( self . ctx , self . line , 'Invalid rule (must be inside <>)' ) #NEWLINE# #UNINDENT# name = name [ 1 : ( - 1 ) ] #NEWLINE# if ( name [ : 1 ] == '-' ) : #NEWLINE# #INDENT# self . avoid_previous_rules = True #NEWLINE# name = name [ 1 : ] #NEWLINE# #UNINDENT# for rule in re . split ( lang_cls_split_pat , name ) : #NEWLINE# #INDENT# crule = None #NEWLINE# if ( not len ( rule ) ) : #NEWLINE# #INDENT# raise ParserException ( self . ctx , self . line , 'Empty rule detected' ) #NEWLINE# #UNINDENT# if ( '@' in rule ) : #NEWLINE# #INDENT# ( rule , baseclasses ) = rule . split ( '@' , 1 ) #NEWLINE# if ( not re . match ( lang_key , rule ) ) : #NEWLINE# #INDENT# raise ParserException ( self . ctx , self . line , 'Invalid dynamic class name' ) #NEWLINE# #UNINDENT# self . ctx . dynamic_classes [ rule ] = baseclasses #NEWLINE# crule = ParserSelectorName ( rule ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( rule [ 0 ] == '.' ) : #NEWLINE# #INDENT# crule = ParserSelectorClass ( rule [ 1 : ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( rule [ 0 ] == '#' ) : #NEWLINE# #INDENT# crule = ParserSelectorId ( rule [ 1 : ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# crule = ParserSelectorName ( rule ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . ctx . rules . append ( ( crule , self ) )