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 master and make sure no body message with master while you make the release.
- Update changelog
- bump versions in
Cargo.toml
andmessage_parser_wasm/Cargo.toml
- do a commit to master with message
prepare [version]
git push
git tag [version]
andgit push --tags
cargo publish
cd message_parser_wasm/
wasm-pack build --scope deltachat --target web
wasm-pack publish --target web