/* ----------------------------------------------------------------------- * * * Copyright 1996-2020 The NASM Authors - All Rights Reserved * See the file AUTHORS included with the NASM distribution for * the specific copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following * conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ----------------------------------------------------------------------- */ /* * parser.c source line parser for the Netwide Assembler */ #include "compiler.h" #include "nctype.h" #include "nasm.h" #include "insns.h" #include "nasmlib.h" #include "error.h" #include "stdscan.h" #include "eval.h" #include "parser.h" #include "floats.h" #include "assemble.h" #include "tables.h" static int end_expression_next(void); static struct tokenval tokval; static int prefix_slot(int prefix) { … } static void process_size_override(insn *result, operand *op) { … } /* * Brace decorators are are parsed here. opmask and zeroing * decorators can be placed in any order. e.g. zmm1 {k2}{z} or zmm2 * {z}{k3} decorator(s) are placed at the end of an operand. */ static bool parse_braces(decoflags_t *decoflags) { … } static inline unused_func const expr *next_expr(const expr *e, const expr **next_list) { … } static inline void init_operand(operand *op) { … } static int parse_mref(operand *op, const expr *e) { … } static void mref_set_optype(operand *op) { … } /* * Convert an expression vector returned from evaluate() into an * extop structure. Return zero on success. Note that the eop * already has dup and elem set, so we can't clear it here. */ static int value_to_extop(expr *vect, extop *eop, int32_t myseg) { … } /* * Parse an extended expression, used by db et al. "elem" is the element * size; initially comes from the specific opcode (e.g. db == 1) but * can be overridden. */ static int parse_eops(extop **result, bool critical, int elem) { … } insn *parse_line(char *buffer, insn *result) { … } static int end_expression_next(void) { … } static void free_eops(extop *e) { … } void cleanup_insn(insn * i) { … }