NetRexx expressions follow the rules of Rexx. All Rexx operators are valid syntax, with Rexx precedence rules during evaluation. Parentheses can be used, as usual, to alter operator precedence by defining sub-expressions.
The semantics of operators may vary as there is more than one data type and operators can be overloaded (as an implementation detail rather than a language feature) in NetRexx. More specifically, in the case of the 'Rexx' string class provided by NetRexx, the Rexx operators act as defined by the ANSI standard for Rexx (with the single exception that non-strict comparisons are case-independent). For other classes (the binary 'int' type provided by Java, for example) traditional binary arithmetic rules apply.
Terms (the data descriptors in expressions) may be a sub-expression (an expression enclosed in parentheses) or one of the following:
Literals are used to express character strings and numbers:
literal strings e.g., "don't" 'Hello' 'x:' "\x00" numbers e.g., 1 12 12.4 1e-4 1.066E+3
References are terms that refer to variables (local variables within methods, arguments to methods, or properties), methods, arrays, or classes:
simple symbols e.g., Fred I J method calls e.g., Start(x,y) Stop() array references e.g., Dallas[rev] Pooks[12,10] types (classes) e.g., Rexx, java.lang.String, int
Blanks are not permitted between the name of a method and the '(', or between the name of an array reference and the '['.
Simple symbols found in a program can refer to a property in the current class, a local variable, a method in the current class (if it takes no arguments and is not a constructor), a keyword, or a type (class).
The various forms of reference may be combined together with the '.' connector to form compound references. Syntactically, any combination is valid, though some may be invalid semantically. The following are examples of syntactically valid compound references:
myaddress.street list[3].length is.openstream Rexx.x2c('fade') "abc".pos('b')
In general, the semantics of a compound reference follow the rules of Java. A compound reference must start with a string, a sub-expression, a reference or a type, where the type may be qualified (include a package name). Each piece after the next connector can further refine the term, returning a reference or (optionally, if it is the final part of a term) a value. The end result of a term is therefore either a type, a typed object reference, or a typed value.
Blanks are not permitted adjacent to connectors. The parentheses indicating a method call may be omitted in compound references if the method takes no arguments and is not a constructor (optionally, they can be made to be required, using OPTIONS STRICTARGS).
[ previous section | contents | next section ]
From 'netrexx.doc', version 0.75.
Copyright(c) IBM Corporation, 1996. All rights reserved. ©