Repository navigation
Conversation
[Medium impact] The PR appears safe to merge; no new blocking issue was established. SummaryAdds built-in
Review conclusions are based on source inspection; tests were not run. Reviews (15) · Last reviewed commit: "doc: add UTR # 24 The Unicon Preprocesso..." · Reviewed by Greptile |
100ab2c to
7ff31a8
Compare
0ab316d to
83681a9
Compare
|
trim() calls to remove whitespace before and after a \ that is "near" the end of a line make me very nervous. Most languages would not accept a \ as a line continuation in a non-final position, and most languages would not quietly concatenate tokens. This is made more complex by the fact that Unicon has a binary backslash operator (limitation), so it is not inconceivable for a Unicon programmer to write The error codes 219 and 220 having identical error messages seems bad. Why two error codes if they are the same? The assert macro syntax ( assert { } vs. C assert() ) throws me for a loop. Is macro syntax more generally not using parentheses but instead using curly brackets? In other situations, Unicon uses { } instead of ( ) very specifically to mean "create co-expressions for each parameter", and overloading the meaning of { } vs. ( ) for asserts or more generally for macros may confuse programmers. |
I initially didn't want to add multi-line support to Macros, but figured it is really useful to be able to split a long macro to multiple lines. But then again, writing long macros is a bad habit in a very high level programming language like Unicon, except I want be able a custom long assert macro and still make it readable. Here is what I possible trade off:
mainly did it so I can differentiate between So error codes 219 and 2020 are used for specially handling to
The new assert macros I'm adding use |
I guess that we are not the bad habit police, and yeah, if we are doing macros with parameters we will have to accept the fact that some folks will want to use it for long macros like in C. If we are going to support C-like $define macros with parameters we had better have pretty similar behavior to C preprocessor while we are at it.
I can live with this, but do we really gotta? If everything was 219, what would that not allow you to do? |
Good point, I adjusted the code to do that; same C semantics.
I dropped 219. 220 allowed me to do a shortcut using the runtime which I discovered I can do in the preprocessor. |
460ce76 to
780c9ce
Compare
A compile error stopped the suite, and the summary still counted every test as passed. Record that failure and continue with the rest. Signed-off-by: Jafar Al-Gharaibeh <[email protected]>
assert and assert_not expand to one if-expression: &null when the check passes, and nothing unless __debug__ or __test__ is set. A program's own assert method is left alone. Signed-off-by: Jafar Al-Gharaibeh <[email protected]>
Cover debug and test builds, release builds, a program's own assert, and -D__test__ on the command line. Signed-off-by: Jafar Al-Gharaibeh <[email protected]>
Report assert and assert_not as error 219, one line with the file and line. A plain runerr(219) keeps the usual banner and traceback. Signed-off-by: Jafar Al-Gharaibeh <[email protected]>
Match the single-line 219 format, including &error conversion and a plain runerr(219). Signed-off-by: Jafar Al-Gharaibeh <[email protected]>
Let a macro call or a $define value continue onto the next line. Argument lists respect brackets, and a continuation stays in its file. Signed-off-by: Jafar Al-Gharaibeh <[email protected]>
Cover multiline macro calls and $define continuations, including the cases that should fail. Signed-off-by: Jafar Al-Gharaibeh <[email protected]>
Describe the preprocessor, including multiline macros and asserts, and index the report. Signed-off-by: Jafar Al-Gharaibeh <[email protected]>
Follow up to #554