Skip to content

Multiple tests cause parser error #25

@wbrian-onlineed

Description

@wbrian-onlineed

If a function contains more than one instance of the test function, it complains of a parse error

// example bad rule:
/a/.test('a') && /x/.test('x')

Error: "preg_match(): Unknown modifier '.'"
File: nicoswd/php-rule-parser/src/Grammar/JavaScript/Methods/Test.php
Line: 46
Function: preg_match
PHP Version: 7.4.3 (ubuntu)

I have tried reordering them, changing contents of test, and removing "i" modifier. It simply doesn't like it when there are two.

Related side issue: documentation provides use as "foo".test(/oo/i) but actual usage requires the reverse:/oo/i.test("foo")

Thanks for providing this helpful utility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions