Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
49fa04a
Flatten Spans on regex AST nodes
ottomated Oct 9, 2024
7fc8653
Merge branch 'main' of https://github.com/ottomated/oxc
ottomated Oct 9, 2024
0515e43
create estree derive generator
ottomated Oct 9, 2024
3084869
Merge branch 'main' into manual-serialize
ottomated Oct 10, 2024
149e86e
begin parse #[serde(...)] attributes
ottomated Oct 10, 2024
9e2266b
generate_derive on EVERYTHING
ottomated Oct 10, 2024
a478dea
Finished
ottomated Oct 10, 2024
d989448
comment on ESTree trait
ottomated Oct 10, 2024
c0c960e
camelCase fields
ottomated Oct 10, 2024
efbdae6
remove comments
ottomated Oct 10, 2024
6462e6b
Merge branch 'main' into manual-serialize
ottomated Oct 10, 2024
fb02a4c
[autofix.ci] apply automated fixes
autofix-ci[bot] Oct 10, 2024
0b6732b
regenerate
ottomated Oct 10, 2024
c151467
Merge branch 'manual-serialize' of github.com:ottomated/oxc into manu…
ottomated Oct 10, 2024
6f9857e
Merge branch 'main' of https://github.com/oxc-project/oxc
ottomated Oct 11, 2024
69884df
begin tsify work
ottomated Oct 11, 2024
c859d86
handle some macro attributes
ottomated Oct 15, 2024
6246824
flatten fields
ottomated Oct 16, 2024
08c3731
Use wasm-bindgen for now
ottomated Oct 16, 2024
6db2a1c
no type on Span
ottomated Oct 17, 2024
bc66fa9
Merge branch 'main' of https://github.com/oxc-project/oxc
ottomated Oct 17, 2024
724e87b
Merge branch 'main' into manual-serialize
ottomated Oct 17, 2024
422e4dc
remove tsify from ast features
ottomated Oct 17, 2024
284d736
remove tsify dep from oxc_syntax
ottomated Oct 17, 2024
9e4332f
[autofix.ci] apply automated fixes
autofix-ci[bot] Oct 17, 2024
544dead
add CompactStr type
ottomated Oct 17, 2024
9e22bfe
fix: restore `features = ["derive"]` for `serde` in `oxc_ast` crate
overlookmotel Oct 19, 2024
5065bf3
style: restore `Cargo.toml` formatting
overlookmotel Oct 19, 2024
6a3fb3e
style: order `#[generate_derive]` after `#[derive]`
overlookmotel Oct 19, 2024
6db7396
style: fix indentation
overlookmotel Oct 19, 2024
566eb50
refactor: remove unused `TypescriptGenerator`
overlookmotel Oct 19, 2024
5f9d398
refactor: revert `GeneratorOutput`
overlookmotel Oct 19, 2024
4d71118
fix: correct comments
overlookmotel Oct 19, 2024
b78e854
fix: `type` field in TS defs on structs with `#[estree(custom_seriali…
overlookmotel Oct 19, 2024
7639831
fix: use `| null` to match other type defs for `FormalParameterRest`
overlookmotel Oct 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Flatten Spans on regex AST nodes
  • Loading branch information
ottomated committed Oct 9, 2024
commit 49fa04a8fdc321893580df6b5f6ed6dc50a2a3f5
17 changes: 17 additions & 0 deletions crates/oxc_regular_expression/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use tsify::Tsify;
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct Pattern<'a> {
#[serde(flatten)]
pub span: Span,
pub body: Disjunction<'a>,
}
Expand All @@ -25,6 +26,7 @@ pub struct Pattern<'a> {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct Disjunction<'a> {
#[serde(flatten)]
pub span: Span,
pub body: Vec<'a, Alternative<'a>>,
}
Expand All @@ -35,6 +37,7 @@ pub struct Disjunction<'a> {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct Alternative<'a> {
#[serde(flatten)]
pub span: Span,
pub body: Vec<'a, Term<'a>>,
}
Expand Down Expand Up @@ -111,6 +114,7 @@ pub enum BoundaryAssertionKind {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct LookAroundAssertion<'a> {
#[serde(flatten)]
pub span: Span,
pub kind: LookAroundAssertionKind,
pub body: Disjunction<'a>,
Expand All @@ -134,6 +138,7 @@ pub enum LookAroundAssertionKind {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct Quantifier<'a> {
#[serde(flatten)]
pub span: Span,
pub min: u64,
/// `None` means no upper bound.
Expand All @@ -149,6 +154,7 @@ pub struct Quantifier<'a> {
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct Character {
/// This will be invalid position when `UnicodeMode` is disabled and `value` is a surrogate pair.
#[serde(flatten)]
pub span: Span,
pub kind: CharacterKind,
/// Unicode code point or UTF-16 code unit.
Expand Down Expand Up @@ -180,6 +186,7 @@ pub enum CharacterKind {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct CharacterClassEscape {
#[serde(flatten)]
pub span: Span,
pub kind: CharacterClassEscapeKind,
}
Expand All @@ -204,6 +211,7 @@ pub enum CharacterClassEscapeKind {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct UnicodePropertyEscape<'a> {
#[serde(flatten)]
pub span: Span,
pub negative: bool,
/// `true` if `UnicodeSetsMode` and `name` matches unicode property of strings.
Expand All @@ -218,6 +226,7 @@ pub struct UnicodePropertyEscape<'a> {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct Dot {
#[serde(flatten)]
pub span: Span,
}

Expand All @@ -228,6 +237,7 @@ pub struct Dot {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct CharacterClass<'a> {
#[serde(flatten)]
pub span: Span,
pub negative: bool,
/// `true` if:
Expand Down Expand Up @@ -286,6 +296,7 @@ impl<'a> GetSpan for CharacterClassContents<'a> {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct CharacterClassRange {
#[serde(flatten)]
pub span: Span,
pub min: Character,
pub max: Character,
Expand All @@ -297,6 +308,7 @@ pub struct CharacterClassRange {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct ClassStringDisjunction<'a> {
#[serde(flatten)]
pub span: Span,
/// `true` if body is empty or contains [`ClassString`] which `strings` is `true`.
pub strings: bool,
Expand All @@ -309,6 +321,7 @@ pub struct ClassStringDisjunction<'a> {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct ClassString<'a> {
#[serde(flatten)]
pub span: Span,
/// `true` if body is empty or contain 2 more characters.
pub strings: bool,
Expand All @@ -322,6 +335,7 @@ pub struct ClassString<'a> {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct CapturingGroup<'a> {
#[serde(flatten)]
pub span: Span,
/// Group name to be referenced by [`NamedReference`].
pub name: Option<Atom<'a>>,
Expand All @@ -335,6 +349,7 @@ pub struct CapturingGroup<'a> {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct IgnoreGroup<'a> {
#[serde(flatten)]
pub span: Span,
pub enabling_modifiers: Option<ModifierFlags>,
pub disabling_modifiers: Option<ModifierFlags>,
Expand All @@ -360,6 +375,7 @@ pub struct ModifierFlags {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct IndexedReference {
#[serde(flatten)]
pub span: Span,
pub index: u32,
}
Expand All @@ -371,6 +387,7 @@ pub struct IndexedReference {
#[generate_derive(CloneIn, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
pub struct NamedReference<'a> {
#[serde(flatten)]
pub span: Span,
pub name: Atom<'a>,
}
Expand Down