Reputation: 53
We are trying to decipher some rule syntax and are unsure of its origin.
Here is an example:
(CARS->TYPE='C').and.(CARS->CD_CODE<>'').and.('|'+INVOICE->TYPE+'|'$'|AAA|').and.('|'+SUBSTR(INVOICE->TYPE,1,2)+'|'$'|11|')
Specifically we are trying to understand |
and $
. Can anyone let me know if they have seen similar and elude to the source language or the correct interpretation of the |
and $
?
Upvotes: 5
Views: 209
Reputation: 8587
From it's syntax we can tell it is a "modern" language. Remember "modern" alright ;)
substr
.and.
->
are pretty modern, in compare with cobol and assembling language.
(CARS->TYPE='C').and.(CARS->CD_CODE<>'').and.('|'+INVOICE->TYPE+'|'$'|AAA|').and.('|'+SUBSTR(INVOICE->TYPE,1,2)+'|'$'|11|')
A pseudo code would be something as:
(if car type is 'C'
and
if car cd_code is not empty
and
if invoice type is 'AAA'
and
if invoice type first 2 letters are '11')
then return true
My guess about using $ would be:
= and <> are only when compare against a character
$ when compare array of character, i.e. strings.
(I don't know what the output would be, as it compares the entire invoice type with AAA and even with the first two letters as 11. Maybe you have edited the code before submitting it?)
Fortran 90 would be a guess, but even DBase III maybe.
DBase link: http://lynnbob.com/bob/articles/DBASEIIIPlusLevel2.htm
Fortran link: http://www.ews.uiuc.edu/~mrgates2/docs/fortran.html
For DBASE regarding the pipes...
If you pass parameters, they must be delimited by | | (pipes). The pipes, ||, are required even if no parameters are passed. If you pass parameters, they are delimited within the ||.
Upvotes: 1
Reputation: 235984
Looks like a FORTRAN-ish language. The ->
is not an standard operator though. The |
is just a string (doesn't look like an operator), but the $
certainly looks like an operator, maybe something for specifying string formatting? inferring this cform the fact that it always appears between groups of strings.
Upvotes: 0
Reputation: 146053
My guess: Fortran.
It's a rather complex language now. I don't believe it has a ->
operator but it does seem to have =>
. Perhaps that's a vendor-extension in your snippet.
The pro-Fortran evidence is the .and.
operator.
Upvotes: 0
Reputation: 22476
It's not BASIC, Pascal, C, Java, perl, Python, COBOL, or FORTRAN, that much I can tell you from experience with those languages. It might be helpful to mention what rules engine you're using.
The operation being performed looks a lot like a match operation.
'|' looks like a string literal for the pipe character | , and given the context, it's probably being used as a separator in a flat-file format database sort of like CSV. For example, the plaintext would probably be something like |INVOICETYPE|something|AAA|
Can't help you with the $ operator, though. That could be a variable substitution or a match-anything operation or even a concatenator.
Upvotes: 0