void call_validation_functions( char* content_to_analysis )
{
	char char_content;
	/* if a conditional structure flag fl_verify_block = 1, and verify opening and closing code blocks with '{}' */
	register int fl_verify_block;
	match = regex_match_syntax( "(if|for|while)", content_to_analysis );	
	if( match == 1 )
	{	
		fl_verify_block = 1;
	}
	
	register int i = 0;
	LINE = 0;
	for ( i ; i < length-1 ; i++ )
	{
		match_break_line = regex_match_syntax( "\\n", &char_content );
		if( match_break_line == 1)
		{
			LINE++;
		}
		
		char_content = content_to_analysis[i];
		
		if( fl_verify_block == 1 )
		{
			get_begin_end_block( char_content );
		}
		
		/* validate_end_instructions( char_content ); */
	}
	validate_beginend_block();
}
void get_begin_end_block( char char_content )
{
	match = regex_match_syntax( "{", &char_content );
	if( match == 1)
	{
		count_block.count_begin++;
	}
	match = regex_match_syntax( "}", &char_content );
	if( match == 1)
	{
		count_block.count_end++;
	}
}
Beispiel #3
0
void read_script_file()
{
    FILE * fp;
    char * line = NULL;
    size_t len = 0;
    ssize_t read;
    register int i;

    fp = fopen( arg_val[1], "r" );
    if (fp == NULL)
    {
        printf( "Script file not found!\n" );
        exit(EXIT_FAILURE);
    }
    i = 1;
    while ( (read = getline(&line, &len, fp)) != -1 )
    {
        int match = regex_match_syntax( "^[\n]+", line );
        if( match == 0 )
        {
            validate_end_instructions( line );
        }
        attribute_value_to_variables( line );
        find_statement( line );
        i++;
        LINE_ERROR++;
    }

    if ( line )
    {
        free(line);
    }
}
void validate_extesionfile( char* file_name )
{
	match = regex_match_syntax( "\\.mav", file_name );
	if( match == 0 )
	{		
		exit( EXIT_FAILURE );
	}
}