From bb0fb885b8f996545cdc5eac67aab8c9bb6a2ce3 Mon Sep 17 00:00:00 2001 From: Zach Laine Date: Thu, 31 Oct 2024 23:25:56 -0500 Subject: [PATCH] Doc update for previous symbol table changes. Related to #183. --- doc/tutorial.qbk | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/doc/tutorial.qbk b/doc/tutorial.qbk index 72cf7afc..71999adf 100644 --- a/doc/tutorial.qbk +++ b/doc/tutorial.qbk @@ -1126,24 +1126,12 @@ the second `'X'` is recognized by the symbol table parser. However: If we parse again, we find that `"X"` did not stay in the symbol table. The fact that `symbols` was declared const might have given you a hint that this -would happen. Also, notice that the call to `insert()` in the semantic action -uses the parse context; that's where all the symbol table changes are stored -during the parse. +would happen. The full program: [self_filling_symbol_table_example] -[tip _symbols_ also has a call operator that does exactly what -`.insert_for_next_parse()` does. This allows you to chain additions with a -convenient syntax, like this: - -``` - symbols roman_numerals; - roman_numerals.insert_for_next_parse("I", 1)("V", 5)("X", 10); -``` -] - [important _symbols_ stores all its strings in UTF-32 internally. If you do Unicode or ASCII parsing, this will not matter to you at all. If you do non-Unicode parsing of a character encoding that is not a subset of Unicode @@ -1163,6 +1151,11 @@ erase and clear for the current parse, and another that applies only to subsequent parses. The full set of operations can be found in the _symbols_ API docs. +[mpte There are two versions of each of the _symbols_ `*_for_next_parse()` +functions _emdash_ one that takes a context, and one that does not. The one +with the context is meant to be used within a semantic action. The one +without the context is for use outside of any parse.] + [endsect] [section The Parsers And Their Uses]