Skip to content

Commit

Permalink
IM
Browse files Browse the repository at this point in the history
  • Loading branch information
vldm committed Nov 12, 2023
1 parent e36f279 commit 419d0d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/node/atoms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ pub(crate) mod tokens {
// //
/// Start part of doctype tag
/// `<!`
#[derive(Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
#[derive(Eq, PartialEq, Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
pub struct DocStart {
pub token_lt: Token![<],
pub token_not: Token![!],
}

/// Start part of comment tag
/// `<!--`
#[derive(Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
#[derive(Eq, PartialEq, Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
pub struct ComStart {
pub token_lt: Token![<],
pub token_not: Token![!],
Expand All @@ -62,7 +62,7 @@ pub(crate) mod tokens {

/// End part of comment tag
/// `-->`
#[derive(Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
#[derive(Eq, PartialEq, Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
pub struct ComEnd {
#[parse(parse::parse_array_of2_tokens)]
#[to_tokens(parse::to_tokens_array)]
Expand All @@ -72,7 +72,7 @@ pub(crate) mod tokens {

/// End part of element's open tag
/// `/>` or `>`
#[derive(Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
#[derive(Eq, PartialEq, Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
pub struct OpenTagEnd {
pub token_solidus: Option<Token![/]>,
pub token_gt: Token![>],
Expand All @@ -81,7 +81,7 @@ pub(crate) mod tokens {
/// Start part of element's close tag.
/// Its commonly used as separator
/// `</`
#[derive(Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
#[derive(Eq, PartialEq, Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
pub struct CloseTagStart {
pub token_lt: Token![<],
pub token_solidus: Token![/],
Expand All @@ -92,15 +92,15 @@ pub use tokens::*;

/// Fragment open part
/// `<>`
#[derive(Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
#[derive(Eq, PartialEq, Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
pub struct FragmentOpen {
pub token_lt: Token![<],
pub token_gt: Token![>],
}

/// Fragment close part
/// `</>`
#[derive(Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
#[derive(Eq, PartialEq, Clone, Debug, syn_derive::Parse, syn_derive::ToTokens)]
pub struct FragmentClose {
pub start_tag: tokens::CloseTagStart,
pub token_gt: Token![>],
Expand Down
8 changes: 6 additions & 2 deletions src/parser/recoverable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
//! [`Parser::parse_recoverable`]: struct.Parser.html#method.parse_recoverable
//! [`Node`]: struct.Node.html
use std::{collections::HashSet, fmt::Debug, rc::Rc};
use std::{backtrace, collections::HashSet, fmt::Debug, rc::Rc};

use proc_macro2_diagnostics::{Diagnostic, Level};
use syn::parse::{Parse, ParseStream};
Expand Down Expand Up @@ -141,6 +141,7 @@ impl RecoverableContext {
/// and convert result to `Option`, that can be used directly
/// as output in [`ParseRecoverable::parse_recoverable`]
pub fn save_diagnostics<T>(&mut self, val: syn::Result<T>) -> Option<T> {
println!("{}", std::backtrace::Backtrace::capture().to_string());
match val {
Ok(v) => Some(v),
Err(e) => {
Expand All @@ -153,7 +154,10 @@ impl RecoverableContext {
/// Push custom message of [`syn::Error`] or
/// [`proc_macro2_diagnostics::Diagnostic`]
pub fn push_diagnostic(&mut self, diagnostic: impl Into<Diagnostic>) {
self.diagnostics.push(diagnostic.into());
let diag = diagnostic.into();

println!("{}", std::backtrace::Backtrace::capture().to_string());
self.diagnostics.push(dbg!(diag));
}
}

Expand Down

0 comments on commit 419d0d9

Please sign in to comment.