Mercurial > hg > index.cgi
diff lwasm/lwasm.h @ 399:6153cb49403c
Initial commit of pragma newsource
pragma newsource enables a source code variant as follows:
1. no line numbers
2. no implied comments at the end of lines
3. all comments must be introduced by a comment character
4. spaces are allowed in operands
(4) is not quite complete. This commit handles "operandless" instructions
(anything where the parser calls skip_operand()) and expression parsing.
author | William Astle <lost@l-w.ca> |
---|---|
date | Tue, 13 Oct 2015 23:38:02 -0600 |
parents | 1ebb5a0b2874 |
children | 4411a6123716 |
line wrap: on
line diff
--- a/lwasm/lwasm.h Sun Oct 11 09:31:06 2015 -0600 +++ b/lwasm/lwasm.h Tue Oct 13 23:38:02 2015 -0600 @@ -102,6 +102,7 @@ PRAGMA_M80EXT = 1 << 21, // enable Macro-80C assembler extensions PRAGMA_6809CONV = 1 << 22, // enable 6809 convenience ops PRAGMA_6309CONV = 1 << 23, // enable 6309 convenience ops + PRAGMA_NEWSOURCE = 1 << 24, // don't use compatibility source format PRAGMA_CLEARBIT = 1 << 31 // reserved to indicate negated pragma flag status }; @@ -444,7 +445,9 @@ lw_expr_t lwasm_parse_expr(asmstate_t *as, char **p); int lwasm_emitexpr(line_t *cl, lw_expr_t expr, int s); -void skip_operand(char **p); +void skip_operand_real(line_t *l, char **p); +/* this macro can only be used where "l" is the current line pointer */ +#define skip_operand(p) skip_operand_real(l, p) int lwasm_lookupreg2(const char *rlist, char **p); int lwasm_lookupreg3(const char *rlist, char **p); @@ -472,4 +475,8 @@ #define OPLEN(op) (((op)>0xFF)?2:1) #define CURPRAGMA(l,p) (((l) && ((l)->pragmas & (p))) ? 1 : 0) +/* some functions for parsing */ +/* skip to the start of the next token if the current parsing mode allows it */ +void lwasm_skip_to_next_token(line_t *cl, char **p); + #endif /* ___lwasm_h_seen___ */