%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Latex -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
%%
%% lstlang.sty --
%%
%% Author           : Peter A. Buhr
%% Created On       : Sat May 13 16:34:42 2017
%% Last Modified By : Peter A. Buhr
%% Last Modified On : Fri Apr  6 23:44:50 2018
%% Update Count     : 20
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Go programming language: https://github.com/julienc91/listings-golang/blob/master/listings-golang.sty
\lstdefinelanguage{Golang}{
	morekeywords=[1]{package,import,func,type,struct,return,defer,panic,recover,select,var,const,iota,},
	morekeywords=[2]{string,uint,uint8,uint16,uint32,uint64,int,int8,int16,int32,int64,
		bool,float32,float64,complex64,complex128,byte,rune,uintptr, error,interface},
	morekeywords=[3]{map,slice,make,new,nil,len,cap,copy,close,true,false,delete,append,real,imag,complex,chan,},
	morekeywords=[4]{for,break,continue,range,goto,switch,case,fallthrough,if,else,default,},
	morekeywords=[5]{Println,Printf,Error,},
	sensitive=true,
	morecomment=[l]{//},
	morecomment=[s]{/*}{*/},
	morestring=[b]',
	morestring=[b]",
	morestring=[s]{`}{`},
}

% from https://gist.github.com/nikolajquorning/92bbbeef32e1dd80105c9bf2daceb89a
\lstdefinelanguage{sml} {
	morekeywords= {
		EQUAL, GREATER, LESS, NONE, SOME, abstraction, abstype, and, andalso, array, as, before,
		bool, case, char, datatype, do, else, end, eqtype, exception, exn, false, fn, fun, functor,
		handle, if, in, include, infix, infixr, int, let, list, local, nil, nonfix, not, o, of, op,
		open, option, orelse, overload, print, raise, real, rec, ref, sharing, sig, signature,
		string, struct, structure, substring, then, true, type, unit, val, vector, where, while,
		with, withtype, word
    },
    morestring=[b]",
    morecomment=[s]{(*}{*)},
}

\lstdefinelanguage{D}{
	% Keywords
	morekeywords=[1]{
		abstract, alias, align, auto, body, break, cast, catch, class, const, continue, debug,
		delegate, delete, deprecated, do, else, enum, export, false, final, finally, for, foreach,
		foreach_reverse, function, goto, if, immutable, import, in, inout, interface, invariant, is,
		lazy, macro, mixin, module, new, nothrow, null, out, override, package, pragma, private,
		protected, public, pure, ref, return, shared, static, struct, super, switch, synchronized,
		template, this, throw, true, try, typedef, typeid, typeof, union, unittest, volatile, while,
		with
	},
	% Special identifiers, common functions
	morekeywords=[2]{enforce},
	% Ugly identifiers
	morekeywords=[3]{
		__DATE__, __EOF__, __FILE__, __LINE__, __TIMESTAMP__, __TIME__, __VENDOR__,
		__VERSION__, __ctfe, __gshared, __monitor, __thread, __vptr, _argptr,
		_arguments, _ctor, _dtor
	},
	% Basic types
	morekeywords=[4]{
		byte, ubyte, short, ushort, int, uint, long, ulong, cent, ucent, void, bool, bit, float,
		double, real, ushort, int, uint, long, ulong, float, char, wchar, dchar, string, wstring,
		dstring, ireal, ifloat, idouble, creal, cfloat, cdouble, size_t, ptrdiff_t, sizediff_t,
		equals_t, hash_t
	},
	% Strings
	morestring=[b]{"},
	morestring=[b]{'},
	morestring=[b]{`},
	% Comments
	comment=[l]{//},
	morecomment=[s]{/*}{*/},
	morecomment=[s][\color{blue}]{/**}{*/},
	morecomment=[n]{/+}{+/},
	morecomment=[n][\color{blue}]{/++}{+/},
	% Options
	sensitive=true
}

\lstdefinelanguage{rust}{
	% Keywords
	morekeywords=[1]{
		abstract, alignof, as, become, box, break, const, continue, crate, do, else, enum, extern,
		false, final, fn, for, if, impl, in, let, loop, macro, match, mod, move, mut, offsetof,
		override, priv, proc, pub, pure, ref, return, Self, self, sizeof, static, struct, super,
		trait, true, type, typeof, unsafe, unsized, use, virtual, where, while, yield
	},
	% Strings
	morestring=[b]{"},
	% Comments
	comment=[l]{//},
	morecomment=[s]{/*}{*/},
	% Options
	sensitive=true
}

\lstdefinelanguage{pseudo}{
	morekeywords={string,uint,int,bool,float},
	sensitive=true,
	morecomment=[l]{//},
	morecomment=[s]{/*}{*/},
	morestring=[b]',
	morestring=[b]",
	morestring=[s]{`}{`},
}

% CFA programming language, based on ANSI C (with some gcc additions)
\lstdefinelanguage{CFA}[ANSI]{C}{
	morekeywords={
		_Alignas, _Alignof, __alignof, __alignof__, asm, __asm, __asm__, __attribute, __attribute__,
		auto, _Bool, catch, catchResume, choose, _Complex, __complex, __complex__, __const, __const__,
		coroutine, disable, dtype, enable, __extension__, exception, fallthrough, fallthru, finally,
		__float80, float80, __float128, float128, forall, ftype, _Generic, _Imaginary, __imag, __imag__,
		inline, __inline, __inline__, __int128, int128, __label__, monitor, mutex, _Noreturn, one_t, or,
		otype, restrict, __restrict, __restrict__, __signed, __signed__, _Static_assert, thread,
		_Thread_local, throw, throwResume, timeout, trait, try, ttype, typeof, __typeof, __typeof__,
		virtual, __volatile, __volatile__, waitfor, when, with, zero_t,
    },
	moredirectives={defined,include_next}%
}

% C++ programming language
\lstdefinelanguage{C++}[ANSI]{C++}{}

% uC++ programming language, based on ANSI C++
\lstdefinelanguage{uC++}[ANSI]{C++}{
	morekeywords={
		_Accept, _AcceptReturn, _AcceptWait, _Actor, _At, _CatchResume, _Cormonitor, _Coroutine, _Disable,
		_Else, _Enable, _Event, _Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask,
		_Resume, _Select, _SporadicTask, _Task, _Timeout, _When, _With, _Throw},
}

% Local Variables: %
% tab-width: 4 %
% fill-column: 100 %
% End: %
