support more Tokens including Idents

This commit is contained in:
Luke Boswell 2023-03-05 18:40:59 +11:00 committed by Folkert
parent 1b676ca140
commit fbc1c7af2a
No known key found for this signature in database
GPG Key ID: 1F17F6FFD112B97C

View File

@ -47,7 +47,24 @@ pub fn highlight_roc_code(code: &str) -> String {
Token::ColonEquals | Token::Colon => {
buf = push_html_span(buf, current_text, "colon");
}
Token::Slash | Token::GreaterThan | Token::GreaterThanEquals | Token::Minus | Token::LessThan | Token::LessThanEquals | Token::DoubleEquals | Token::DoubleBar | Token::Plus | Token::Equals => {
Token::Percent
| Token::Caret
| Token::Bang
| Token::BangEquals
| Token::Slash
| Token::DoubleSlash
| Token::Pipe
| Token::GreaterThan
| Token::GreaterThanEquals
| Token::Minus
| Token::LessThan
| Token::LessThanEquals
| Token::DoubleEquals
| Token::DoubleBar
| Token::Plus
| Token::And
| Token::DoubleAnd
| Token::Equals => {
buf = push_html_span(buf, current_text, "op");
}
Token::Paren => {
@ -59,7 +76,13 @@ pub fn highlight_roc_code(code: &str) -> String {
Token::Brace => {
buf = push_html_span(buf, current_text, "brace");
}
_ => {
Token::UpperIdent => {
buf = push_html_span(buf, current_text, "upperident");
}
Token::LowerIdent => {
buf = push_html_span(buf, current_text, "lowerident");
}
Token::Error | Token::Other => {
buf = push_html(buf, current_text);
}
}