Since C doesn't have namespaces, renamed result to parse_result.
This commit is contained in:
parent
b6c98d85f2
commit
ab9d48b886
2 changed files with 6 additions and 6 deletions
4
hammer.c
4
hammer.c
|
|
@ -29,12 +29,12 @@ const gchar* to_string(parse_state *ps) {
|
||||||
return g_strescape(ps->input, NULL);
|
return g_strescape(ps->input, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
const result* get_cached(parse_state *ps, const size_t pid); /* {
|
const parse_result* get_cached(parse_state *ps, const size_t pid); /* {
|
||||||
gpointer p = g_hash_table_lookup(ps->cache, &pid);
|
gpointer p = g_hash_table_lookup(ps->cache, &pid);
|
||||||
if (NULL != p)
|
if (NULL != p)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
int put_cached(parse_state *ps, const size_t pid, result cached);
|
int put_cached(parse_state *ps, const size_t pid, parse_result cached);
|
||||||
|
|
||||||
parser *token(const uint8_t *s) { return NULL; }
|
parser *token(const uint8_t *s) { return NULL; }
|
||||||
parser *ch(const uint8_t c) { return NULL; }
|
parser *ch(const uint8_t c) { return NULL; }
|
||||||
|
|
|
||||||
8
hammer.h
8
hammer.h
|
|
@ -8,8 +8,8 @@
|
||||||
* index - current position in input
|
* index - current position in input
|
||||||
* length - size of input
|
* length - size of input
|
||||||
* THE FOLLOWING DESCRIBES HOW JSPARSE DOES IT. OUR MILEAGE MAY VARY.
|
* THE FOLLOWING DESCRIBES HOW JSPARSE DOES IT. OUR MILEAGE MAY VARY.
|
||||||
* cache - a hash table describing the state of the parse, including partial parse
|
* cache - a hash table describing the state of the parse, including partial parse_results.
|
||||||
* results. It's actually a hash table of [parser_id, hash_table[index, result]],
|
* It's actually a hash table of [parser_id, hash_table[index, parse_result]],
|
||||||
* where the parser id is incremented as the parse goes along (parsers that have
|
* where the parser id is incremented as the parse goes along (parsers that have
|
||||||
* already been applied once don't get a new parser_id ... but the global variable
|
* already been applied once don't get a new parser_id ... but the global variable
|
||||||
* still increments? not sure why that is, need to debug some), and the locations
|
* still increments? not sure why that is, need to debug some), and the locations
|
||||||
|
|
@ -27,9 +27,9 @@ typedef struct {
|
||||||
const uint8_t *remaining;
|
const uint8_t *remaining;
|
||||||
const uint8_t *matched;
|
const uint8_t *matched;
|
||||||
const GSequence *ast;
|
const GSequence *ast;
|
||||||
} result;
|
} parse_result;
|
||||||
|
|
||||||
typedef result*(*parser)(parse_state*);
|
typedef parse_result*(*parser)(parse_state*);
|
||||||
|
|
||||||
parser *token(const uint8_t *s);
|
parser *token(const uint8_t *s);
|
||||||
parser *ch(const uint8_t c);
|
parser *ch(const uint8_t c);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue