+2014-03-10 Daiki Ueno <ueno@gnu.org>
+
+ php: Recognize single and double quotes around heredoc label
+ Problem reported by Byrial Jensen in:
+ <https://lists.gnu.org/archive/html/bug-gettext/2012-04/msg00001.html>.
+ Based on the patch by Andreas Stricker posted as:
+ <https://lists.gnu.org/archive/html/bug-gettext/2012-04/msg00002.html>.
+ * x-php.c (phase4_get): Strip quotes around heredoc label.
+
2013-11-20 Daiki Ueno <ueno@gnu.org>
xgettext: Add E4X support to JavaScript scanner
int c3 = phase1_getc ();
if (c3 == '<')
{
- /* Start of here document.
+ int label_start = 0;
+
+ /* Start of here and now document.
Parse whitespace, then label, then newline. */
do
c = phase3_getc ();
c = phase3_getc ();
}
while (c != EOF && c != '\n' && c != '\r');
- /* buffer[0..bufpos-1] now contains the label. */
+ /* buffer[0..bufpos-1] now contains the label
+ (including single or double quotes). */
+
+ if (*buffer == '\'' || *buffer == '"')
+ {
+ label_start++;
+ bufpos--;
+ }
/* Now skip the here document. */
for (;;)
break;
if (c == '\n' || c == '\r')
{
- int bufidx = 0;
+ int bufidx = label_start;
while (bufidx < bufpos)
{
+2014-03-10 Daiki Ueno <ueno@gnu.org>
+
+ php: Recognize single and double quotes around heredoc label
+ * xgettext-php-2: Add test cases to check quoted heredoc labels.
+
2014-03-10 Daiki Ueno <ueno@gnu.org>
Remove unnecessary temporary file cleanup code.
${XGETTEXT} --omit-header --no-location -d xg-ph-2.tmp xg-ph-2.php || exit 1
LC_ALL=C tr -d '\r' < xg-ph-2.tmp.po > xg-ph-2.po || exit 1
+sed 's!<<<EOTMARKER!<<<"EOTMARKER"!' xg-ph-2.php > xg-ph-2d.php || exit 1
+sed "s!<<<EOTMARKER!<<<'EOTMARKER'!" xg-ph-2.php > xg-ph-2s.php || exit 1
+
+: ${XGETTEXT=xgettext}
+
+${XGETTEXT} --omit-header --no-location -d xg-ph-2.tmp xg-ph-2.php || exit 1
+LC_ALL=C tr -d '\r' < xg-ph-2.tmp.po > xg-ph-2.po || exit 1
+
+${XGETTEXT} --omit-header --no-location -d xg-ph-2d.tmp xg-ph-2d.php || exit 1
+LC_ALL=C tr -d '\r' < xg-ph-2d.tmp.po > xg-ph-2d.po || exit 1
+
+${XGETTEXT} --omit-header --no-location -d xg-ph-2s.tmp xg-ph-2s.php || exit 1
+LC_ALL=C tr -d '\r' < xg-ph-2s.tmp.po > xg-ph-2s.po || exit 1
+
cat <<EOF > xg-ph-2.ok
msgid "Egyptians"
msgstr ""
EOF
: ${DIFF=diff}
+
${DIFF} xg-ph-2.ok xg-ph-2.po
result=$?
+test $result = 0 || exit $result
+
+${DIFF} xg-ph-2.ok xg-ph-2d.po
+result=$?
+test $result = 0 || exit $result
+
+${DIFF} xg-ph-2.ok xg-ph-2s.po
+result=$?
+test $result = 0 || exit $result
exit $result