SDF 2.001: SDF User Guide: Escaping Symbols

Contents | Parent Topic | Previous Topic | Next Topic
Home | Catalog

# 6.8. Escaping Symbols

## 6.8.1. Special Characters at the Start of a Line

To escape a special character at the start of a line, precede it with a backslash character (\).

## 6.8.2. Tag Delimiters

Like special characters, any special pattern at the start of a line can be escaped by preceding it with a backslash character (\).

Consider the following example:

       Important:

This paragraph has a tag called Important and has no text. sdf will warn you if it finds an unknown tag so most unintentional errors like this are detected. You can escape the pattern like this:

       \Important:

Other workarounds are:

       :Important:
       N:Important:

## 6.8.3. Special Symbols

SDF uses a number of special symbols inside paragraphs:

- A-Z< and > - delimit concise phrases
- {{ and }} - delimit verbose phrases
- [[ and ]] - delimit expressions (e.g. variables).

If you need to include one of these symbols in a paragraph, use the appropriate escape as shown below.

        Symbol      Escape
        <           E<lt>
        >           E<gt>
        {{          E<2{>
        }}          E<2}>
        [[          E<2[>
        ]]          E<2]>

Note the following rules:

1. It isn't necessary to escape any symbols within:
   - paragraphs tagged with the V style or > tag
   - paragraphs given the verbatim attribute
   - paragraphs within a verbatim block
2. It is only necessary to escape a < when it appears after a capital letter.
3. It is only necessary to escape a > inside a concise phrase. In particular, > is implicitly escaped within a verbose phrase.

## 6.8.4. Phrase Parsing Rules

For paragraphs which do not have the verbatim attribute set, the parsing rules for the paragraph text are:

1. Expressions embedded in [[ and ]] are recursively expanded
2. Verbose phrases embedded in {{ and }} are recursively expanded to concise phrases with a V tag.
3. Concise phrases are parsed.

## 6.8.5. Multi-line Macros

!-style macros can be continued onto the next line by ending the line with a backslash character (\). To escape this backslash, use another one. If N backslash characters are found at the end of a line where N is greater than 2, then that line is terminated by N-1 backslash characters and the macro is continued onto the next line.

## 6.8.6. Embedded Expressions

As expressions embedded within text are terminated by the ]\] symbol, expressions cannot contain this character sequence. If you need this sequence within an expression, there is usually a simple workaround you can use. For example:

1. use a space character (i.e. $a[$b[1]] becomes $a[$b[1] ])
2. use string concatentation (i.e. "]]" becomes "]"."]").

## 6.8.7. Semi-Colons Within Attributes

If you need to include a real semi-colon within an attribute or parameter, use two semi-colons. In general, if you need to include a sequence of N semi-colons in an attribute expression, use N+1 semi-colons. For example:

    To install {{P[index="myApp;;install:myApp"]myApp}}, ...

In this case, the value of index is myApp;install:myApp.