From 9f5b3c1d648d727236c4548a83f51a16faabc8d7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 18 Jan 2006 05:35:29 +0000 Subject: [PATCH] Add a note explaining peculiarities of peek_token wrt to scope changes. 2006-01-18 Matthias Clasen * glib/tmpl/scanner.sgml: Add a note explaining peculiarities of peek_token wrt to scope changes. (#307922) --- docs/reference/ChangeLog | 5 +++++ docs/reference/glib/tmpl/scanner.sgml | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 51d51a6..fdcafa7 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,8 @@ +2006-01-18 Matthias Clasen + + * glib/tmpl/scanner.sgml: Add a note explaining peculiarities + of peek_token wrt to scope changes. (#307922) + 2006-01-17 Matthias Clasen * glib/tmpl/memory.sgml: Add a note about casting the results diff --git a/docs/reference/glib/tmpl/scanner.sgml b/docs/reference/glib/tmpl/scanner.sgml index 518fec6..16317be 100644 --- a/docs/reference/glib/tmpl/scanner.sgml +++ b/docs/reference/glib/tmpl/scanner.sgml @@ -9,10 +9,11 @@ a general purpose lexical scanner. The #GScanner and its associated functions provide a general purpose lexical scanner. - + + @@ -259,6 +260,15 @@ The token data is placed in the next_line, and next_position fields of the #GScanner structure. + +Note that, while the token is not removed from the input stream (i.e. +the next call to g_scanner_get_next_token() will return the same token), +it will not be reevaluated. This can lead to surprising results when +changing scope after peeking for the next token. Getting the next token +after switching the scope will return whatever was peeked before, +regardless of any symbols that may have been added or removed in the +new scope. + @scanner: a #GScanner. @Returns: the type of the token. -- 2.7.4