Acting on Control Information

When parsing the RTF stream, the RTF reader should follow this process:

1.1.Read the next character.

2.2.If the character is an opening brace ( char == '{' ), store the current state on the stack.

Or if the current state does not change, then continue.

3.3.If the character is a closing brace ( char == '}' ), retrieve the current state from the stack.

Generally, this will change the state.

4.4.If the character is a backslash ( char == '\' ), collect the RTF statement or control symbol and its parameter.

5.a.If there is one, look up the statement or symbol in the symbol table (a constant table) and act according to the description found there.\sgmlli2p The parameter is left available for use by the action.

6.b.Leave a read pointer before or after the delimiter, as appropriate.

7.c.After completing the action, continue.\sgmlli2p The different actions are listed in the next section.

1.5.Otherwise, if the character is anything other than {, }, or \, write the plain text character to the current destination using the current formatting properties.

2.6.Read the next character.