Skip to content

Commit a6dbeae

Browse files
committed
RS 3001: string value escapes, empty-string presence, null literal
Core syntax gains a String values section: both quote kinds accept the escape sequences backslash-quote and backslash-backslash, strictly -- no other escape is defined. The empty string is defined as a present, zero-length value, distinct from absence. Null joins the primitive values, and the Instance section records the assignment semantics: an unassigned optional attribute is absent, an explicit null assignment denotes the null value.
1 parent 1e3b7ba commit a6dbeae

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

‎sources/lutaml-lang.adoc‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,39 @@ LutaML supports the following primitive values:
551551
* `Time` (e.g., `2024-01-01T12:00:00+00:00`),
552552
* `Decimal` (e.g., `3.14159`),
553553
* `Hash` (e.g., `{ "key": "value" }`)
554+
* `Null` (e.g., `null`)
554555

555556

557+
=== String values
558+
559+
A string value is delimited by double quotes or by single quotes.
560+
561+
The escape sequences `\"` and `\\` are recognized inside both quote
562+
kinds: `\"` denotes the quote character that delimits the string, and
563+
`\\` denotes a backslash. No other escape sequence is defined; a
564+
backslash followed by any other character does not form a string value.
565+
566+
An empty string is distinct from an absent value: `""` denotes a
567+
present string of length zero.
568+
569+
[example]
570+
====
571+
[source,lml]
572+
----
573+
class Glaze {
574+
attribute name, String
575+
attribute description, String
576+
attribute note, String
577+
}
578+
579+
instance "Glaze" {
580+
name = "Raku \"kiln\" fired" // embedded quotes
581+
description = 'say "hi" and \'bye\'' // the other quote kind
582+
note = "" // present, empty
583+
}
584+
----
585+
====
586+
556587
=== Declaration, arguments and blocks
557588

558589
A declaration is a keyword that represents an action or a statement.
@@ -1882,6 +1913,10 @@ An `instance` construct is used to define an instance of a class.
18821913
To assign values to attributes, the attribute name is followed by an equal sign
18831914
and the value.
18841915

1916+
An optional attribute without an assignment is absent. An explicit
1917+
`null` assignment denotes the null value, and an empty string `""`
1918+
denotes a present, empty string.
1919+
18851920
Syntax:
18861921

18871922
[source,lml]

0 commit comments

Comments
 (0)