From 968f0d943e65e252f07bdc6b9eebf93751af4a7b Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Tue, 20 Dec 2022 17:52:26 +0000 Subject: [PATCH] Catch unrecognised compiler directives in the compiler scanner. Normally the preprocessor will catch these and report them as undefined macros. But in case the compiler is run without the preprocessor, also catch them in the compiler scanner. This will ensure the scanner properly rejects directives that have additional garbage characters tacked on the end. --- lexor.lex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lexor.lex b/lexor.lex index 74e3ca983..e13b680bb 100644 --- a/lexor.lex +++ b/lexor.lex @@ -894,6 +894,11 @@ TU [munpf] << endl; } +`[a-zA-Z_]+ { + yywarn(yylloc, "macro replacement not supported. " + "Use an external preprocessor."); + } + `{W} { cerr << yylloc.text << ":" << yylloc.first_line << ": error: " << "Stray tic (`) here. Perhaps you put white space" << endl;