This PR greatly simplifies the `byte_search!` macro.
Mainly removing `cold_branch()` from the "not enough bytes remaining for a batch" branch, which allows refactoring so that `handle_match` and `continue_if` don't need to be repeated twice.
Result for performance is inconsistent - a little better on some benchmarks, a little worse on others. But not by significant amounts either way. In my view, the benefit of making the macro simpler outweighs a small speed loss anyway.
Sorry for the rather large size of PR. 😓 But essentially, not changed so
much.
#### 1. Reorganize directories and namings
```
src/jsdoc
├── builder.rs 👈🏻 for SemanticBuilder
├── finder.rs 👈🏻 `semantic.jsdoc()`
├── mod.rs
└── parser
├── jsdoc.rs 👈🏻 `JSDoc` struct which has `comment` and `tags`
├── jsdoc_tag.rs 👈🏻 `JSDocTag` struct
├── mod.rs
├── parse.rs 👈🏻 parsing logic by `JSDocParser`
└── utils.rs
```
Now `mod.rs` has only export things.
#### 2. Introduce `JSDocTagKind::Unknown(name)`
We need to keep their name as-is to check valid tag names are used.(e.g.
`jsdoc/check-tag-names` rule)
#### 3. Support multiline description
- Comment for JSDoc
- Comment for each JSDocTag
```js
/**
* @foo this comment continues
* here but leading * should be ignored!!
*/
```
- - -
Please correct me if I am doing something wrong... 🐰
Speed up lexing template strings.
This was the last use of `AutoCow` remaining in the lexer, and it's now removed.
Implementation is quite complex, to avoid repeatedly branching on whether an unescaped string is required or not (the way `AutoCow` did). I tried to simplify it down to a single function, but this hurt performance significantly.
Benchmarks do not show much movement, but I believe that's because there aren't many template strings in the benchmarks. Where there are template strings, I believe this speeds up lexing them significantly.
Simplify lexing JSX string attributes. As the search is purely for 1
byte value (the closing quote), and so doesn't require a byte table, use
`memchr`.
This change doesn't really register on benchmarks, but it's one step
closer to removing `AutoCow`, and transitioning all the searches in the
lexer to byte-by-byte.
A few more I missed in #2506. Re #2463.
Only remaining snake_case in the current types of the AST:
`trailing_comma` in ArrayExpression, ObjectExpression &
ArrayAssignmentTarget.