Add a lexing-based 'highlight' mode to the parser

basic syntax highlighting

added more syntax highlighting coverage

add example of a markdown table with styling

move FIXED_TOKEN logic into highlight

refactor highlight, add support for backpassing

escape html from source code

fix bug with <pre> tag ordering

refactor out html from roc_parse

remove test, put highlight functionality into separate file

fix typo
This commit is contained in:
Luke Boswell 2023-02-28 17:03:49 +11:00
parent 7ccc23ca06
commit 1590b30b19
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
12 changed files with 1413 additions and 114 deletions

View file

@ -568,6 +568,15 @@ mod test_snapshots {
Err(err) => Err(format!("{:?}", err)),
};
if expect == TestExpectation::Pass {
let tokens = roc_parse::highlight::highlight(&source);
for token in tokens {
if token.value == roc_parse::highlight::Token::Error {
panic!("Found an error highlight token in the input: {:?}", token);
}
}
}
let actual_result =
if expect == TestExpectation::Pass || expect == TestExpectation::Malformed {
result.expect("The source code for this test did not successfully parse!")