Skip to content

Commit 823bf14

Browse files
committed
Fix parsing of missing calc functions
1 parent c4509f5 commit 823bf14

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/Sabberworm/CSS/Value/CalcFunction.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ class CalcFunction extends CSSFunction {
1111

1212
public static function parse(ParserState $oParserState) {
1313
$aOperators = array('+', '-', '*', '/');
14-
$sFunction = trim($oParserState->consumeUntil('(', false, true));
14+
$aTerminators = array('(', ';', "\n", "\r");
15+
$sFunction = trim($oParserState->consumeUntil($aTerminators, false, true));
16+
if ($oParserState->peek(1, -1) != '(') {
17+
// Found ; or end of line before an opening bracket
18+
throw new UnexpectedTokenException('(', $oParserState->peek(1, -1), 'literal', $oParserState->currentLine());
19+
}
1520
$oCalcList = new CalcRuleValueList($oParserState->currentLine());
1621
$oList = new RuleValueList(',', $oParserState->currentLine());
1722
$iNestingLevel = 0;

0 commit comments

Comments
 (0)