1/**
2 * \file libyasm/parser.h
3 * \brief YASM parser module interface.
4 *
5 * \license
6 *  Copyright (C) 2001-2007  Peter Johnson
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 * \endlicense
29 */
30#ifndef YASM_PARSER_H
31#define YASM_PARSER_H
32
33/** YASM parser module interface.  The "front end" of the assembler. */
34typedef struct yasm_parser_module {
35    /** One-line description of the parser */
36    const char *name;
37
38    /** Keyword used to select parser on the command line */
39    const char *keyword;
40
41    /** NULL-terminated list of preprocessors that are valid to use with this
42     * parser.  The raw preprocessor (raw_preproc) should always be in this
43     * list so it's always possible to have no preprocessing done.
44     */
45    const char **preproc_keywords;
46
47    /** Default preprocessor. */
48    const char *default_preproc_keyword;
49
50    /** NULL-terminated list of standard macro lookups.  NULL if none. */
51    const yasm_stdmac *stdmacs;
52
53    /** Parse a source file into an object.
54     * \param object    object to parse into (already created)
55     * \param pp        preprocessor
56     * \param save_input        nonzero if the parser should save the original
57     *                          lines of source into the object's linemap (via
58     *                          yasm_linemap_add_data()).
59     * \param errwarns  error/warning set
60     * \note Parse errors and warnings are stored into errwarns.
61     */
62    void (*do_parse)
63        (yasm_object *object, yasm_preproc *pp, int save_input,
64         yasm_linemap *linemap, yasm_errwarns *errwarns);
65} yasm_parser_module;
66
67#endif
68