fixed quite a few bugs and enhanced error handling in sed
This commit is contained in:
		| @ -26,7 +26,7 @@ static const qse_char_t* geterrstr (int errnum) | ||||
| 		QSE_T("out of memory"), | ||||
| 		QSE_T("command '${0}' not recognized"), | ||||
| 		QSE_T("command code missing"), | ||||
| 		QSE_T("command '${0}' not terminated properly"), | ||||
| 		QSE_T("command '${0}' incomplete"), | ||||
| 		QSE_T("regular expression '${0}' incomplete"), | ||||
| 		QSE_T("failed to compile regular expression '${0}'"), | ||||
| 		QSE_T("failed to match regular expression"), | ||||
| @ -49,6 +49,7 @@ static const qse_char_t* geterrstr (int errnum) | ||||
| 		QSE_T("multiple occurrence specifier"), | ||||
| 		QSE_T("occurrence specifier is zero"), | ||||
| 		QSE_T("occurrence specifier too large"), | ||||
| 		QSE_T("io error with file '${0}'"), | ||||
| 		QSE_T("error returned by user io handler") | ||||
| 	}; | ||||
|  | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -49,8 +49,24 @@ struct qse_sed_t | ||||
| 		const qse_char_t* cur; /**< current source text pointer */ | ||||
| 	} src; | ||||
|  | ||||
| 	/** temporary regular expression buffer */ | ||||
| 	qse_str_t rexbuf; | ||||
| 	/** temporary data for compiling */ | ||||
| 	struct | ||||
| 	{ | ||||
| 		qse_str_t rex; /**< regular expression buffer */ | ||||
| 		qse_str_t lab; /**< label name buffer */ | ||||
|  | ||||
| 		/** data structure to compile command groups */ | ||||
| 		struct | ||||
| 		{ | ||||
| 			/** current level of command group nesting */ | ||||
| 			int level; | ||||
| 			/** keeps track of the begining of nested groups */ | ||||
| 			qse_sed_cmd_t* cmd[128]; | ||||
| 		} grp; | ||||
|  | ||||
| 		/** a table storing labels seen */ | ||||
| 		qse_map_t labs;  | ||||
| 	} tmp; | ||||
|  | ||||
| 	/** compiled commands */ | ||||
| 	struct | ||||
| @ -60,18 +76,6 @@ struct qse_sed_t | ||||
| 		qse_sed_cmd_t* cur; /**< points next to the last command */ | ||||
| 	} cmd; | ||||
|  | ||||
| 	/** a table storing labels seen */ | ||||
| 	qse_map_t labs;  | ||||
|  | ||||
| 	/** data structure to compile command groups */ | ||||
| 	struct | ||||
| 	{ | ||||
| 		/** current level of command group nesting */ | ||||
| 		int level; | ||||
| 		/** keeps track of the begining of nested command groups */ | ||||
| 		qse_sed_cmd_t* cmd[128]; | ||||
| 	} grp; | ||||
|  | ||||
| 	/** data for execution */ | ||||
| 	struct | ||||
| 	{ | ||||
| @ -174,6 +178,7 @@ struct qse_sed_adr_t | ||||
| struct qse_sed_cmd_t | ||||
| { | ||||
| 	qse_char_t type; | ||||
| 	qse_size_t lnum; | ||||
|  | ||||
| 	int negated; | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user