Skip to content

Commit

Permalink
enh(erlang) OTP25/27 maybe statement
Browse files Browse the repository at this point in the history
  • Loading branch information
nixxquality committed Jun 7, 2024
1 parent 50b1c72 commit 77567c1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/languages/erlang.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function(hljs) {
const ERLANG_RESERVED = {
keyword:
'after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun if '
+ 'let not of orelse|10 query receive rem try when xor',
+ 'let not of orelse|10 query receive rem try when xor maybe else',
literal:
'false true'
};
Expand Down Expand Up @@ -112,7 +112,7 @@ export default function(hljs) {
};

const BLOCK_STATEMENTS = {
beginKeywords: 'fun receive if try case',
beginKeywords: 'fun receive if try case maybe',
end: 'end',
keywords: ERLANG_RESERVED
};
Expand Down
9 changes: 9 additions & 0 deletions test/markup/erlang/maybe.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<span class="hljs-keyword">maybe</span>
{ok, A} ?= a(),
<span class="hljs-literal">true</span> = A &gt;= <span class="hljs-number">0</span>,
{ok, B} ?= b(),
A + B
<span class="hljs-keyword">else</span>
error -&gt; error;
wrong -&gt; error
<span class="hljs-keyword">end</span>
9 changes: 9 additions & 0 deletions test/markup/erlang/maybe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
maybe
{ok, A} ?= a(),
true = A >= 0,
{ok, B} ?= b(),
A + B
else
error -> error;
wrong -> error
end

0 comments on commit 77567c1

Please sign in to comment.