langs.sty
changeset 254 dcd4688690ce
parent 242 35104ee14f87
child 272 1446bc47a294
equal deleted inserted replaced
253:75c469893514 254:dcd4688690ce
    18     for,if,implicit,import,match,mixin,%
    18     for,if,implicit,import,match,mixin,%
    19     new,null,object,override,package,%
    19     new,null,object,override,package,%
    20     private,protected,requires,return,sealed,%
    20     private,protected,requires,return,sealed,%
    21     super,this,throw,trait,true,try,%
    21     super,this,throw,trait,true,try,%
    22     type,val,var,while,with,yield},%
    22     type,val,var,while,with,yield},%
    23   otherkeywords={=>,<-,<\%,<:,>:,\#,@},%
    23   otherkeywords={=>,<-,<\%,<:,>:,\#},%
    24   sensitive=true,%
    24   sensitive=true,%
    25   %directives={Int,Char,Rexp,String,Boolean,BigInt,Unit,List,Set},%
    25   %directives={Int,Char,Rexp,String,Boolean,BigInt,Unit,List,Set},%
    26   %moredelim=*[directive]:,%
    26   %moredelim=*[directive]:,%
    27   morecomment=[l]{//},%
    27   morecomment=[l]{//},%
    28   morecomment=[n]{/*}{*/},
    28   morecomment=[n]{/*}{*/},
       
    29   morestring=[s]{"""}{"""},
    29   morestring=[b]",
    30   morestring=[b]",
    30   morestring=[b]',
    31   morestring=[b]',
    31   morestring=[b]"""
       
    32 }[keywords,comments,strings]
    32 }[keywords,comments,strings]
    33 
    33 
    34 \lstdefinelanguage{While}{
    34 \lstdefinelanguage{While}{
    35   morekeywords={if,then,else,while,do,true,false,write,upto,for,skip},
    35   morekeywords={if,then,else,while,do,true,false,write,upto,for,skip},
    36   otherkeywords={=,!=,:=,<,>,;},
    36   otherkeywords={=,!=,:=,<,>,;},
    39 }
    39 }
    40 
    40 
    41 \lstdefinestyle{mystyle}
    41 \lstdefinestyle{mystyle}
    42        {basicstyle=\ttfamily,
    42        {basicstyle=\ttfamily,
    43 	keywordstyle=\color{codepurple}\bfseries,
    43 	keywordstyle=\color{codepurple}\bfseries,
    44         %directivestyle=\color{codeblue}\bfseries,
       
    45 	stringstyle=\color{codegreen},
    44 	stringstyle=\color{codegreen},
    46 	commentstyle=\color{codegreen},
    45 	commentstyle=\color{codegreen},
    47 	morecomment=[s][\color{codedocblue}]{/**}{*/},
    46 	morecomment=[s][\color{codedocblue}]{/**}{*/},
    48 	numbers=left,
    47 	numbers=left,
    49 	numberstyle=\tiny\color{black},
    48 	numberstyle=\tiny\color{black},
    52 	tabsize=2,
    51 	tabsize=2,
    53 	showspaces=false,
    52 	showspaces=false,
    54 	showstringspaces=false,
    53 	showstringspaces=false,
    55         xleftmargin=8mm,
    54         xleftmargin=8mm,
    56         emphstyle=\color{codeblue}\bfseries,
    55         emphstyle=\color{codeblue}\bfseries,
    57         keepspaces}
    56         keepspaces
       
    57 }
    58 
    58 
    59 \lstset{language=Scala,
    59 \lstset{language=Scala,
    60         style=mystyle}
    60         style=mystyle}
    61 
    61 
    62 
    62 
    63 \newcommand{\code}[1]{{\lstinline{#1}}}
    63 \newcommand{\code}[1]{{\lstinline{#1}}}
    64 \newcommand{\pcode}[1]{\mbox{\lstset{language={},keywordstyle=\color{black}}\lstinline!#1!}}
    64 \newcommand{\pcode}[1]{\mbox{\lstset{language={},keywordstyle=\color{black}}\lstinline!#1!}}
       
    65 \newcommand{\scode}[1]{\mbox{\lstset{language={},basicstyle=\ttfamily\color{codegreen}}\lstinline!#1!}}
    65 \makeatother
    66 \makeatother