bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #57927] "warning: RegExp literal terminated too early" when parsing


From: Vaclav Slavik
Subject: [bug #57927] "warning: RegExp literal terminated too early" when parsing some JSX files
Date: Sat, 29 Feb 2020 09:58:05 -0500 (EST)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15

URL:
  <https://savannah.gnu.org/bugs/?57927>

                 Summary: "warning: RegExp literal terminated too early" when
parsing some JSX files
                 Project: GNU gettext
            Submitted by: vslavik
            Submitted on: Sat 29 Feb 2020 02:58:03 PM UTC
                Category: JavaScript
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

I struggle to describe the circumstances more meaningfully. Originally I
assumed JSX syntax isn't supported at all, which I now know is not the case,
but some tiny changes to otherwise parseable JSX files cause xgettext to
complain that "RegExp literal terminated too early" and ignore all subsequent
extractable strings. 

On this file (both also attached), xgettext throws the above error:

--------
export function funcName() {
    return <a>{ 'x' }</a>;
}
_('one');
--------

On this one, however, it does *not*, it is working:

--------
export function funcName() {
    a = <a>{ 'x' }</a>;
}
_('one');
--------

(Changing the 2nd line to read "a <a>{ 'x' }</a>;" again causes the error, but
that wouldn't be valid JS code; it does seem to indicate that the '=' token is
relevant to the bug, though.)

It is not the same underlying cause as #56848 - I reproduced with that fix
applied too.

Originally reported at https://github.com/vslavik/poedit/issues/601 by Micha
Rohde who did all the work on minimizing the reproduction samples.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sat 29 Feb 2020 02:58:03 PM UTC  Name: broken.js  Size: 68B   By:
vslavik

<http://savannah.gnu.org/bugs/download.php?file_id=48524>
-------------------------------------------------------
Date: Sat 29 Feb 2020 02:58:03 PM UTC  Name: working.js  Size: 65B   By:
vslavik

<http://savannah.gnu.org/bugs/download.php?file_id=48525>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57927>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]