scanclrmake/src/crparser.cxx
// ===========================================================================
// Update the currentSection, inBuildRules, and lineCountInSection state.
//
Update the currentSection, inBuildRules, and lineCountInSection state.
Update the currentSection inBuildRules and lineCountInSection state .
void CRParser::trackSection(ParseLine &line)
{
    if (currentSection != no_sct) {
        if (lineCountInSection > 0 && hRuleCount > 0) {
	    currentSection = no_sct;
	    lineCountInSection = 0;
	    inBuildRules = false;
	}
	else {
	    lineCountInSection += 1;
	}
    }
    if (currentSection == no_sct && hRuleCount == 0) {
	if (targetCount == 0 ? (prevHRuleCount == 0 || prevHRuleCount == 2) : prevHRuleCount == 3) {
	    currentSection = intro_sct;
            targetCount += 1;
	}
	else if (prevHRuleCount > 0) {
	    Regexp obj_re("object");
	    Regexp env_re("ariable|ption");
	    Regexp bld_re("uild|cript");
	    const char *l = line.getLine().c_str();
	    if (obj_re.Match(l, strlen(l), 0) >= 0) {
		currentSection = obj_sct;
	    }
	    else if (env_re.Match(l, strlen(l), 0) >= 0) {
		currentSection = env_sct;
	    }
	    else if (bld_re.Match(l, strlen(l), 0) >= 0) {
		currentSection = bld_sct;
	    }
	    else {
		currentSection = misc_sct;
	    }
	}
    }
    if (hRuleCount == 0 && lineCountInSection > 0) {
	if (currentSection == bld_sct) {
    	    inBuildRules = true;
	}
    }
}
void CRParser :: trackSection ( ParseLine & line ) { if ( currentSection != no_sct ) { if ( lineCountInSection > 0 && hRuleCount > 0 ) { currentSection = no_sct ; lineCountInSection = 0 ; inBuildRules = false ; } else { lineCountInSection += 1 ; } } if ( currentSection == no_sct && hRuleCount == 0 ) { if ( targetCount == 0 ? ( prevHRuleCount == 0 || prevHRuleCount == 2 ) : prevHRuleCount == 3 ) { currentSection = intro_sct ; targetCount += 1 ; } else if ( prevHRuleCount > 0 ) { Regexp obj_re ( " " ) ; Regexp env_re ( " " ) ; Regexp bld_re ( " " ) ; const char * l = line . getLine ( ) . c_str ( ) ; if ( obj_re . Match ( l , strlen ( l ) , 0 ) >= 0 ) { currentSection = obj_sct ; } else if ( env_re . Match ( l , strlen ( l ) , 0 ) >= 0 ) { currentSection = env_sct ; } else if ( bld_re . Match ( l , strlen ( l ) , 0 ) >= 0 ) { currentSection = bld_sct ; } else { currentSection = misc_sct ; } } } if ( hRuleCount == 0 && lineCountInSection > 0 ) { if ( currentSection == bld_sct ) { inBuildRules = true ; } } }
Update the currentSection, inBuildRules, and lineCountInSection state.
Update the currentSection inBuildRules and lineCountInSection state .
// current line is a rule, ending section // An intro section may begin at the top of the file, // or after 3 horizontal rules. // Another section may begin after a rule. // line from body of section