2 * jmt.h: Earley parser for lenses based on Jim/Mandelbaum transducers
4 * Copyright (C) 2009-2015 David Lutterkort
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * Author: David Lutterkort <lutter@redhat.com>
33 typedef uint32_t ind_t;
37 typedef void (*jmt_traverser)(struct lens *l, size_t start, size_t end,
40 typedef void (*jmt_error)(struct lens *lens, void *data, size_t pos,
41 const char *format, ...);
44 struct jmt_parse *parse;
45 jmt_traverser terminal;
52 struct jmt *jmt_build(struct lens *l);
54 struct jmt_parse *jmt_parse(struct jmt *jmt, const char *text, size_t text_len);
56 void jmt_free_parse(struct jmt_parse *);
58 /* Returns -1 on internal error, 0 on syntax error, 1 on a successful
61 int jmt_visit(struct jmt_visitor *visitor, size_t *len);
63 void jmt_free(struct jmt *jmt);
65 void jmt_dot(struct jmt *jmt, const char *fname);
70 * indent-tabs-mode: nil