Skip to content

[PATCH] Regexp for RCScan #2569

Open
Open

Description

@bdbaddog

This issue was originally created at: 2010-02-04 08:32:16.
This issue was reported by: gerard_.
gerard_ said at 2010-02-04 08:32:16

This patch (a new regexp) solves two problems:

  1. It allows for custom resource types (like XAML). (this is an enhancement)
  2. It does match when there are \r\n line endings (this is a bugfix)

gerard_ said at 2010-02-04 08:32:46

Created an attachment (id=686)
Regexp for RCScan

gerard_ said at 2010-02-04 10:03:36

Set type to PATCH

gregnoel said at 2010-02-19 11:14:09

Bug party triage. Steven to get advice from the .rc expert at his day job.

stevenknight said at 2010-02-22 15:58:37

I'm studying this issue, and wanted to capture an update with links to the
relevant MSDN spec pages for user-defined resources:

http://msdn.microsoft.com/en-us/library/aa380599(VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa381043(VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa381054(VS.85).aspx

There are two key questions:

  1. the new regex is more expansive in matching any user-defined resource, and
    it's not clear whether we'd get false positives on lines that match two keywords
    followed by a quoted string that isn't a file name.

  2. the old regex would match non-quoted file names following the specific
    keywords involved, while the new regex requires quotes. The spec pages I
    looked at don't indicate whether a file name must be quoted. If they can be
    left un-quoted, then we need to preserve the ability to match those.

gregnoel said at 2010-07-21 17:00:30

Bug party triage. Bump the priority of this issue.

gerard_ said at 2011-08-17 01:52:18

Steven, thanks for the links, on your questions:

  1. The specification is indeed very broad. I think it's this:
    r'^\s*'+ # leading whitespace
    r'(?:\w+\s+\w+)'+ # BLAH BLAH
    r'\s+("[\w./\]+"|[\w./\]+)\s*$' # ..\file_haha.test or "file.test"
    (only for resources, not #includes, not tested)
    It would be much better to have two separate regexes instead of the one that
    tries to match both the resource and the #include.

If we want to prevent false positives it should check if it is a valid resource
type, and allow the user to provide user defined types.

  1. I agree, it's a messy specification. See the regex from 1.

gerard_ attached RCScanner.patch at 2010-02-04 08:32:46.

Regexp for RCScan

Activity

  1. added this to the milestone on Jan 2, 2018
  2. added
    has patch
    on Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Version: 1.2.0has patch

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions