# Define SciTE settings for Common Intermediate Language (CIL) files.

# File filters, patterns, language, lexer and source
file.patterns.cil=*.il
filter.cil=CIL (il)|$(file.patterns.cil)|
lexer.$(file.patterns.cil)=cil

*filter.cil=$(filter.cil)
*language.cil=CIL|cil||
*source.patterns.cil=$(file.patterns.cil);

# Primary keywords
keywordclass.cil.main=abstract ansi assembly auto autochar beforefieldinit \
catch cdecl cil class compilercontrolled explicit extends extern famandassem \
family famorassem fastcall final finally forwardref hidebysig implements \
initonly instance interface internalcall lasterr literal managed nested \
newslot noinlining nomangle nooptimization notserialized optil pinvokeimpl \
platformapi preservesig private privatescope public reqsecobj rtspecialname \
runtime sealed sequential serializable specialname static stdcall strict \
synchronized thiscall unicode unmanaged unmanagedexp valuetype vararg virtual \
void winapi

# Extra data and reference types:
keywordclass.cil.main.extras=bool char float32 float64 int int8 int16 int32 \
int64 native nullref object string typedref uint8 uint32 unsigned

# Metadata keywords
keywordclass.cil.metadata=.addon .assembly .cctor .class .corflags .ctor \
.custom .data .emitbyte .entrypoint .event .export .field .file .fire .get \
.hash .imagebase .import .language .line .locale .localized .locals \
.manifestres .maxstack .method .module .mresource .namespace .other .override \
.pack .param .pdirect .permission .permissionset .property .property \
.publickey .publickeytoken .removeon .set .size .stackreserve .subsystem .try \
.ver .vtable .vtentry .vtfixup .zeroinit

# Opcode keywords
keywordclass.cil.opcode=add add.ovf add.ovf.un and arglist beq beq.s \
bge bge.s bge.un bge.un.s bgt bgt.s bgt.un bgt.un.s ble ble.s ble.un ble.un.s \
blt blt.s blt.un blt.un.s bne.un bne.un.s box br br.s break brfalse brfalse.s \
brinst brinst.s brnull brnull.s brtrue brtrue.s brzero brzero.s bstr call \
calli callmostderived callvirt castclass ceq cgt cgt.un ckfinite ckfinite clt \
clt.un constrained. conv.i conv.i1 conv.i2 conv.i4 conv.i8 conv.ovf.i \
conv.ovf.i.un conv.ovf.i1 conv.ovf.i1.un conv.ovf.i2 conv.ovf.i2.un \
conv.ovf.i4 conv.ovf.i4.un conv.ovf.i8 conv.ovf.i8.un conv.ovf.u \
conv.ovf.u.un conv.ovf.u1 conv.ovf.u1.un conv.ovf.u2 conv.ovf.u2.un \
conv.ovf.u4 conv.ovf.u4.un conv.ovf.u8 conv.ovf.u8.un conv.r.un conv.r4 \
conv.r8 conv.u conv.u1 conv.u2 conv.u4 conv.u8 cpblk cpobj div div.un dup \
endfault endfilter endfinally initblk initobj isinst jmp ldarg ldarg.0 ldarg.1 \
ldarg.2 ldarg.3 ldarg.s ldarga ldarga.s ldc.i4 ldc.i4.0 ldc.i4.1 ldc.i4.2 \
ldc.i4.3 ldc.i4.4 ldc.i4.5 ldc.i4.6 ldc.i4.7 ldc.i4.8 ldc.i4.m1 ldc.i4.s \
ldc.i8 ldc.r4 ldc.r8 ldelem ldelem.i ldelem.i1 ldelem.i2 ldelem.i4 ldelem.i8 \
ldelem.r4 ldelem.r8 ldelem.ref ldelem.u1 ldelem.u2 ldelem.u4 ldelema ldfld \
ldflda ldftn ldind.i ldind.i1 ldind.i2 ldind.i4 ldind.i8 ldind.r4 ldind.r8 \
ldind.ref ldind.u1 ldind.u2 ldind.u4 ldlen ldloc ldloc.0 ldloc.1 ldloc.2 \
ldloc.3 ldloc.s ldloca ldloca.s ldnull ldobj ldsfld ldsflda ldstr ldtoken \
ldvirtftn leave leave.s localloc mkrefany mul mul.ovf mul.ovf.un neg newarr \
newobj no. nop not or pop readonly. refanytype refanyval rem rem.un ret \
rethrow shl shr shr.un sizeof starg starg.s stelem stelem.i stelem.i1 \
stelem.i2 stelem.i4 stelem.i8 stelem.r4 stelem.r8 stelem.ref stfld stind.i \
stind.i1 stind.i2 stind.i4 stind.i8 stind.r4 stind.r8 stind.ref stloc stloc.0 \
stloc.1 stloc.2 stloc.3 stloc.s stobj stsfld sub sub.ovf sub.ovf.un switch \
tail. throw unaligned. unbox unbox.any volatile. xor

# Set lexer keywords
keywords.$(file.patterns.cil)=$(keywordclass.cil.main)
keywords2.$(file.patterns.cil)=$(keywordclass.cil.metadata)
keywords3.$(file.patterns.cil)=$(keywordclass.cil.opcode)

# Comment insertion
comment.block.cil=//
comment.stream.start.cil=/*
comment.stream.end.cil=*/
comment.box.start.cil=/*
comment.box.middle.cil= *
comment.box.end.cil=*/

# Auto indentation
block.start.$(file.patterns.cil)=8 {
block.end.$(file.patterns.cil)=8 }

# Folding
fold.cil.comment.multiline=0

# Lexer styling
# Default/uncategorized
style.cil.0=fore:#000000
# Stream comment
style.cil.1=$(colour.code.comment.box),$(font.comment)
# Line comment
style.cil.2=$(colour.code.comment.line),$(font.comment)
# Word 1
style.cil.3=fore:#00007F,bold
# Word 2
style.cil.4=fore:#C80000,bold
# Word 3
style.cil.5=fore:#0040E0
# String
style.cil.6=fore:#7F007F
# Label
style.cil.7=fore:#808080
# Operator
style.cil.8=$(colour.operator),bold
# Identifier
style.cil.9=fore:#000000
# End of line where string is not closed
style.cil.10=fore:#000000,$(font.monospace),back:#E0C0E0,eolfilled

if PLAT_WIN
    # https://docs.microsoft.com/en-us/dotnet/framework/tools/ilasm-exe-il-assembler
    command.compile.$(file.patterns.cil)=ilasm /nologo $(FileNameExt)
    command.compile.subsystem.$(file.patterns.cil)=1
    
    command.go.$(file.patterns.cil)=$(FileName).exe
    command.go.subsystem.$(file.patterns.cil)l=1
    
    command.help.$(file.patterns.cil)=ilasm /?