2
* NASM-compatible parser header file
4
* Copyright (C) 2002-2007 Peter Johnson
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
9
* 1. Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* 2. Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
15
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
16
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
19
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
* POSSIBILITY OF SUCH DAMAGE.
27
#ifndef YASM_NASM_PARSER_H
28
#define YASM_NASM_PARSER_H
30
#include "nasm-parser-struct.h"
32
#define YYCTYPE unsigned char
34
#define MAX_SAVED_LINE_LEN 80
75
NONE /* special token for lookahead */
78
enum nasm_parser_state {
88
#define YYSTYPE nasm_yystype
90
/* shorter access names to commonly used parser_nasm fields */
91
#define p_object (parser_nasm->object)
92
#define p_symtab (parser_nasm->object->symtab)
93
#define cursect (parser_nasm->object->cur_section)
94
#define curtok (parser_nasm->token)
95
#define curval (parser_nasm->tokval)
97
#define INTNUM_val (curval.intn)
98
#define FLTNUM_val (curval.flt)
99
#define DIRECTIVE_NAME_val (curval.str_val)
100
#define FILENAME_val (curval.str_val)
101
#define STRING_val (curval.str)
102
#define SIZE_OVERRIDE_val (curval.int_info)
103
#define DECLARE_DATA_val (curval.int_info)
104
#define RESERVE_SPACE_val (curval.int_info)
105
#define INSN_val (curval.bc)
106
#define PREFIX_val (curval.arch_data)
107
#define REG_val (curval.arch_data)
108
#define REGGROUP_val (curval.arch_data)
109
#define SEGREG_val (curval.arch_data)
110
#define TARGETMOD_val (curval.arch_data)
111
#define ID_val (curval.str_val)
113
#define cur_line (yasm_linemap_get_current(parser_nasm->linemap))
115
#define p_expr_new_tree(l,o,r) yasm_expr_create_tree(l,o,r,cur_line)
116
#define p_expr_new_branch(o,r) yasm_expr_create_branch(o,r,cur_line)
117
#define p_expr_new_ident(r) yasm_expr_create_ident(r,cur_line)
119
void nasm_parser_parse(yasm_parser_nasm *parser_nasm);
120
void nasm_parser_cleanup(yasm_parser_nasm *parser_nasm);
121
int nasm_parser_lex(YYSTYPE *lvalp, yasm_parser_nasm *parser_nasm);