Re: @Bill: 'alius' question
Bill Yerazunis <[email protected]>
| Newsgroups | gmane.mail.spam.crm114 |
|---|---|
| Message-ID | <[email protected]> |
From: "Ger Hobbelt" <[email protected]> QUICKREF says: alius - if the last bracket-group succeeded, ALIUS skips to end of {} block (a skip, not a FAIL); if the prior group FAILed, ALIUS does nothing. Thus, ALIUS is both an ELSE clause and a CASE statement. How about (for the QUICKREF): alius - if the last bracket-group succeeded, ALIUS skips to the "}" end of THE SMALLEST {} block ENCLOSING THE ALIUS <<<--- NEW!! (a skip, not a FAIL); if the prior group FAILed, ALIUS does nothing. Thus, ALIUS is both an ELSE clause and a CASE statement. [[ reformatting to make it easier for those of us with reading glasses ]] Given code like this: { { a } alius { b } c } d the question is: given a successful 'a', alius will skip. Should it skip to 'c' or 'd'? If codeblock "a" exits with a FAILure (either a CLASSIFY, an EVAL, or an explicit FAIL) then the ALIUS statement should allow codeblock "b" and then codeblock "c" to execute. If codeblock "a" exits successfully (that is, not a FAILure) then the alius statement will skip to the smallest "}" that encloses the ALIUS, which in this case is the "}" before "d". This is so you can do things like the if-then-else and CASE statements by just stacking clauses: { { match "blahblahblah" do this and that.... } alius { match "boogaboogabooga" do that and those... } alius { match "drumdrum" do those and them... } alius { match "redrum" do them and these... } .... repeat as desired... } Basically, each ALIUS can be considered a marker to "try this alternative next ONLY if everything above this failed". To me, the definition in QUICKREF is a little ambiguous. Some existing code (mail*.crm) suggests 'skip to c' i.e. 'skip the subsequent curly-braces block', but since I have been fiddling with the compiler to make it validate scripts in more detail like a good compiler should, I want to be absolutely sure what the original intent was: skip to c or d? d. Does the above change to the QUICKREF make it clearer? - Bill Yerazunis ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/