Skip to content

Commit

Permalink
[imcc] document .lex "" limitation. add -d2 for MKCONST
Browse files Browse the repository at this point in the history
Handle GH #1095 .lex corner cases with double-quotes.
Do not use it until refactored.

Add a new -d2 flag to print mk_const strings, useful to find
about quoting and escaping, or not. Was used for LEXER some years ago.
  • Loading branch information
Reini Urban committed Oct 25, 2014
1 parent 9c6fd54 commit 3487984
Show file tree
Hide file tree
Showing 12 changed files with 1,875 additions and 1,549 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
@@ -1,9 +1,11 @@
2014-11-18 release 6.10.0
- Core
+ Add imcc -d2 flag for MKCONST tracing.
- Build
+ Set -mabi=64 for gcc --m=64 on mips, -m64 on powerpc #1110
+ Add --{en,dis}able-static #1104
- Documentation
+ Document .lex "" limitations
- Tests
- Community

Expand Down
3 changes: 1 addition & 2 deletions compilers/imcc/debug.h
Expand Up @@ -7,8 +7,7 @@


#define DEBUG_PARROT 0x0001
/* unused:
#define DEBUG_LEXER 0x0002 */
#define DEBUG_MKCONST 0x0002 /* was DEBUG_LEXER */
#define DEBUG_PARSER 0x0004
#define DEBUG_IMC 0x0008
#define DEBUG_CFG 0x0010
Expand Down
3 changes: 3 additions & 0 deletions compilers/imcc/imcc.y
Expand Up @@ -495,6 +495,8 @@ mk_pmc_const_named(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit),
const_name = mem_sys_strdup(constant);
}

/* That that an empty name here, like .const '' $Pxx = "constant"
can only be a Sub. name_length = 0 matches all */
if ((strncmp(unquoted_name, "Sub", name_length) == 0)
|| (strncmp(unquoted_name, "Coroutine", name_length) == 0)) {
rhs = mk_const(imcc, const_name, 'p');
Expand Down Expand Up @@ -865,6 +867,7 @@ set_lexical(ARGMOD(imc_info_t *imcc), ARGMOD(SymReg *r), ARGMOD(SymReg *name))

r->usage |= U_LEXICAL;

IMCC_debug(imcc, DEBUG_MKCONST, "# .lex '%s'\n", name->name);
if (name == r->reg)
IMCC_fataly(imcc, EXCEPTION_SYNTAX_ERROR,
"register %s already declared as lexical %s", r->name, name->name);
Expand Down

0 comments on commit 3487984

Please sign in to comment.