Skip to content
Permalink
Browse files

move data type examples to the "data type" page

  • Loading branch information
alandekok committed Aug 8, 2019
1 parent 9d92714 commit 5d9da2819a854f3116d400cb7227c76f1a286186
Showing with 23 additions and 21 deletions.
  1. +23 −0 doc/unlang/data.adoc
  2. +0 −21 doc/unlang/home.adoc
@@ -4,6 +4,29 @@
Unlang supports a number of data types. These data types can be used
in conditional expressions or when assigning a value to an attribute.

The interpreter is flexible when parsing data types. For example, a
particular attribute may be of data type `ipaddr` for IPv4 address.
The interpreter will accept the following strings as valid IPv4 addresses:

`192.168.0.2`:: link:string_unquoted.adoc[Unquoted text], interpreted as the data type

`'192.168.0.2'`:: link:string_single.adoc[Single-quoted string], interpreted as the data type.
+
The single-quoted string form is most useful when the data type
contains special characters that may otherwise confuse the parser.

`"192.168.0.2"`:: link:string_double.adoc[Double-quoted string].
+
The contents of the string are dynamically expanded as described
above. The resulting output is then interpreted as the given data
type.

`{backtick}/bin/echo 192.168.0.2{backtick}`:: link:string_backticks.adoc[backtick-quoted string].
Run a script, and interpret the result as the data type.

Similar processing rules are applied when parsing assignments and
comparisons, for all attributes and data types.

=== Basic Data Types

The following data types are "basic" data types. They are fixed-size,
@@ -99,27 +99,6 @@ restrictions on assignments, so that only valid data types can be
assigned to an attribute. Invalid assignments result in a run-time
error.

The interpreter is flexible when parsing data types. For example, a
particular attribute may be of data type `ipaddr` for IPv4 address.
The interpreter will accept the following strings as valid IPv4 addresses:

`192.168.0.2`:: link:string_unquoted.adoc[Unquoted text], interpreted as the data type

`'192.168.0.2'`:: link:string_single.adoc[Single-quoted string], interpreted as the data type.
The single-quoted string form is most useful when the data type
contains special characters that may otherwise confuse the parser.

`"192.168.0.2"`:: link:string_double.adoc[Double-quoted string].
The contents of the string are dynamically expanded as described
above. The resulting output is then interpreted as the given data
type.

`{backtick}/bin/echo 192.168.0.2{backtick}`:: link:string_backticks.adoc[backtick-quoted string].
Run a script, and interpret the result as the data type.

Similar processing rules are applied when parsing assignments and
comparisons, for all attributes and data types.

.Example
[source,unlang]
----

0 comments on commit 5d9da28

Please sign in to comment.
You can’t perform that action at this time.