Skip to content

Commit

Permalink
Add elseif docs and syntax highlighter
Browse files Browse the repository at this point in the history
  • Loading branch information
gahag committed Jul 12, 2022
1 parent 66aef6b commit 1fc19f5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/syntax/lexer/token/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ pub enum TokenKind {

impl TokenKind {
/// Check if the token terminates a statement block.
/// Currently, only the END and ELSE keywords do that.
/// Currently, only the END, ELSE and ELSEIF keywords do that.
pub fn is_block_terminator(&self) -> bool {
matches!(
self,
Expand Down
2 changes: 1 addition & 1 deletion src/syntax/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ where
}


/// Parse a block of statements, stopping when ELSE, END of EOF are reached, or after a
/// Parse a block of statements, stopping when ELSE, ELSEIF, END of EOF are reached, or after a
/// return is parsed. The Lua-like grammar requires stopping after such conditions.
/// This method synchronizes on all errors, producing an empty block if no statements
/// can be parsed.
Expand Down
2 changes: 1 addition & 1 deletion syntax-highlight/emacs/hush-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
;; hush-mode-map))

(defvar hush-keywords
'("let" "if" "then" "else" "end" "for" "in" "do" "while" "function" "return"
'("let" "if" "then" "else" "elseif" "end" "for" "in" "do" "while" "function" "return"
"not" "and" "or" "true" "false" "nil" "break" "self"))

(defvar hush-mode-syntax-table
Expand Down
2 changes: 1 addition & 1 deletion syntax-highlight/pygments/lexer/hush.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class HushLexer(RegexLexer):
(r'[\[\]().,:;]|@\[', Punctuation),
(r'(and|or|not)\b', Operator.Word),

(r'(break|self|do|else|end|for|if|in|return|then|while)\b', Keyword.Reserved),
(r'(break|self|do|else|elseif|end|for|if|in|return|then|while)\b', Keyword.Reserved),
(r'(let)\b', Keyword.Declaration),
(r'(true|false|nil)\b', Keyword.Constant),

Expand Down
2 changes: 1 addition & 1 deletion syntax-highlight/vscode/syntaxes/hush.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"include": "#comment"
},
{
"match": "\\b(if|then|else|end|for|in|do|while|break|return)\\b",
"match": "\\b(if|then|else|elseif|end|for|in|do|while|break|return)\\b",
"name": "keyword.control.hush"
},
{
Expand Down

0 comments on commit 1fc19f5

Please sign in to comment.