enhanced vlist reading
This commit is contained in:
		| @ -630,7 +630,6 @@ typedef struct hcl_frd_t hcl_frd_t; | |||||||
| struct hcl_frd_t | struct hcl_frd_t | ||||||
| { | { | ||||||
| 	int level; | 	int level; | ||||||
| 	int data_list_level; |  | ||||||
| 	int flagv; | 	int flagv; | ||||||
| 	int expect_include_file; | 	int expect_include_file; | ||||||
| 	int expect_vlist_item; | 	int expect_vlist_item; | ||||||
|  | |||||||
							
								
								
									
										30
									
								
								lib/read.c
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								lib/read.c
									
									
									
									
									
								
							| @ -1911,7 +1911,6 @@ static hcl_cnode_t* read_object (hcl_t* hcl) | |||||||
| 				 * a list literal or an array literal */ | 				 * a list literal or an array literal */ | ||||||
| 				if (enter_list(hcl, TOKEN_LOC(hcl), flagv) <= -1) goto oops; | 				if (enter_list(hcl, TOKEN_LOC(hcl), flagv) <= -1) goto oops; | ||||||
| 				level++; | 				level++; | ||||||
| 				if (flagv & DATA_LIST) data_list_level++; |  | ||||||
|  |  | ||||||
| 				/* read the next token */ | 				/* read the next token */ | ||||||
| 				GET_TOKEN_WITH_GOTO (hcl, oops); | 				GET_TOKEN_WITH_GOTO (hcl, oops); | ||||||
| @ -2013,14 +2012,11 @@ static hcl_cnode_t* read_object (hcl_t* hcl) | |||||||
| 				obj = leave_list(hcl, &flagv, &oldflagv); | 				obj = leave_list(hcl, &flagv, &oldflagv); | ||||||
|  |  | ||||||
| 				level--; | 				level--; | ||||||
| 				if (oldflagv & DATA_LIST) data_list_level--; |  | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			case HCL_IOTOK_VBAR: | 			case HCL_IOTOK_VBAR: | ||||||
| /* TODO: think wheter to allow | | inside a quoted list... */ | 				if (hcl->c->r.st && (hcl->c->r.st->flagv & DATA_LIST)) | ||||||
| /* TODO: revise this part ... */ |  | ||||||
| 				if (data_list_level > 0) /* TODO: this check is wrong... i think .. */ |  | ||||||
| 				{ | 				{ | ||||||
| 					hcl_setsynerr (hcl, HCL_SYNERR_VBARBANNED, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); | 					hcl_setsynerr (hcl, HCL_SYNERR_VBARBANNED, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); | ||||||
| 					goto oops; | 					goto oops; | ||||||
| @ -2158,8 +2154,6 @@ static hcl_cnode_t* read_object (hcl_t* hcl) | |||||||
|  |  | ||||||
| 			/* one level up toward the top */ | 			/* one level up toward the top */ | ||||||
| 			level--; | 			level--; | ||||||
|  |  | ||||||
| 			if (oldflagv & DATA_LIST) data_list_level--; |  | ||||||
| 		} | 		} | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @ -2183,7 +2177,6 @@ static hcl_cnode_t* read_object (hcl_t* hcl) | |||||||
|  |  | ||||||
| 	/* upon exit, we must be at the top level */ | 	/* upon exit, we must be at the top level */ | ||||||
| 	HCL_ASSERT (hcl, level == 0); | 	HCL_ASSERT (hcl, level == 0); | ||||||
| 	HCL_ASSERT (hcl, data_list_level == 0); |  | ||||||
|  |  | ||||||
| 	HCL_ASSERT (hcl, hcl->c->r.st == HCL_NULL); | 	HCL_ASSERT (hcl, hcl->c->r.st == HCL_NULL); | ||||||
| 	HCL_ASSERT (hcl, obj != HCL_NULL); | 	HCL_ASSERT (hcl, obj != HCL_NULL); | ||||||
| @ -2408,8 +2401,9 @@ static int feed_process_token (hcl_t* hcl) | |||||||
| 				 *   it allows only variable names. | 				 *   it allows only variable names. | ||||||
| 				 *   it prohibits nesting of other lists | 				 *   it prohibits nesting of other lists | ||||||
| 				 */ | 				 */ | ||||||
| 				if (frd->data_list_level > 0) /* TODO: this check is wrong... i think .. */ | 				if (hcl->c->r.st && (hcl->c->r.st->flagv & DATA_LIST)) | ||||||
| 				{ | 				{ | ||||||
|  | 					/* if the outer list is a data list */ | ||||||
| 					hcl_setsynerr (hcl, HCL_SYNERR_VBARBANNED, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); | 					hcl_setsynerr (hcl, HCL_SYNERR_VBARBANNED, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); | ||||||
| 					goto oops; | 					goto oops; | ||||||
| 				} | 				} | ||||||
| @ -2462,7 +2456,6 @@ static int feed_process_token (hcl_t* hcl) | |||||||
| 			 * a list literal or an array literal */ | 			 * a list literal or an array literal */ | ||||||
| 			if (enter_list(hcl, TOKEN_LOC(hcl), frd->flagv) <= -1) goto oops; | 			if (enter_list(hcl, TOKEN_LOC(hcl), frd->flagv) <= -1) goto oops; | ||||||
| 			frd->level++; | 			frd->level++; | ||||||
| 			if (frd->flagv & DATA_LIST) frd->data_list_level++; |  | ||||||
|  |  | ||||||
| 			/* read the next token */ | 			/* read the next token */ | ||||||
| 			goto ok; | 			goto ok; | ||||||
| @ -2559,23 +2552,9 @@ static int feed_process_token (hcl_t* hcl) | |||||||
| #endif | #endif | ||||||
| 			frd->obj = leave_list(hcl, &frd->flagv, &oldflagv); | 			frd->obj = leave_list(hcl, &frd->flagv, &oldflagv); | ||||||
| 			frd->level--; | 			frd->level--; | ||||||
| 			if (oldflagv & DATA_LIST) frd->data_list_level--; |  | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| #if 0 |  | ||||||
| 		case HCL_IOTOK_VBAR: |  | ||||||
| /* TODO: think wheter to allow | | inside a quoted list... */ |  | ||||||
| /* TODO: revise this part ... */ |  | ||||||
| 			if (frd->data_list_level > 0) /* TODO: this check is wrong... i think .. */ |  | ||||||
| 			{ |  | ||||||
| 				hcl_setsynerr (hcl, HCL_SYNERR_VBARBANNED, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); |  | ||||||
| 				goto oops; |  | ||||||
| 			} |  | ||||||
| 			frd->obj = read_vlist(hcl); |  | ||||||
| 			break; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| 		case HCL_IOTOK_NIL: | 		case HCL_IOTOK_NIL: | ||||||
| 			frd->obj = hcl_makecnodenil(hcl, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); | 			frd->obj = hcl_makecnodenil(hcl, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); | ||||||
| 			break; | 			break; | ||||||
| @ -2705,8 +2684,6 @@ static int feed_process_token (hcl_t* hcl) | |||||||
|  |  | ||||||
| 		/* one frd->level up toward the top */ | 		/* one frd->level up toward the top */ | ||||||
| 		frd->level--; | 		frd->level--; | ||||||
|  |  | ||||||
| 		if (oldflagv & DATA_LIST) frd->data_list_level--; |  | ||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @ -2718,7 +2695,6 @@ static int feed_process_token (hcl_t* hcl) | |||||||
|  |  | ||||||
| 		/* upon exit, we must be at the top level */ | 		/* upon exit, we must be at the top level */ | ||||||
| 		HCL_ASSERT (hcl, frd->level == 0); | 		HCL_ASSERT (hcl, frd->level == 0); | ||||||
| 		HCL_ASSERT (hcl, frd->data_list_level == 0); |  | ||||||
|  |  | ||||||
| 		HCL_ASSERT (hcl, hcl->c->r.st == HCL_NULL); | 		HCL_ASSERT (hcl, hcl->c->r.st == HCL_NULL); | ||||||
| 		HCL_ASSERT (hcl, frd->obj != HCL_NULL); | 		HCL_ASSERT (hcl, frd->obj != HCL_NULL); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user