Skip to content

Commit

Permalink
[asterisk mode] Add block-comment support
Browse files Browse the repository at this point in the history
  • Loading branch information
abelbeck authored and marijnh committed Aug 6, 2019
1 parent a6a9696 commit 80ccce0
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion mode/asterisk/asterisk.js
Expand Up @@ -9,7 +9,7 @@
* Description: CodeMirror mode for Asterisk dialplan
*
* Created: 05/17/2012 09:20:25 PM
* Revision: none
* Revision: 08/05/2019 AstLinux Project: Support block-comments
*
* Author: Stas Kobzar (stas@modulis.ca),
* Company: Modulis.ca Inc.
Expand Down Expand Up @@ -67,7 +67,26 @@ CodeMirror.defineMode("asterisk", function() {
var cur = '';
var ch = stream.next();
// comment
if (state.blockComment) {
if (ch == "-" && stream.match("-;", true)) {
state.blockComment = false;
} else if (stream.skipTo("--;")) {
stream.next();
stream.next();
stream.next();
state.blockComment = false;
} else {
stream.skipToEnd();
}
return "comment";
}
if(ch == ";") {
if (stream.match("--", true)) {
if (!stream.match("-", false)) { // Except ;--- is not a block comment
state.blockComment = true;
return "comment";
}
}
stream.skipToEnd();
return "comment";
}
Expand Down Expand Up @@ -124,6 +143,7 @@ CodeMirror.defineMode("asterisk", function() {
return {
startState: function() {
return {
blockComment: false,
extenStart: false,
extenSame: false,
extenInclude: false,
Expand Down

0 comments on commit 80ccce0

Please sign in to comment.