We use the nom parser, which basically consists of functions that check the input and when it matches they consume the part of the input that matched.
So currently, the parsing works like this:
pseudocode:
let mut remaining_input = input;
let output = Vec<Element>
while !remaining_input.is_empty() {
let res = {
// try the following parsers in this order (order is important with some parsers)
1. hashtag(input)
2. bot_command_suggestion(input)
3. email_address(input)
4. link(input)
5. linebreak(input)
last option: consumes all text until [parse_text_element] works again
}
remaining_input = res.remaining_input
output.push(res.element)
}The single most important thing for this crate is testing, as long as we cover as many cases in tests as we can the parser stays working.
The second principle is speed, we can test that with benchmarks.
The third priority is binary size, so be careful with huge extra libraries, maybe there is a better way.
- checkout current main and make sure no body message with main while you make the release.
- Update changelog
- bump versions in
Cargo.tomlandmessage_parser_wasm/Cargo.toml - do a commit to main with message
prepare [version] git pushgit tag [version]andgit push --tagscargo publishcd message_parser_wasm/wasm-pack build --scope deltachat --target webwasm-pack publish --target web
We use group_imports="StdExternalCrate" to group imports,
which requires the nightly version of the rust toolchain,
so you need to run the following comand to fix the order of the imports:
cargo +nightly fmt -- --config=group_imports="StdExternalCrate"