@@ -423,6 +423,17 @@ impl Position {
423423 pub fn line_col_utf16 < ' s > ( & self ) -> ( usize , usize ) {
424424 ( self . line as usize , self . utf16_col as usize )
425425 }
426+
427+ pub ( crate ) fn add_offset ( & self , other : Self ) -> Self {
428+ Self {
429+ line : self . line + other. line ,
430+ utf16_col : if other. line == 0 {
431+ self . utf16_col + other. utf16_col
432+ } else {
433+ other. utf16_col
434+ } ,
435+ }
436+ }
426437}
427438
428439/// Template parsing error object.
@@ -504,6 +515,12 @@ pub enum ParseErrorKind {
504515 DeprecatedAttribute ,
505516 IncompatibleWithWxAttribute ,
506517 UninitializedScope ,
518+ InvalidClassNames ,
519+ DuplicatedClassNames ,
520+ IncompatibleWithClassColonAttributes ,
521+ InvalidInlineStyleString ,
522+ DuplicatedStylePropertyNames ,
523+ IncompatibleWithStyleColonAttributes ,
507524}
508525
509526impl ParseErrorKind {
@@ -541,8 +558,22 @@ impl ParseErrorKind {
541558 Self :: EmptyExpression => "the expression is empty" ,
542559 Self :: InvalidEndTag => "invalid end tag" ,
543560 Self :: DeprecatedAttribute => "this attribute is deprecated" ,
544- Self :: IncompatibleWithWxAttribute => "this attribute is incompatible with wx:* attribute" ,
561+ Self :: IncompatibleWithWxAttribute => {
562+ "this attribute is incompatible with wx:* attribute"
563+ }
545564 Self :: UninitializedScope => "this variable is uninitialized" ,
565+ Self :: InvalidClassNames => "the class name list contains invalid identifiers" ,
566+ Self :: DuplicatedClassNames => "the class name list contains duplicated class names" ,
567+ Self :: IncompatibleWithClassColonAttributes => {
568+ "class data bindings are incompatible with `class:` attributes"
569+ }
570+ Self :: InvalidInlineStyleString => "the inline style is invalid" ,
571+ Self :: DuplicatedStylePropertyNames => {
572+ "the inline style contains duplicated style property names"
573+ }
574+ Self :: IncompatibleWithStyleColonAttributes => {
575+ "style data bindings are incompatible with `style:` attributes"
576+ }
546577 }
547578 }
548579
@@ -582,6 +613,12 @@ impl ParseErrorKind {
582613 Self :: DeprecatedAttribute => ParseErrorLevel :: Warn ,
583614 Self :: IncompatibleWithWxAttribute => ParseErrorLevel :: Error ,
584615 Self :: UninitializedScope => ParseErrorLevel :: Error ,
616+ Self :: InvalidClassNames => ParseErrorLevel :: Error ,
617+ Self :: DuplicatedClassNames => ParseErrorLevel :: Error ,
618+ Self :: IncompatibleWithClassColonAttributes => ParseErrorLevel :: Error ,
619+ Self :: InvalidInlineStyleString => ParseErrorLevel :: Error ,
620+ Self :: DuplicatedStylePropertyNames => ParseErrorLevel :: Error ,
621+ Self :: IncompatibleWithStyleColonAttributes => ParseErrorLevel :: Error ,
585622 }
586623 }
587624}
0 commit comments