Skip to content

Commit e15d84b

Browse files
committed
Fix patterns priority
1 parent 65fd463 commit e15d84b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/JsPhpize/JsPhpizeOptions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ public function __construct(array $options = array())
3333
new Pattern(10, 'newline', '\n'),
3434
new Pattern(20, 'comment', '\/\/.*?\n|\/\*[\s\S]*?\*\/'),
3535
new Pattern(30, 'string', '"(?:\\\\.|[^"\\\\])*"|\'(?:\\\\.|[^\'\\\\])*\''),
36-
new Pattern(35, 'regexp', '\\/(?:\\\\.|[^\\/\\\\])*\\/[gimuy]*'),
3736
new Pattern(40, 'number', '0[bB][01]+|0[oO][0-7]+|0[xX][0-9a-fA-F]+|(\d+(\.\d*)?|\.\d+)([eE]-?\d+)?'),
3837
new Pattern(50, 'lambda', '=>'),
3938
new Pattern(60, 'operator', array('delete', 'typeof', 'void'), true),
4039
new Pattern(70, 'operator', array('>>>=', '<<=', '>>=', '**=')),
4140
new Pattern(80, 'operator', array('++', '--', '&&', '||', '**', '>>>', '<<', '>>')),
4241
new Pattern(90, 'operator', array('===', '!==', '>=', '<=', '<>', '!=', '==', '>', '<')),
42+
new Pattern(95, 'regexp', '\/(?:\\\\\S|[^\s\/\\\\])*\/[gimuy]*'),
4343
new Pattern(100, 'operator', '[\\|\\^&%\\/\\*\\+\\-]='),
4444
new Pattern(110, 'operator', '[\\[\\]\\{\\}\\(\\)\\:\\.\\/\\*~\\!\\^\\|&%\\?,;\\+\\-]'),
4545
new Pattern(120, 'keyword', array('as', 'async', 'await', 'break', 'case', 'catch', 'class', 'const', 'continue', 'debugger', 'default', 'do', 'else', 'enum', 'export', 'extends', 'finally', 'for', 'from', 'function', 'get', 'if', 'implements', 'import', 'in', 'instanceof', 'interface', 'let', 'new', 'of', 'package', 'private', 'protected', 'public', 'return', 'set', 'static', 'super', 'switch', 'throw', 'try', 'var', 'while', 'with', 'yield', 'yield*'), true),
4646
new Pattern(130, 'constant', 'null|undefined|Infinity|NaN|true|false|Math\.[A-Z][A-Z0-9_]*|[A-Z][A-Z0-9\\\\_\\x7f-\\xff]*|[\\\\\\x7f-\\xff_][A-Z0-9\\\\_\\x7f-\\xff]*[A-Z][A-Z0-9\\\\_\\x7f-\\xff]*', true),
47-
new Pattern(130, 'variable', '[a-zA-Z\\\\\\x7f-\\xff\\$_][a-zA-Z0-9\\\\_\\x7f-\\xff\\$]*', '$'),
47+
new Pattern(135, 'variable', '[a-zA-Z\\\\\\x7f-\\xff\\$_][a-zA-Z0-9\\\\_\\x7f-\\xff\\$]*', '$'),
4848
new Pattern(140, 'operator', '[\\s\\S]'),
4949
);
5050
}

0 commit comments

Comments
 (0)