===== Null literal
null
-----
null
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$Null"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
/>

===== Property access
model -> $model.get(`T:others`)
-----
model -> $model.get(`T:others`)
===== Boolean expressions
$isIgnored or $a == $b and $c == "foobar" || $x == 42 && !(true==false)
-----
$isIgnored or $a == $b and $c == "foobar" or $x == 42.0 and !(true == false)
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$Or"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
>
  <var name="isIgnored"/>
  <and>
    <eq>
      <var name="a"/>
      <var name="b"/>
    </eq>
    <eq>
      <var name="c"/>
      <string value="foobar"/>
    </eq>
  </and>
  <and>
    <eq>
      <var name="x"/>
      <number value="42.0"/>
    </eq>
    <not>
      <eq>
        <true/>
        <false/>
      </eq>
    </not>
  </and>
</config>

===== Model literals
all(`my.module:MyType`)
  .filter(x -> $x.get(`T:other`).get(`TLObject:tType`).get(`TLType:module`)==`other.module`)
  .filter(y -> $y.get(`T:ref`) == `my.module:OtherType#part`)
-----
all(`my.module:MyType`).filter(x -> $x.get(`T:other`).get(`TLObject:tType`).get(`TLType:module`) == `other.module`).filter(y -> $y.get(`T:ref`) == `my.module:OtherType#part`)
===== Singleton literal
`my.package#SINGLETON`
-----
`my.package#SINGLETON`
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$SingletonLiteral"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
  module="my.package"
  name="SINGLETON"
/>

===== TLEnumeration literal
`my.package:my.type#my.constant`
-----
`my.package:my.type#my.constant`
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$PartLiteral"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
  module="my.package"
  name="my.constant"
  type="my.type"
/>

===== Legacy TLEnumeration literal
`my.package:my.type#1`
-----
`my.package:my.type#1`
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$PartLiteral"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
  module="my.package"
  name="1"
  type="my.type"
/>

===== Resource key reference
#"my.resource.key"
-----
#"my.resource.key"
-----
<config key="my.resource.key"
  config:interface="com.top_logic.model.search.expr.config.dom.Expr$ResKeyReference"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
/>

===== Resource key reference with single quotes
#'my.resource.key'
-----
#"my.resource.key"
-----
<config key="my.resource.key"
  config:interface="com.top_logic.model.search.expr.config.dom.Expr$ResKeyReference"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
/>

===== Literal resource key
#('Hallo Welt!'@de, "Hello world!"@en)
-----
#("Hallo Welt!"@de, "Hello world!"@en)
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$ResKeyLiteral"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
>
  <value
    lang="de"
    text="Hallo Welt!"
  />
  <value
    lang="en"
    text="Hello world!"
  />
</config>

===== Literal resource key with single translation
'Hallo Welt!'@de
-----
#("Hallo Welt!"@de)
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$ResKeyLiteral"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
>
  <value
    lang="de"
    text="Hallo Welt!"
  />
</config>

===== Tuples
tuple(
	a -> all(`test:A`), 
	b? -> all(`test:B`).filter(
		x -> $a.get(`test:A#values`).contains(
			$x.get(`test:B#value`))))
-----
tuple(a -> all(`test:A`), b? -> all(`test:B`).filter(x -> $a.get(`test:A#values`).contains($x.get(`test:B#value`))))
===== HTML
x -> foo({{{<p class="important {$css}">Some value <b>'{$x}'</b> being output.</p>}}})
-----
x -> foo({{{<p class="important {$css}">Some value <b>'{$x}'</b> being output.</p>}}})
===== ValidHTML
{{{<div><div class="foo"/><div>text<br/><p><i>italics</i></p></div></div>}}}
-----
{{{<div><div class="foo"/><div>text<br/><p><i>italics</i></p></div></div>}}}
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$Html"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
>
  <start tag="div"/>
  <start
    empty="true"
    tag="div"
  >
    <attribute name="class">
      <text value="foo"/>
    </attribute>
  </start>
  <start tag="div"/>
  <text value="text"/>
  <start
    empty="true"
    tag="br"
  />
  <start tag="p"/>
  <start tag="i"/>
  <text value="italics"/>
  <end tag="i"/>
  <end tag="p"/>
  <end tag="div"/>
  <end tag="div"/>
</config>
===== Complex Scenario
model ->
  all(`tl.graph.demo:A`)
    .filter(y ->
      $y.get(`T:owner`).contains($model) and
      $y.get(`T:ref`).instanceOf(`tl.graph.demo:C`)
    )
    .map(z -> $z.get(`T:other`))
-----
model -> all(`tl.graph.demo:A`).filter(y -> $y.get(`T:owner`).contains($model) and $y.get(`T:ref`).instanceOf(`tl.graph.demo:C`)).map(z -> $z.get(`T:other`))
===== String quoting
concat("Some \"String\" with \\", 'Some \"String\"', 'Some "String"', 'Some \'String\'')
-----
concat("Some \"String\" with \\", "Some \"String\"", "Some \"String\"", "Some 'String'")
===== Function application
(obj -> {$obj.set(`my:Type#attr`, "initial-value"); $obj; })(new(`my:Type`))
-----
(obj -> {$obj.set(`my:Type#attr`, "initial-value"); $obj; })(new(`my:Type`))
===== Call chaining
new(`my:Type`)..set(`my:Type#attr1`, "initial-value1")..set(`my:Type#attr2`, "initial-value2")
-----
new(`my:Type`)..set(`my:Type#attr1`, "initial-value1")..set(`my:Type#attr2`, "initial-value2")
===== Complex instantiation
$outer.set(`my:Type#others`, 
	$values.map(
		val -> ((other -> {$other.set(`my:Other#val`, $val); $other; })(new(`my:Other`)))))
-----
$outer.set(`my:Type#others`, $values.map(val -> (other -> {$other.set(`my:Other#val`, $val); $other; })(new(`my:Other`))))
===== Blocks with side-effects
all(`my.module:A`)
	.filter(x -> $x.instanceOf(`my.module:B`))
	.foreach(y -> 
		(foovalue -> 
			{
				$y.set(`my.module:B#foo`, $y.get(`my.module:B#bar`));
				$y.set(`my.module:B#bar`, $foovalue);
			}
		).apply($y.get(`my.module:B#foo`)))
-----
all(`my.module:A`).filter(x -> $x.instanceOf(`my.module:B`)).foreach(y -> (foovalue -> {$y.set(`my.module:B#foo`, $y.get(`my.module:B#bar`)); $y.set(`my.module:B#bar`, $foovalue); }).apply($y.get(`my.module:B#foo`)))
===== Zero fragment
x->$x.reduce(0.1, c->d->$c + $d)
-----
x -> $x.reduce(0.1, c -> d -> $c + $d)
===== Variable assignment
$outer.set(`my:Type#others`, 
	$values.map(
		val -> {other = new(`my:Other`); $other.set(`my:Other#val`, $val); $other; } ))
-----
$outer.set(`my:Type#others`, $values.map(val -> {other = new(`my:Other`); $other.set(`my:Other#val`, $val); $other; }))
