function Parser::parseLiteralRegex
Parses a literal regex
Return value
string|null
Throws
1 call to Parser::parseLiteralRegex()
- Parser::parseLiteral in vendor/
mck89/ peast/ lib/ Peast/ Selector/ Parser.php - Parses a literal value
File
-
vendor/
mck89/ peast/ lib/ Peast/ Selector/ Parser.php, line 438
Class
- Parser
- Selector parser class
Namespace
Peast\SelectorCode
protected function parseLiteralRegex() {
if (!($sep = $this->consume("/"))) {
return null;
}
if (($reg = $this->consumeUntil($sep, false, true)) === null) {
throw new Exception("Unterminated regex in attribute value");
}
$modifiers = $this->consumeWord();
return $sep . $reg . ($modifiers ?: "");
}