Skip to content

Instantly share code, notes, and snippets.

@november-kilo
Created December 19, 2018 02:55
Show Gist options
  • Save november-kilo/2ef0aa543d2968bc94ae47907e907ca2 to your computer and use it in GitHub Desktop.
Save november-kilo/2ef0aa543d2968bc94ae47907e907ca2 to your computer and use it in GitHub Desktop.
DGD LPC extension for Prism JS
.nk {
font-weight: bold;
}
.highlight {
background: rgb(245, 245,245);
}
code.is-prism-pre-code {
border: 0;
font-family: 'Source Code Pro', 'monospace';
font-size: .9em;
line-height: .9em !important;
padding-left: 0 !important;
text-shadow: none !important;
}
p, dd {
text-align: justify;
}
a.reference.internal span.doc {
font-family: 'Source Code Pro', 'monospace';
font-size: .9em;
}
.token.kfun, .token.ekfun {
color: #ff1493;
}
.token.lwo {
color: #8a2be2;
}
pre[class*="language-"] {
margin-bottom: 1em;
}
delete Prism.languages.cpp['class-name'];
delete Prism.languages.c['constant'];
delete Prism.languages.c['keyword'];
delete Prism.languages.cpp['keyword'];
Prism.languages.dgdlpc = Prism.languages.extend('cpp', {
'keyword': /\b(?:atomic|break|case|continue|default|do|else|float|for|goto|if|inherit|int|mapping|mixed|new|nil|nomask|object|private|return|rlimits|static|string|switch|varargs|void|while)\b/,
'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/,
'boolean': /\b(?:TRUE|FALSE)\b/,
'number': /(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i,
'kfun' : /\b(?:acos|allocate|allocate_float|allocate_int|asin|asn_add|asn_and|asn_cmp|asn_div|asn_lshift|asn_mod|asn_mult|asn_or|asn_pow|asn_rshift|asn_sub|asn_xor|atan|atan2|block_input|call_function|call_other|call_out|call_touch|call_trace|ceil|clone_object|compile_object|connect|cos|cosh|crypt|ctime|datagram_challenge|decrypt|destruct_object|dump_state|editor|encrypt|error|exp|exp_dist|explode|extend_function|fabs|find_object|floor|fmod|frexp|function_object|get_dir|hash_crc16|hash_crc32|hash_string|implode|instanceof|ldexp|log|log10|make_dir|map_indices|map_sizeof|map_values|millitime|modf|new_function|new_object|object_name|parse_string|pow|previous_object|previous_program|query_editor|query_ip_name|query_ip_number|random|read_file|remove_call_out|remove_dir|remove_file|rename_file|restore_object|save_object|send_datagram|send_message|shutdown|sin|sinh|sizeof|sqrt|sscanf|status|strlen|swapout|tan|tanh|this_object|this_user|time|typeof|users|write_file)\b/,
'constant': /\b(?:T_NIL|T_INT|T_FLOAT|T_STRING|T_OBJECT|T_ARRAY|T_MAPPING|ST_VERSION|ST_STARTTIME|ST_BOOTTIME|ST_UPTIME|ST_SWAPSIZE|ST_SWAPUSED|ST_SECTORSIZE|ST_SWAPRATE1|ST_SWAPRATE5|ST_SMEMSIZE|ST_SMEMUSED|ST_DMEMSIZE|ST_DMEMUSED|ST_OTABSIZE|ST_NOBJECTS|ST_COTABSIZE|ST_NCOSHORT|ST_NCOLONG|ST_UTABSIZE|ST_ETABSIZE|ST_STRSIZE|ST_ARRAYSIZE|ST_STACKDEPTH|ST_TICKS|ST_DATAGRAMPORTS|ST_TELNETPORTS|ST_BINARYPORTS|O_COMPILETIME|O_PROGSIZE|O_DATASIZE|O_NSECTORS|O_CALLOUTS|O_INDEX|O_UNDEFINED|CO_HANDLE|CO_FUNCTION|CO_DELAY|CO_FIRSTXARG|TRACE_OBJNAME|TRACE_PROGNAME|TRACE_FUNCTION|TRACE_LINE|TRACE_EXTERNAL|TRACE_FIRSTARG)\b/
});
Prism.languages.insertBefore('dgdlpc', 'keyword', {
'class-name': {
pattern: /\b(?:Continuation|ContinuationToken|ChainedContinuation|DelayedContinuation|DistContituation|Iterable|IterativeContinuation|Iterator|String)\b/,
lookbehind: true,
alias: 'lwo'
}
});
Prism.languages.insertBefore('dgdlpc', 'string', {
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment