From 6efa2ebd0e44b758740120374d63874beda7ba6a Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 17 Feb 2016 13:11:58 +0100 Subject: simplified "lexer.test..." macros using the $$ return command * this is slightly more efficient than using repeated conditionals * the last :EN does not require a conditional, as its return value can simply be forwarded. * even without $$, this could have been done easier using a once-only loop and breaking out of the loop if :EN fails using :;. The last :EN result is still stored in QReg "_". * :EN could also be used to match header lines if lexer.tes would leave the first line (header line) in some Q-Reg, like the local .[header]. However, repeated :ENs would be necessary as globbing currently does not support {...,...} expansions. Since sooner or later, the header line must be evaluated for some lexer.set macro, this is probably more efficient than the current solution using SciTECO patterns and [lexer.checkheader] could be removed as well. --- lib/lexers/cpp.tes | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'lib/lexers/cpp.tes') diff --git a/lib/lexers/cpp.tes b/lib/lexers/cpp.tes index 1f8f49e..4a3a181 100644 --- a/lib/lexers/cpp.tes +++ b/lib/lexers/cpp.tes @@ -1,19 +1,19 @@ ! C/C++ Lexing ! @[lexer.test.cpp]{ - :EN*.cQ*U.r - Q.r"F :EN*.ccQ*U.r ' - Q.r"F :EN*.cppQ*U.r ' - Q.r"F :EN*.cxxQ*U.r ' - Q.r"F :EN*.hQ*U.r ' - Q.r"F :EN*.hhQ*U.r ' - Q.r"F :EN*.hppQ*U.r ' - Q.r"F :EN*.hxxQ*U.r ' - Q.r"F :EN*.ippQ*U.r ' - Q.r"F :EN*.mQ*U.r ' - Q.r"F :EN*.mmQ*U.r ' - Q.r"F :EN*.smaQ*U.r ' -Q.r} + :EN*.cQ*"S -1 ' + :EN*.ccQ*"S -1 ' + :EN*.cppQ*"S -1 ' + :EN*.cxxQ*"S -1 ' + :EN*.hQ*"S -1 ' + :EN*.hhQ*"S -1 ' + :EN*.hppQ*"S -1 ' + :EN*.hxxQ*"S -1 ' + :EN*.ippQ*"S -1 ' + :EN*.mQ*"S -1 ' + :EN*.mmQ*"S -1 ' + :EN*.smaQ* +} @[lexer.set.cpp]{ ESSETLEXERLANGUAGEcpp -- cgit v1.2.3