@@ -410,7 +410,14 @@ def _parse_string(
410410 current_node : Node ,
411411 statements : list [Statement ],
412412) -> Node :
413- tokens = [part .strip () for part in SPLIT_RE .split (raw ) if part .strip () != "" ]
413+ tokens = []
414+ for part in SPLIT_RE .split (raw ):
415+ if part == "" :
416+ continue
417+ elif part .strip () == "" :
418+ tokens .append (part )
419+ else :
420+ tokens .append (part .strip ())
414421 index = 0
415422 while index < len (tokens ):
416423 raw_current_token = tokens [index ]
@@ -424,6 +431,8 @@ def _parse_string(
424431 )
425432 else :
426433 current_node .parts .append (Part (parent = current_node , text = raw_current_token ))
434+ elif raw_current_token .strip () == "" :
435+ consumed = 1
427436 elif isinstance (current_node , (Function , Group )):
428437 if current_token == ")" :
429438 group_or_function = _find_node (current_node , (Function , Group ))
@@ -522,9 +531,12 @@ def _parse_clause(
522531 index = 0
523532 clause_entry = CLAUSES
524533 text = ""
525- while index < len (tokens ) and tokens [index ].lower () in clause_entry :
526- clause_entry = cast (ClauseDictionary , clause_entry [tokens [index ].lower ()])
527- text = f"{ text } { tokens [index ]} " .strip ()
534+ while index < len (tokens ) and (
535+ tokens [index ].strip () == "" or tokens [index ].lower () in clause_entry
536+ ):
537+ if tokens [index ].strip () != "" :
538+ clause_entry = cast (ClauseDictionary , clause_entry [tokens [index ].lower ()])
539+ text = f"{ text } { tokens [index ]} " .strip ()
528540 index += 1
529541
530542 if isinstance (current_node , (Function , Group )):
0 commit comments