Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3
    • Fix Version/s: 1.4
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      1

      Description

      Parsing the following JavaScript statement fails with a RecognitionException

      var cssImportRegExp = /\@import\s+(url\()?\s*([^);]+)\s*(\))?([\w, ]*)(;)?/g,
       cssUrlRegExp = /\url\(\s*([^\)]+)\s*\)?/g,
      

        Activity

        Hide
        Evgeny Mandrikov added a comment -

        Root of this problem is "\u" in the second expression, i.e. removal of backslash should allow to proceed with analysis of a file. So here is simpler way to reproduce this problem:

        var r = /\u/;
        

        And in order to show that this regular expression is correct:

        var s = 'O\\uK';
        var r = /\u/g;
        print(s); // O\uK
        print(r); // /\u/g
        print(s.replace(/\u/g, '')); // OK
        

        And indeed - according to ECMAScript Language Specification 5.1 "\u" should not be parsed as beginning of Unicode escape sequence, even if in runtime it can be interpreted as Unicode escape sequence:

        var s = 'O\u0021K';
        var r = /\u0021/g;
        print(s); // O!K
        print(r); // /\u0021/g
        print(s.replace(r, '')); // OK
        
        Show
        Evgeny Mandrikov added a comment - Root of this problem is "\u" in the second expression, i.e. removal of backslash should allow to proceed with analysis of a file. So here is simpler way to reproduce this problem: var r = /\u/; And in order to show that this regular expression is correct: var s = 'O\\uK'; var r = /\u/g; print(s); // O\uK print(r); // /\u/g print(s.replace(/\u/g, '')); // OK And indeed - according to ECMAScript Language Specification 5.1 "\u" should not be parsed as beginning of Unicode escape sequence, even if in runtime it can be interpreted as Unicode escape sequence: var s = 'O\u0021K'; var r = /\u0021/g; print(s); // O!K print(r); // /\u0021/g print(s.replace(r, '')); // OK
        Hide
        Freddy Mallet added a comment -

        Manually tested !

        Show
        Freddy Mallet added a comment - Manually tested !

          People

          • Assignee:
            Evgeny Mandrikov
            Reporter:
            Anonymous
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: