Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validator, parser, visitor #1

Merged
merged 84 commits into from
Dec 18, 2023
Merged

Conversation

helixbass
Copy link
Owner

In this PR:

  • should be passing all ported-over tests

@@ -6,3 +6,19 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
debug-cell = { git = "https://github.com/helixbass/debug-cell", rev = "d94711a" }
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was forked to add Ref::map()/RefMut::map()

wtf8 = "0.1.0"

[dev-dependencies]
serde_json = { git = "https://github.com/helixbass/json", rev = "eb2cf6b" }
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was forked because of serde-rs/json#1089

Given that this is only used in tests (for parsing "known" JSON fixture files) I'm not too worried about whether the "fix" is that "sound" or not

@@ -0,0 +1,1617 @@
#[cfg(test)]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to clean all of this up (maybe generate some stuff via macros?) but seemed desirable to define the *Unresolved AST types next to the corresponding AST types

})
}

pub fn as_backreference(&self) -> &Backreference {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be interesting to have a macro that generates all of these (for a given enum)?

StringOrU32::String(value) => {
// TODO: should handle this better?
assert!(value == "$$Infinity");
u32::MAX
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if I actually "tested" this anywhere, basically I just tried to use u32::MAX in places where the JS version was using Infinity


pub extern crate id_arena;

pub type Result<T> = std::result::Result<T, RegExpSyntaxError>;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should go back through and use this "everywhere"

Wtf16,
};

pub type CodePoint = u32;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little arbitrary that this is defined/exported from here (probably in general the shape of the "public API" of the crate is kind of random/likely incomplete)

};

#[derive(Clone, Debug, Default, Eq, PartialEq, Hash)]
pub struct Wtf16(Vec<u16>);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems likely that this will/should get extracted into its own crate (even if not very robust) since it will probably eg "bleed into" tree-sitter-lint-plugin-eslint-builtin?

@helixbass helixbass merged commit 7ced0ca into master Dec 18, 2023
2 checks passed
@helixbass helixbass deleted the validator-validate-error-test branch December 18, 2023 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant