The attached patch allows the .macro_const directive to be used in PIR
files, not just in PASM files. Previous behavior, apparently, was only
to allow the .macro_const directive to be used when in "PASM mode",
which doesn't make much sense, considering that all our low-level work
is done in PIR and we are encouraging new users to learn PIR instead of
PASM.
If people think this is a good idea, I'll implement it and a test or two
for it.
--Andrew Whitworth
Index: compilers/imcc/imcc.l
===================================================================
--- compilers/imcc/imcc.l (revision 28320)
+++ compilers/imcc/imcc.l (working copy)
@@ -421,13 +421,10 @@
">>>=" return SHR_U_ASSIGN;
".=" return CONCAT_ASSIGN;
-<emit,INITIAL>".macro" {
- return read_macro(valp, interp, yyscanner);
- }
-
-<emit>".macro_const" {
+<emit,INITIAL>".macro_const" {
int c;
int start_line;
+ int start_cond = YY_START;
BEGIN(macro);
c = yylex_skip(valp, interp, " ", yyscanner);
@@ -450,10 +447,14 @@
IMCC_INFO(interp)->cur_macro_name = NULL;
- BEGIN(emit);
+ BEGIN(start_cond);
return MACRO;
}
+<emit,INITIAL>".macro" {
+ return read_macro(valp, interp, yyscanner);
+ }
+
<emit,INITIAL>".include" {
const int c = yylex(valp, yyscanner, interp);
if (c != STRINGC)