@@ -47,14 +47,22 @@ def group_generator(sequence):
4747 return
4848
4949 current = next (iterator )
50+
51+ # classical grouping using to_group
5052 if current in to_group_keys and matching_found (to_group , current , iterator .show_next ()):
5153 current += next (iterator )
5254 if current in to_group_keys and matching_found (to_group , current , iterator .show_next ()):
5355 current += next (iterator )
56+
57+ # unicode/raw/binary string notation
5458 if current in list ('uUrRbB' ) and str (iterator .show_next ()).startswith (('"' , "'" )):
5559 current += next (iterator )
60+
61+ # in case of unicode_raw or binary_raw string notation
5662 if str (current ).lower () in ["ur" , "br" ] and str (iterator .show_next ()).startswith (('"' , "'" )):
5763 current += next (iterator )
64+
65+ # float exponant notation
5866 if any ([re .match (x , current ) for x in (r'^\d+[eE]$' , r'^\d+\.\d*[eE]$' , r'^\.\d+[eE]$' )]):
5967 current += next (iterator )
6068 current += next (iterator )
@@ -63,17 +71,20 @@ def group_generator(sequence):
6371 # ['123.123e', '[+-]', '123']
6472 assert re .match (r'^\d+[eE][-+]?\d+[jJ]?$' , current ) or re .match (r'^\d*.\d*[eE][-+]?\d+[jJ]?$' , current )
6573
74+ # escaped endl
6675 if current == "\\ " and iterator .show_next () in ('\n ' , '\r \n ' ):
6776 current += next (iterator )
6877 if re .match (r'^\s+$' , str (iterator .show_next ())):
6978 current += next (iterator )
7079
80+ # escaped endl in window notation
7181 if current == "\\ " and iterator .show_next () == "\r " and iterator .show_next (2 ) == "\n " :
7282 current += next (iterator )
7383 current += next (iterator )
7484 if re .match (r'^\s+$' , str (iterator .show_next ())):
7585 current += next (iterator )
7686
87+ # space before escaped endl
7788 if re .match (r'^\s+$' , current ) and iterator .show_next () == "\\ " :
7889 current += next (iterator )
7990 current += next (iterator )
@@ -82,6 +93,7 @@ def group_generator(sequence):
8293 if re .match (r'^\s+$' , str (iterator .show_next ())):
8394 current += next (iterator )
8495
96+ # complex number notation
8597 if (re .match (r'^\d+$' , current ) and match_on_next (r'^\.$' , iterator )) or \
8698 (current == "." and match_on_next (r'^\d+([jJ]|[eE]\d*)?$' , iterator )):
8799 current += next (iterator )
0 commit comments