mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update to cssparser 0.19, count line numbers during tokenization
This commit is contained in:
parent
32f835260c
commit
7382dad939
33 changed files with 145 additions and 196 deletions
|
@ -5,7 +5,7 @@
|
|||
//! The context within which CSS code is parsed.
|
||||
|
||||
use context::QuirksMode;
|
||||
use cssparser::{Parser, SourcePosition, UnicodeRange};
|
||||
use cssparser::{Parser, SourceLocation, UnicodeRange};
|
||||
use error_reporting::{ParseErrorReporter, ContextualParseError};
|
||||
use style_traits::{OneOrMoreSeparated, ParseError, ParsingMode, Separator};
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -133,20 +133,15 @@ impl<'a> ParserContext<'a> {
|
|||
pub fn rule_type(&self) -> CssRuleType {
|
||||
self.rule_type.expect("Rule type expected, but none was found.")
|
||||
}
|
||||
}
|
||||
|
||||
/// Defaults to a no-op.
|
||||
/// Set a `RUST_LOG=style::errors` environment variable
|
||||
/// to log CSS parse errors to stderr.
|
||||
pub fn log_css_error<'a>(input: &mut Parser,
|
||||
position: SourcePosition,
|
||||
error: ContextualParseError<'a>,
|
||||
parsercontext: &ParserContext) {
|
||||
let url_data = parsercontext.url_data;
|
||||
let line_number_offset = parsercontext.line_number_offset;
|
||||
parsercontext.error_reporter.report_error(input, position,
|
||||
error, url_data,
|
||||
line_number_offset);
|
||||
/// Record a CSS parse error with this context’s error reporting.
|
||||
pub fn log_css_error(&self, location: SourceLocation, error: ContextualParseError) {
|
||||
let location = SourceLocation {
|
||||
line: location.line + self.line_number_offset as u32,
|
||||
column: location.column,
|
||||
};
|
||||
self.error_reporter.report_error(self.url_data, location, error)
|
||||
}
|
||||
}
|
||||
|
||||
// XXXManishearth Replace all specified value parse impls with impls of this
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue