Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/mq.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contexts:
scope: comment.line.number-sign.mq

keywords:
- match: '\b(def|do|let|if|elif|else|end|while|until|unless|foreach|self|nodes|match|fn|break|continue|include|import|module|var|loop|try|catch|as)\b'
- match: '\b(def|do|let|if|elif|else|end|while|until|unless|foreach|self|nodes|match|fn|break|continue|include|import|module|var|loop|try|catch|as|yield)\b'
scope: keyword.control.mq
- match: '(//=|<<|>>|<=|>=|==|!=|=~|!~|\|\||&&|\?\?|::|\.\.|\|=|\+=|-=|\*=|/=|%=|->|=|<|>|\||:|;|\?|!|\+|-|\*|/|%|@)'
scope: keyword.operator.mq
Expand Down
4 changes: 2 additions & 2 deletions crates/mq-repl/src/command_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ pub enum Command {
///
/// This list must be kept in sync with the keyword definitions in
/// `crates/mq-lang/src/lexer.rs` (see the lexer keyword table in `ident_or_keyword`).
const KEYWORDS: &[&str; 28] = &[
const KEYWORDS: &[&str; 29] = &[
"def", "let", "if", "unless", "elif", "else", "end", "while", "until", "loop", "foreach", "self", "nodes", "fn",
"break", "continue", "include", "true", "false", "None", "match", "try", "catch", "import", "module", "do", "var",
"as",
"as", "yield",
];

impl fmt::Display for Command {
Expand Down
2 changes: 1 addition & 1 deletion crates/mq-repl/src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static HIGHLIGHT_PATTERNS: LazyLock<Vec<(Regex, Paint)>> = LazyLock::new(|| {
),
(r#""([^"\\]|\\.)*""#, |s| s.bright_green()),
(
r"\b(def|let|if|unless|elif|else|end|while|until|foreach|self|nodes|fn|break|continue|include|true|false|None|match|import|module|do|var)\b",
r"\b(def|let|if|unless|elif|else|end|while|until|foreach|self|nodes|fn|break|continue|include|true|false|None|match|import|module|do|var|try|catch|loop|as|yield)\b",
|s| s.bright_blue(),
),
(r"\b\d+\b", |s| s.bright_magenta()),
Expand Down
2 changes: 1 addition & 1 deletion crates/mq-run/src/debugger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ static HIGHLIGHT_PATTERNS: LazyLock<Vec<(Regex, Paint)>> = LazyLock::new(|| {
),
// Keywords
(
r"\b(as|break|catch|continue|def|do|elif|else|end|fn|foreach|if|unless|import|include|let|loop|match|module|nodes|self|try|until|var|while)\b",
r"\b(as|break|catch|continue|def|do|elif|else|end|fn|foreach|if|unless|import|include|let|loop|match|module|nodes|self|try|until|var|while|yield)\b",
|s| s.truecolor(103, 184, 227).bold().to_string(),
),
// Boolean / None constants
Expand Down
4 changes: 2 additions & 2 deletions docs/books/theme/highlight-mq.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
function hljsDefineMq(hljs) {
const KEYWORDS = {
keyword:
"def do let if elif else end while until unless foreach self nodes match fn break continue include import module var loop try catch",
"def do let if elif else end while until unless foreach self nodes match fn break continue include import module var loop try catch as yield",
literal: "true false None",
};

Expand Down Expand Up @@ -77,7 +77,7 @@
};

const KEYWORD_ALTERNATION =
"def|do|let|if|elif|else|end|while|until|unless|foreach|self|nodes|match|fn|break|continue|include|import|module|var|loop|try|catch";
"def|do|let|if|elif|else|end|while|until|unless|foreach|self|nodes|match|fn|break|continue|include|import|module|var|loop|try|catch|as|yield";

const FUNCTION_CALL = {
className: "title.function.invoke",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type MqState = {
};

const KEYWORDS =
/^\b(let|def|do|match|while|until|unless|foreach|if|elif|else|end|self|None|nodes|break|continue|include|import|module|var|loop)\b/;
/^\b(let|def|do|match|while|until|unless|foreach|if|elif|else|end|self|None|nodes|break|continue|include|import|module|var|loop|fn|try|catch|as|yield)\b/;
const OPERATORS =
/^(\/\/=|<<|>>|\|\||\?\?|<=|>=|==|!=|=~|&&|\+=|-=|\*=|\/=|\|=|=|\||:|;|\?|!|\+|-|\*|\/|%|<|>|@)/;
const FUNCTION_CALL = /^[a-zA-Z_]\w*(?=\s*\()/;
Expand Down
2 changes: 1 addition & 1 deletion packages/mq-playground/src/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,7 @@ export const Playground = () => {
root: [
[/#[^\n]*/, "comment"],
[
/\b(let|def|do|match|while|until|unless|foreach|if|elif|else|end|self|None|nodes|break|continue|include|import|module|var|loop|yield)\b/,
/\b(let|def|do|match|while|until|unless|foreach|if|elif|else|end|self|None|nodes|break|continue|include|import|module|var|loop|yield|fn|try|catch|as)\b/,
"keyword",
],
[/;/, "delimiter"],
Expand Down
Loading