Added 'mod' keyword

This commit is contained in:
bakk 2022-01-16 15:44:32 +01:00
parent ce22ca63f4
commit 5600abbcec
3 changed files with 3 additions and 2 deletions

View File

@ -106,7 +106,7 @@ impl Highlighter for LineHighlighter {
let reg = Regex::new( let reg = Regex::new(
r"(?x) r"(?x)
(?P<op>([+\-/*%^!×÷⋅∧∨]|if|otherwise|\sand|\sor|load|exit|clear|help)) | (?P<op>([+\-/*%^!×÷⋅∧∨]|if|otherwise|\sand|\sor|\smod|load|exit|clear|help)) |
(?P<radix>0[box][a-zA-Z0-9]+) | (?P<radix>0[box][a-zA-Z0-9]+) |
(?P<identifier>[^!-@\s_|^\[\]\{\}¹²³]+(_\d+)?)", (?P<identifier>[^!-@\s_|^\[\]\{\}¹²³]+(_\d+)?)",
) )

View File

@ -324,6 +324,7 @@ impl<'a> Lexer<'a> {
let kind = match value.as_ref() { let kind = match value.as_ref() {
"and" => TokenKind::And, "and" => TokenKind::And,
"or" => TokenKind::Or, "or" => TokenKind::Or,
"mod" => TokenKind::Percent,
"unit" => TokenKind::UnitKeyword, "unit" => TokenKind::UnitKeyword,
"to" => TokenKind::ToKeyword, "to" => TokenKind::ToKeyword,
"if" => TokenKind::IfKeyword, "if" => TokenKind::IfKeyword,

View File

@ -306,7 +306,7 @@
let result = input; let result = input;
let offset = 0; let offset = 0;
result = result.replace( result = result.replace(
/(?<brackets>\[\[)|(?<radix>0[box][a-zA-Z0-9]+)|(?<comparison>(!=|[<>]=?))|(?<html>[<>&]|(\n\s*\}?|\s+))|(?<op>([+\-/*%^!≈×÷⋅∧∨]|if|otherwise|and|or)|(?<identifier>[^!-@\s_|^⌊⌋⌈⌉≈\[\]\{\}⟦⟧≠≥≤⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎]+(_\d+)?)\(?)/g, /(?<brackets>\[\[)|(?<radix>0[box][a-zA-Z0-9]+)|(?<comparison>(!=|[<>]=?))|(?<html>[<>&]|(\n\s*\}?|\s+))|(?<op>([+\-/*%^!≈×÷⋅∧∨]|if|otherwise|and|or|mod)|(?<identifier>[^!-@\s_|^⌊⌋⌈⌉≈\[\]\{\}⟦⟧≠≥≤⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎]+(_\d+)?)\(?)/g,
( (
substring, substring,
brackets, brackets,