/** * Parses a string * * @param string $string The string to parse * @param string $filename The filename for reference (will be visible in the source map) * @return ILess_Parser_Core */ public function parseString($string, $filename = '__string_to_parse__') { $string = ILess_Util::normalizeString((string) $string); // we need unique key $key = sprintf('%s[__%s__]', $filename, md5($string)); // create a dummy information, since we are not parsing a real file, // but a string comming from outside $this->env->setCurrentFile($filename); $importedFile = new ILess_ImportedFile($key, $string, time()); // save information, so the exceptions can handle errors in the string // and source map is generated for the string $this->env->currentFileInfo->importedFile = $importedFile; $this->importer->setImportedFile($key, $importedFile, $key, $this->env->currentFileInfo); if ($this->env->sourceMap) { $this->env->setFileContent($key, $string); } $this->rules = array_merge($this->rules, $this->parse($string)); return $this; }