bool LessParser::parseSelectorVariable(Selector &selector) { Token* back; if (tokenizer->getTokenType() == Token::BRACKET_OPEN) { back = &selector.back(); if (back->at(back->length() - 1) == '@') { back->append(tokenizer->getToken()); if (tokenizer->readNextToken() != Token::IDENTIFIER) throw new ParseException(tokenizer->getToken(), "Variable inside selector (e.g.: \ @{identifier})"); back->append(tokenizer->getToken()); if (tokenizer->readNextToken() != Token::BRACKET_CLOSED) throw new ParseException(tokenizer->getToken(), "Closing bracket after variable."); back->append(tokenizer->getToken()); tokenizer->readNextToken(); parseWhitespace(selector); return true; } } return false; }
ParameterRuleset::ParameterRuleset(Selector* selector): Ruleset(selector) { Selector* newselector = new Selector(); rest = ""; unlimitedArguments = false; while (!selector->empty() && selector->front()->type != Token::PAREN_OPEN) { newselector->push(selector->shift()); } if (selector->empty()) { throw new ParseException(*selector->toString(), "matching parentheses."); } delete selector->shift(); while (newselector->back()->type == Token::WHITESPACE) delete newselector->pop(); setSelector(newselector); while (processParameter(selector)) { } if (selector->size() > 3 && selector->front()->str == "." && selector->at(1)->str == "." && selector->at(2)->str == ".") { unlimitedArguments = true; delete selector->shift(); delete selector->shift(); delete selector->shift(); } if (selector->front()->type != Token::PAREN_CLOSED) { throw new ParseException(*selector->toString(), "matching parentheses."); } delete selector; }