pull saved position into HParserCacheValue and fix segfault in grow()

This commit is contained in:
Sven M. Hallberg 2014-03-17 23:46:14 +01:00
parent 5ee7982596
commit fbdd2b7613
3 changed files with 67 additions and 39 deletions

View file

@ -255,21 +255,17 @@ typedef struct HLeftRec_ {
HRecursionHead *head;
} HLeftRec;
/* Result and remaining input, for rerunning from a cached position. */
typedef struct HCachedResult_ {
HParseResult *result;
HInputStream input_stream;
} HCachedResult;
/* Tagged union for values in the cache: either HLeftRec's (Left) or
* HParseResult's (Right).
* Includes the position (input_stream) to advance to after using this value.
*/
typedef struct HParserCacheValue_t {
HParserCacheValueType value_type;
union {
HLeftRec *left;
HCachedResult *right;
HParseResult *right;
};
HInputStream input_stream;
} HParserCacheValue;
// This file provides the logical inverse of bitreader.c