if (source == null) {
return null;
}
source.setEncoding(encoding);
Parser parser = new Parser();
parser.setErrorHandler(new SCSSErrorHandler());
parser.setDocumentHandler(handler);
try {
parser.parseStyleSheet(source);
} catch (ParseException e) {
// catch ParseException, re-throw a SCSSParseException which has
// file name info.
throw new SCSSParseException(e, identifier);
}
stylesheet.setCharset(parser.getInputSource().getEncoding());
return stylesheet;
}