Skip to content

Commit

Permalink
Upgrade Perl mode
Browse files Browse the repository at this point in the history
Sort of closes issue #236
  • Loading branch information
marijnh committed Nov 8, 2011
1 parent 8e60233 commit 1bcba04
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mode/perl/perl.js
@@ -1,4 +1,4 @@
// CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.09 (2011-10-15)
// CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08)
// This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com)
CodeMirror.defineMode("perl",function(config,parserConfig){
// http://perldoc.perl.org
Expand Down Expand Up @@ -665,7 +665,10 @@ CodeMirror.defineMode("perl",function(config,parserConfig){
if(ch=="`"){
return tokenChain(stream,state,[ch],"variable-2")}
if(ch=="/"){
return tokenChain(stream,state,[ch],RXstyle,RXmodifiers)}
if(!/~\s*$/.test(stream.prefix()))
return "operator";
else
return tokenChain(stream,state,[ch],RXstyle,RXmodifiers)}
if(ch=="$"){
var p=stream.pos;
if(stream.eatWhile(/\d/)||stream.eat("{")&&stream.eatWhile(/\d/)&&stream.eat("}"))
Expand Down Expand Up @@ -782,8 +785,11 @@ CodeMirror.StringStream.prototype.look=function(c){

// return a part of prefix of current stream from current position
CodeMirror.StringStream.prototype.prefix=function(c){
var x=this.pos-c;
return this.string.substr((x>=0?x:0),c)};
if(c){
var x=this.pos-c;
return this.string.substr((x>=0?x:0),c)}
else{
return this.string.substr(0,this.pos-1)}};

// return a part of suffix of current stream from current position
CodeMirror.StringStream.prototype.suffix=function(c){
Expand Down

0 comments on commit 1bcba04

Please sign in to comment.