Created
December 30, 2018 09:23
-
-
Save MrStonedOne/638530e2f25332ff21b374caa8ad7060 to your computer and use it in GitHub Desktop.
object defined template language preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/client/verb/Display_Tokens() | |
var/list/characterMappings = list() | |
for (var/type in typesof(/datum/templateToken)) | |
var/datum/templateToken/tType = type | |
var/character = initial(tType.character) | |
var/word = initial(tType.word) | |
if (isnull(character)) | |
continue | |
var/list/characterMapping = characterMappings["[character]"] | |
if (!characterMapping) | |
characterMapping = (characterMappings["[character]"] = list()) | |
characterMapping[word] = tType | |
world.log << json_encode(characterMappings) | |
/datum/templateToken | |
//instance vars | |
//--snip-- | |
//parser vars (compile time values only) | |
//what starting character does this token listen for, empty string for default, null to disable parsing | |
var/character | |
//what word (after the starting character) does this token listen for. | |
//empty string to cover blank tokens, null for wildcard/default. | |
var/word | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"!":{ | |
null:"/datum/templateToken/TStringLiteral/TEscapedVariable" | |
}, | |
"%":{ | |
null:"/datum/templateToken/TVariable/Updating", | |
"":"/datum/templateToken/TConditional/TUpdatingBlock" | |
}, | |
"$":{ | |
null:"/datum/templateToken/TVariable/HTMLSanitize" | |
}, | |
"&":{ | |
null:"/datum/templateToken/TVariable/URLSanitize" | |
}, | |
"*":{ | |
null:"/datum/templateToken/TVariable/NoSanitize" | |
}, | |
"":{ | |
null:"/datum/templateToken/TVariable" | |
}, | |
"/":{ | |
null:"/datum/templateToken/TClosure" | |
}, | |
"#":{ | |
"default":"/datum/templateToken/TConditional/TElse/TDefault", | |
"else":"/datum/templateToken/TConditional/TElse", | |
"foreach":"/datum/templateToken/TConditional/TIfEmpty/TIfnEmpty/TForEach", | |
"!ifempty":"/datum/templateToken/TConditional/TIfEmpty/TIfnEmpty/Reversed", | |
"ifempty!":"/datum/templateToken/TConditional/TIfEmpty/TIfnEmpty", | |
"ifempty":"/datum/templateToken/TConditional/TIfEmpty", | |
"!if":"/datum/templateToken/TConditional/TIf/TIfn/Reversed", | |
"if!":"/datum/templateToken/TConditional/TIf/TIfn", | |
"if":"/datum/templateToken/TConditional/TIf", | |
"switch":"/datum/templateToken/TConditional/TSwitch" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment