langs.sty
changeset 164 08a6e035223e
parent 160 4cbd6ca025e6
child 336 3cb200fa6d6a
--- a/langs.sty	Tue Sep 23 01:06:00 2014 +0100
+++ b/langs.sty	Tue Sep 23 01:49:53 2014 +0100
@@ -8,10 +8,28 @@
 \definecolor{codepurple}{rgb}{0.5,0,0.35}      % keywords
 \definecolor{codedocblue}{rgb}{0.25,0.35,0.75} % doc
 \definecolor{codeblue}{rgb}{0.25,0.35,0.75}    % types
+\definecolor{darkgray}{rgb}{.4,.4,.4}
 
 \BeforeBeginEnvironment{lstlisting}{\par\noindent\begin{minipage}{\linewidth}}
 \AfterEndEnvironment{lstlisting}{\end{minipage}\par}
 
+\lstdefinelanguage{JavaScript}{
+  keywords={break,case,catch,continue,debugger,default,% 
+    delete,do,else,false,finally,for,function,if,in,instanceof,% 
+    new,null,return,switch,this,throw,true,try,typeof,var,void,while,with},
+  morecomment=[l]{//},
+  morecomment=[s]{/*}{*/},
+  morestring=[b]',
+  morestring=[b]",
+  ndkeywords={class,export,boolean,throw,implements,import,this},
+  keywordstyle=\color{codepurple}\bfseries,
+  ndkeywordstyle=\color{darkgray}\bfseries,
+  identifierstyle=\color{black},
+  commentstyle=\color{codegreen}\ttfamily,
+  stringstyle=\color{codegreen}\ttfamily,
+  sensitive=true
+}
+
 \lstdefinelanguage{Scala}{
   morekeywords={abstract,case,catch,class,def,%
     do,else,extends,false,final,finally,%