/* * Mimas conversion tools * * Copyright (C) 2010 Benjamin Moody * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ typedef struct _parse_node { unsigned int type; char *strval; long int longval; symbol *symval; struct _parse_node *left; struct _parse_node *right; } parse_node; /* Parsing flags */ enum { PARSE_INCLUDE_EMPTY_LINES = 0x0001, PARSE_INCLUDE_EMPTY_COMMENTS = 0x0002, PARSE_REFLOW_COMMENTS = 0x0004, PARSE_ZMASM_LABELS = 0x0008, PARSE_OCTAL_AT = 0x0010, PARSE_NO_PRECEDENCE = 0x0020, PARSE_ROMCALLS_NO_UNDERSCORE = 0x0040, PARSE_ORG_IS_RORG = 0x0080 }; /* Pseudo-expression/token types */ enum { XX_EOL = 1024, XX_LPAREN, XX_RPAREN, XX_LBRACK, XX_RBRACK, XX_COMMA, XX_LOGAND, XX_LOGOR, XX_STRING }; int is_whitespace(int c); int is_wc(int c); parse_node *new_parse_node(unsigned int type); parse_node *new_parse_node_long(unsigned int type, long int longval); parse_node *parse_expr_list(const char **in, symbol_tab *stab, unsigned int flags); parse_node *parse_label(const char *name, symbol_tab *stab, unsigned int flags); void free_parse_tree(parse_node *n); parse_node *dup_parse_tree(const parse_node *n);