diff options
| author | Inari Listenmaa <inari.listenmaa@gmail.com> | 2018-05-24 23:10:17 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-24 23:10:17 +0100 |
| commit | a2f9d9d8d5a32e2bf1b8126e371b826151903cde (patch) | |
| tree | 787949a8ff9792b8aaaa5dd1a7b558c6735ac29e | |
| parent | 19c6090e8555fe3d5225f36d481792aaa7e5259f (diff) | |
| parent | 2ae44902e1284270754d177530ea168cf9b11901 (diff) | |
Merge pull request #52 from odanoburu/doc-pre
(refman) update pre syntax
| -rw-r--r-- | doc/gf-refman.html | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/doc/gf-refman.html b/doc/gf-refman.html index 1db2b0a87..19e943c49 100644 --- a/doc/gf-refman.html +++ b/doc/gf-refman.html @@ -1834,7 +1834,7 @@ Some expressions are moreover left- or right-associative. </TR> <TR> <TD>5</TD> -<TD><CODE>pre {"a" ; "an"/vowel}</CODE></TD> +<TD><CODE>pre {vowel => "an" ; _ => "a"}</CODE></TD> <TD>prefix-dependent choice</TD> </TR> <TR> @@ -2264,7 +2264,7 @@ Expressions of type <CODE>Str</CODE> have the following canonical forms: <LI><B>the empty token list</B>, <CODE>[]</CODE> <LI><B>concatenation</B>, <I>s</I> <CODE>++</CODE> <I>t</I>, where <I>s,t</I> : <CODE>Str</CODE> <LI><B>prefix-dependent choice</B>, - <CODE>pre {</CODE> <I>s</I> ; <i>s</i><sub>1</sub> <CODE>/</CODE> <i>p</i><sub>1</sub> ; ... ; <i>s</i><sub>n</sub> <CODE>/</CODE> <i>p</i><sub>n</sub>}, where + <CODE>pre {p<sub>1</sub> => s<sub>1</sub> ; ... ; p<sub>n</sub> => s<sub>n</sub> ; _ => s }, where <UL> <LI><I>s</I>, <i>s</i><sub>1</sub>,...,<i>s</i><sub>n</sub>, <i>p</i><sub>1</sub>,...,<i>p</i><sub>n</sub> : <CODE>Str</CODE> </UL> @@ -2344,13 +2344,16 @@ A prime example of prefix-dependent choice operation is the following approximative expression for the English indefinite article: </P> <PRE> - pre {"a" ; "an" / variants {"a" ; "e" ; "i" ; "o"}} + pre { + ("a" | "e" | "i" | "o") => "an" ; + _ => "a" + } ; </PRE> <P> This expression can be computed in the context of a subsequent token: </P> <UL> -<LI><CODE>pre {</CODE> <I>s</I> ; <i>s</i><sub>1</sub> <CODE>/</CODE> <i>p</i><sub>1</sub> ; ... ; <i>s</i><sub>n</sub> <CODE>/</CODE> <i>p</i><sub>n</sub><CODE>} ++</CODE> <I>t</I> +<LI><CODE>pre {p<sub>1</sub> => s<sub>1</sub> ; ... ; p<sub>n</sub> => s<sub>n</sub> ; _ => s } ++ t</CODE> ==> <UL> <LI><i>s</i><sub>i</sub> for the first <I>i</I> such that the prefix <i>p</i><sub>i</sub> @@ -2375,6 +2378,11 @@ The prefix-dependent choice expression itself may not depend on run-time variables. </P> <P> + <I>There is an older syntax for prefix-dependent choice, + namely: <code>pre { s ; s1 / p1 ; ... ; sn / pn}</code>. This syntax + will not accept strings as patterns.</I> +</P> +<P> <I>In GF prior to 3.0, a specific type</I> <CODE>Strs</CODE> <I>is used for defining prefixes,</I> <I>instead of just</I> <CODE>variants</CODE> <I>of</I> <CODE>Str</CODE>. |
