summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2013-03-01 11:55:00 +0900
committerDaiki Ueno <ueno@gnu.org>2013-03-01 11:56:08 +0900
commit6ddbae3f45b8df75015188dba4dffb1223de50a0 (patch)
tree0ed6a2a2ea79e4c90f777d238790f62a033e1682
parentd0ea5ee79cea236bbefbcacd8fb35b0e35b04b9c (diff)
downloadgettext-python-brace-format.tar.gz
Clarify the comment of Python brace format handling.python-brace-format
-rw-r--r--gettext-tools/src/x-python.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/gettext-tools/src/x-python.c b/gettext-tools/src/x-python.c
index d7efb9f4f..ee911a149 100644
--- a/gettext-tools/src/x-python.c
+++ b/gettext-tools/src/x-python.c
@@ -1799,25 +1799,26 @@ static flag_context_list_table_ty *flag_context_list_table;
the grammar to the compiler.
Normal handling: Look for
- keyword ( ... msgid ... ) after_keyword?
+ keyword '(' ... msgid ... ')' ['.' dot_keyword]
Plural handling: Look for
- keyword ( ... msgid ... msgid_plural ... ) after_keyword?
+ keyword '(' ... msgid ... msgid_plural ... ')' ['.' dot_keyword]
We use recursion because the arguments before msgid or between msgid
and msgid_plural can contain subexpressions of the same form.
- after_keyword represents a method call against a string object.
- For example:
+ dot_keyword is used to represent a method call against a string
+ object. For example:
_("foo {bar} baz").format(bar="bar")
- where keyword is "_" and after_keyword is ".format".
+ where keyword is "_" and dot_keyword is "format".
- If after_keyword is present, we transform the sequence:
- keyword ( ... msgid ... ) after_keyword
+ If dot_keyword is present, we transform the sequence:
+ keyword '(' ... msgid ... ')' '.' dot_keyword
into:
- after_keyword ( keyword ( ... msgid ... ) ) after_keyword
+ '.' dot_keyword '(' keyword '(' ... msgid ... ')' ')' '.' dot_keyword
and scan the sequence again, so that the flag context introduced by
- after_keyword have an effect on the inner context.
+ dot_keyword have an effect on the inner context introduced by
+ keyword. The transformation happens only once for each dot_keyword.
*/