Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit d0744d0

Browse files
Rust language support
1 parent 5719845 commit d0744d0

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

js-modules/prettify.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ var prettyPrint;
9696
var COMMON_KEYWORDS = [C_KEYWORDS,"catch,class,delete,false,import," +
9797
"new,operator,private,protected,public,this,throw,true,try,typeof"];
9898
var CPP_KEYWORDS = [COMMON_KEYWORDS,"alignof,align_union,asm,axiom,bool," +
99-
"concept,concept_map,const_cast,constexpr,decltype," +
99+
"concept,concept_map,const_cast,constexpr,decltype,delegate," +
100100
"dynamic_cast,explicit,export,friend,generic,late_check," +
101-
"mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast," +
102-
"template,typeid,typename,using,virtual,where"];
101+
"mutable,namespace,nullptr,property,reinterpret_cast,static_assert," +
102+
"static_cast,template,typeid,typename,using,virtual,where"];
103103
var JAVA_KEYWORDS = [COMMON_KEYWORDS,
104104
"abstract,assert,boolean,byte,extends,final,finally,implements,import," +
105105
"instanceof,interface,null,native,package,strictfp,super,synchronized," +
@@ -127,10 +127,13 @@ var prettyPrint;
127127
"def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo," +
128128
"rescue,retry,self,super,then,true,undef,unless,until,when,yield," +
129129
"BEGIN,END"];
130+
var RUST_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "as,assert,const,copy,drop," +
131+
"enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv," +
132+
"pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"];
130133
var SH_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "case,done,elif,esac,eval,fi," +
131134
"function,in,local,set,then,until"];
132135
var ALL_KEYWORDS = [
133-
CPP_KEYWORDS, CSHARP_KEYWORDS, JSCRIPT_KEYWORDS, PERL_KEYWORDS +
136+
CPP_KEYWORDS, CSHARP_KEYWORDS, JSCRIPT_KEYWORDS, PERL_KEYWORDS,
134137
PYTHON_KEYWORDS, RUBY_KEYWORDS, SH_KEYWORDS];
135138
var C_TYPES = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;
136139

@@ -739,6 +742,11 @@ var prettyPrint;
739742
'tripleQuotedStrings': true,
740743
'regexLiterals': true
741744
}), ['coffee']);
745+
registerLangHandler(sourceDecorator({
746+
'keywords': RUST_KEYWORDS,
747+
'cStyleComments': true,
748+
'multilineStrings': true
749+
}), ['rc', 'rs', 'rust']);
742750
registerLangHandler(
743751
createSimpleLexer([], [[PR_STRING, /^[\s\S]+/]]), ['regex']);
744752

0 commit comments

Comments
 (0)