-
Notifications
You must be signed in to change notification settings - Fork 36
/
pmh_parser_foot.c
42 lines (33 loc) · 1013 Bytes
/
pmh_parser_foot.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* PEG Markdown Highlight
* Copyright 2011-2016 Ali Rantakari -- http://hasseg.org
* Licensed under the GPL2+ and MIT licenses (see LICENSE for more info).
*
* pmh_parser_foot.c
*
* Code to be appended to the end of the parser code generated from the
* PEG grammar.
*/
static void _parse(parser_data *p_data, yyrule start_rule)
{
GREG *g = YY_NAME(parse_new)(p_data);
if (start_rule == NULL)
YY_NAME(parse)(g);
else
YY_NAME(parse_from)(g, start_rule);
YY_NAME(parse_free)(g);
pmh_PRINTF("\n\n");
}
static void parse_markdown(parser_data *p_data)
{
pmh_PRINTF("\nPARSING DOCUMENT: ");
_parse(p_data, NULL);
}
static void parse_references(parser_data *p_data)
{
pmh_PRINTF("\nPARSING REFERENCES: ");
p_data->parsing_only_references = true;
_parse(p_data, yy_References);
p_data->parsing_only_references = false;
p_data->references = p_data->head_elems[pmh_REFERENCE];
p_data->head_elems[pmh_REFERENCE] = NULL;
}