add highlighting and folding for POD documentation
This commit is contained in:
parent
2fc8ffcc38
commit
5d6bc3a75d
6 changed files with 49 additions and 3 deletions
|
|
@ -1,4 +1,8 @@
|
|||
#!/usr/bin/perl
|
||||
=begin
|
||||
perl example code for Ace
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
my $num_primes = 0;
|
||||
|
|
@ -30,3 +34,4 @@ for my $p (0 .. ($num_primes-1))
|
|||
print $primes[$p], ", ";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,17 @@
|
|||
[[
|
||||
"start",
|
||||
["comment","#!/usr/bin/perl"]
|
||||
],[
|
||||
"block_comment",
|
||||
["comment.doc","=begin"]
|
||||
],[
|
||||
"block_comment",
|
||||
["comment.doc"," perl example code for Ace"]
|
||||
],[
|
||||
"start",
|
||||
["comment.doc","=cut"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["keyword","use"],
|
||||
|
|
@ -211,4 +222,6 @@
|
|||
["text",";"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start"
|
||||
]]
|
||||
|
|
@ -35,7 +35,16 @@ var oop = require("../../lib/oop");
|
|||
var Range = require("../../range").Range;
|
||||
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||
|
||||
var FoldMode = exports.FoldMode = function() {};
|
||||
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||
if (commentRegex) {
|
||||
this.foldingStartMarker = new RegExp(
|
||||
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||
);
|
||||
this.foldingStopMarker = new RegExp(
|
||||
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||
);
|
||||
}
|
||||
};
|
||||
oop.inherits(FoldMode, BaseFoldMode);
|
||||
|
||||
(function() {
|
||||
|
|
|
|||
|
|
@ -42,13 +42,18 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
|||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new PerlHighlightRules().getRules());
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
this.foldingRules = new CStyleFoldMode({start: "^=(begin|item)\\b", end: "^=(cut)\\b"});
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.lineCommentStart = "#";
|
||||
this.blockComment = [
|
||||
{start: "=begin", end: "=cut"},
|
||||
{start: "=item", end: "=cut"}
|
||||
];
|
||||
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
|
|
|||
|
|
@ -82,6 +82,10 @@ var PerlHighlightRules = function() {
|
|||
{
|
||||
token : "comment",
|
||||
regex : "#.*$"
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
regex : "^=(?:begin|item)\\b",
|
||||
next : "block_comment"
|
||||
}, {
|
||||
token : "string.regexp",
|
||||
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
|
||||
|
|
@ -141,6 +145,16 @@ var PerlHighlightRules = function() {
|
|||
token : "string",
|
||||
regex : '.+'
|
||||
}
|
||||
],
|
||||
"block_comment": [
|
||||
{
|
||||
token: "comment.doc",
|
||||
regex: "^=cut\\b",
|
||||
next: "start"
|
||||
},
|
||||
{
|
||||
defaultToken: "comment.doc"
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ var Mode = function() {
|
|||
this.$tokenizer = new Tokenizer(new PowershellHighlightRules().getRules());
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.$behaviour = new CstyleBehaviour();
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
this.foldingRules = new CStyleFoldMode({start: "^\\s*(<#)", end: "^[#\\s]>\\s*$"});
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue