mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 07:33:01 +00:00 
			
		
		
		
	| @@ -369,19 +369,23 @@ tail: | ||||
|             s->mode = oldmode; | ||||
|             if (!result) return NULL; | ||||
|  | ||||
|             Janet cap; | ||||
|             Janet cap = janet_wrap_nil(); | ||||
|             Janet constant = s->constants[rule[2]]; | ||||
|             switch (janet_type(constant)) { | ||||
|                 default: | ||||
|                     cap = constant; | ||||
|                     break; | ||||
|                 case JANET_STRUCT: | ||||
|                     cap = janet_struct_get(janet_unwrap_struct(constant), | ||||
|                                            s->captures->data[s->captures->count - 1]); | ||||
|                     if (s->captures->count) { | ||||
|                         cap = janet_struct_get(janet_unwrap_struct(constant), | ||||
|                                                s->captures->data[s->captures->count - 1]); | ||||
|                     } | ||||
|                     break; | ||||
|                 case JANET_TABLE: | ||||
|                     cap = janet_table_get(janet_unwrap_table(constant), | ||||
|                                           s->captures->data[s->captures->count - 1]); | ||||
|                     if (s->captures->count) { | ||||
|                         cap = janet_table_get(janet_unwrap_table(constant), | ||||
|                                               s->captures->data[s->captures->count - 1]); | ||||
|                     } | ||||
|                     break; | ||||
|                 case JANET_CFUNCTION: | ||||
|                     cap = janet_unwrap_cfunction(constant)(s->captures->count - cs.cap, | ||||
|   | ||||
| @@ -112,4 +112,9 @@ | ||||
| (assert (= false (and false false)) "and 1") | ||||
| (assert (= false (or false false)) "or 1") | ||||
|  | ||||
| # #300 Regression test | ||||
|  | ||||
| # Just don't segfault | ||||
| (assert (peg/match '{:main (replace "S" {"S" :spade})} "S7") "regression #300") | ||||
|  | ||||
| (end-suite) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose