Skip to content

Instantly share code, notes, and snippets.

@tueda
Last active March 20, 2019 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tueda/a7a15955165fe9eb7783b588870dfbd8 to your computer and use it in GitHub Desktop.
Save tueda/a7a15955165fe9eb7783b588870dfbd8 to your computer and use it in GitHub Desktop.
% latest-raw-url: https://gist.githubusercontent.com/tueda/a7a15955165fe9eb7783b588870dfbd8/raw/listings-form.sty
%
% Copyright (c) 2019 Takahiro Ueda
%
% This file may be distributed and/or modified under the conditions of
% the LaTeX Project Public License (LPPL), either version 1.3c of this
% license or (at your option) any later version. The latest version of
% this license is in:
%
% http://www.latex-project.org/lppl.txt
%
\ProvidesPackage{listings-form}[2019/03/20 v0.1.1]
\RequirePackage{listings}
\lstdefinelanguage{form}{
keywords=[1]{
AutoDeclare,
CFunction,
CopySpectator,
CreateSpectator,
CTable,
Drop,
Fill,
FillExpression,
Function,
Index,
Local,
Off,
On,
Polyratfun,
RemoveSpectator,
Set,
Symbol,
Table,
Tensor,
Vector,
},
morekeywords=[1]{
CFunctions,
Functions,
Indices,
Symbols,
Vectors,
},
morekeywords=[1]{
CF,
L,
S,
V,
},
morekeywords=[2]{
argtoextrasymbol,
contract,
discard,
endif,
endrepeat,
if,
id,
multiply,
redefine,
repeat,
trace4,
tracen,
tospectator,
ToSpectator,
},
morekeywords=[2]{
B,
Format,
ModuleOption,
Print,
P,
},
morekeywords=[3]{
dd_,
delta_,
distrib_,
extrasymbol_,
max_,
min_,
partitions_,
replace_,
sign_,
theta_,
thetap_,
topologies_,
},
morekeywords=[4]{
.end,
.sort,
},
% "Directives" cannot be indented. Use "keywords" instead.
morekeywords=[5]{
\#add,
\#break,
\#breakdo,
\#call,
\#case,
\#clearoptimize,
\#closedictionary,
\#default,
\#define,
\#do,
\#else,
\#elseif,
\#enddo,
\#endif,
\#endprocedure,
\#endswitch,
\#if,
\#ifdef,
\#ifndef,
\#include,
\#message,
\#opendictionary,
\#optimize,
\#procedure,
\#redefine,
\#switch,
\#usedictionary,
\#write,
},
alsoletter={.\#},
string=[b]{"},
comment=[f]{*},
morecomment=[l]{\ \ *\ },
}[keywords,strings,comments]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment