@@ -459,6 +459,27 @@ static size_t handleZshKeyword (int keyword,
459459	return  vStringLength (token );
460460}
461461
462+ static  bool  doesLineCotinue (const  unsigned char   * start , const  unsigned char   * cp )
463+ {
464+ 	cp -- ;
465+ 	if  (start  >= cp )
466+ 		return  false;
467+ 
468+ 	if  (* cp  !=  '\\' )
469+ 		return  false;
470+ 
471+ 	while  (start  <  cp )
472+ 	{
473+ 		if  (* cp  ==  ';'  ||  * cp  ==  '|'  ||  * cp  ==  '&' )
474+ 			return  false;
475+ 		else  if  (isspace (* cp ))
476+ 			cp -- ;
477+ 		else 
478+ 			return  true;
479+ 	}
480+ 	return  false;
481+ }
482+ 
462483static  bool  handleVariableAssignment  (vString  * input )
463484{
464485	const  char  * base  =  vStringValue  (input );
@@ -503,6 +524,7 @@ static void findShTagsCommon (size_t (* keyword_handler) (int,
503524	struct  hereDocParsingState  hstate ;
504525	hdocStateInit  (& hstate );
505526
527+ 	bool  cont_line  =  false;
506528	while  ((line  =  readLineFromInputFile  ()) !=  NULL )
507529	{
508530		const  unsigned char  *  cp  =  line ;
@@ -528,10 +550,12 @@ static void findShTagsCommon (size_t (* keyword_handler) (int,
528550				vStringDelete  (hereDocDelimiter );
529551				hereDocDelimiter  =  NULL ;
530552			}
553+ 			cont_line  =  false;
531554			continue ;
532555		}
533556
534557		hdocStateClear  (& hstate );
558+ 		bool  beginning_of_line  =  !cont_line ;
535559		while  (* cp  !=  '\0' )
536560		{
537561			subparser  * sub  =  NULL ;
@@ -669,6 +693,7 @@ static void findShTagsCommon (size_t (* keyword_handler) (int,
669693						cp  +=  d ;
670694					else  if  (* cp  !=  '\0' )
671695						++ cp ;
696+ 					beginning_of_line  =  false;
672697					continue ;
673698				}
674699
@@ -710,7 +735,8 @@ static void findShTagsCommon (size_t (* keyword_handler) (int,
710735					++ cp ;
711736				}
712737			}
713- 			else  if  (found_kind  ==  K_NOTHING 
738+ 			else  if  (beginning_of_line 
739+ 					 &&  found_kind  ==  K_NOTHING 
714740					 &&  handleVariableAssignment  (name ))
715741				found_kind  =  K_VARIABLE ;
716742
@@ -729,7 +755,11 @@ static void findShTagsCommon (size_t (* keyword_handler) (int,
729755			else  if  (!hereDocDelimiter )
730756				hdocStateUpdateArgs  (& hstate , name );
731757			vStringClear  (name );
758+ 			beginning_of_line  =  false;
732759		}
760+ 		if  (* cp  ==  '#' )
761+ 			cont_line  =  false;
762+ 		cont_line  =  doesLineCotinue  (line , cp );
733763	}
734764	hdocStateFini  (& hstate );
735765	vStringDelete  (name );
0 commit comments