Data Literals

I took a look at the string constructors in XQuery 3.1 and the syntax
is a bit complicated.  I wonder if we really want to do that given our
new focus.

Nevertheless, considering the preference for a data literal is a
sequence of characters passed to a media-specific parser, I think we
can get by with a more "literal" interpretation of that:

1. A data literal is essentially a pair of a media type and string
literal.  The use of a literal makes the syntax very easy to parse.

2. A simple version of this is with a quoted string:

data "application/json" '{"fruit":"orange"}'

3. We probably want multi-line string literals:

data "application/json"
```
{ "fruit" : "orange" }
```

4. That leaves the problem of when you want to include the delimiters
in the string.  We can solve that in a number of ways.  What we
absolutely do not want to do is to make the delimiter user defined.
If we do that, parsing XProc will be hard and not possible with
various parser generator tools.

-- 
--Alex Miłowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics

Received on Friday, 12 February 2016 14:38:02 UTC