In order to simplify typing in and reading expressions, CycleServer supports a more relaxed syntax that makes writing simple values easy, while still being possible to unambiguously support all possible expressions. This is called the ”informal syntax”, which is based on the native ClassAd syntax defined in the ClassAd Language Reference Manual.

The primary problem with the strict native syntax is that strings need to be escaped, and special characters need to be quoted. In particularly, Windows-style directory paths need to be escaped. This is tricky for people to remember, and unnecessary in many cases.

This syntax is used in several places, including:

In general, in cases where the delimiters are implied and users have to type in the value, this format should be used. Displayed values should also use the informal syntax, although in some contexts it may be permissible to drop the leading “=” if the fact that it is an expression is indicated otherwise (with italicized text, for instance).

Some simple examples should make it more clear:

Informal Syntax Native Syntax Expression Type
123 123 Integer
3.14159 3.14159 Real
true true Boolean
hello world “hello world” String
c:data “c:data” String
1+2 “1+2” String
#4cbe1bb7-0011-292c0a0f59a9-1 #4cbe1bb7-0011-292c0a0f59a9-1 Identifier
(empty string) undefined Undefined

Here are some more complex examples that use a leading = to denote expressions in the formal syntax:

Informal Syntax Native Syntax Expression Type
=123 123 Integer
=”hello world” “hello world” String
=”c:data” “c:data” String
=”” “” String
=1+2 1+2 Composite
=undefined undefined Undefined
={“c:data1”, “c:data2”} {“c:data1”, “c:data2”} List
={1,2,3} {1,2,3} List
=[Animal=”dog”; Name=”Fido”] [Animal=”dog”; Name=”Fido”] Record
=AbsTime(“2011-01-01 12:34:56”) AbsTime(“2011-01-01 12:34:56”) AbsTime
=RelTime(“1d”) RelTime(“1d”) RelTime

Note

As of version 6.1.0, lists are supported:

Informal Syntax Native Syntax Expression Type
a,123, c {“a”, 123, “c”} List

Syntax

If the value starts with a leading =, then the remainder of the expression is parsed as a native ClassAd expression (note: leading/trailing whitespace is ignored). If it does not, then it is parsed according to the following rules:

  • If it is either “true” or “false”, it is a boolean.
  • If it is the empty string, it is the undefined value.
  • If it consists of numbers, with an optional leading + or -, it is an integer.
  • If it consists of numbers plus a decimal point, it is a real.
  • If it starts with a “#”, it is an identifier.
  • If it contains a ,, it is a list (as of v6.1.0). Each item in the list is interpreted according to these rules.
  • Otherwise it is a string. Backslashes are NOT meaningful.

This means that any given input can be interpreted as only one expression. However, many expressions have multiple representations. For example, you could write the number 123 as 123 or =123. Either one is acceptable as input. However, there is only one canonical representation, as follows:

  • If it is an integer, real, boolean, or identifier, output the native format.
  • If it is a string, and there are no escaped characters in it, output the unescaped, unquoted value.
  • Otherwise, output = and then the native format.

This makes it very easy to serialize expressions to a valid (though not canonical) informal syntax: output = and then the native format.