public static void AddVars(List <KeywordUsage> keywordUsages) { keywordUsages.Add(new KeywordUsage(Glossary.Macros[VariableKeyword.VARS], Glossary.Macros[FunctionKeyword.CLASS_INFO]) { arguments = ArgumentRange.AtLeast(1), onFeedCodeFile = (fileData, codeFile, codeInfos, arguments, data) => { return(codeInfos.SetClassVars(arguments)); } }); }
public static void AddDefineContainer(List <KeywordUsage> keywordUsages, string codeBlock) { keywordUsages.Add(new KeywordUsage(Glossary.Macros[FunctionKeyword.DEFINE_CONTAINER], codeBlock) { arguments = 1, needOpenScope = true, onFeedCodeFile = (fileData, codeFile, codeInfos, arguments, data) => { codeInfos.blockClassName = arguments[0].Content; return(true); } }); keywordUsages.Add(new KeywordUsage(Glossary.Macros[FunctionKeyword.TYPE], Glossary.Macros[FunctionKeyword.DEFINE_CONTAINER]) { arguments = ArgumentRange.Between(1, 2), onFeedCodeFile = (fileData, codeFile, codeInfos, arguments, data) => { codeInfos.blockClassPrefix.Add(arguments[0].Content); if (arguments.Count == 2) { codeInfos.blockClassParent = arguments[1].Content; } return(true); } }); keywordUsages.Add(new KeywordUsage(Glossary.Macros[FunctionKeyword.ATTRIBUTES], Glossary.Macros[FunctionKeyword.DEFINE_CONTAINER]) { arguments = ArgumentRange.AtLeast(1), onFeedCodeFile = (fileData, codeFile, codeInfos, arguments, data) => { for (int a = arguments.Count - 1; a >= 0; a--) { codeInfos.blockClassPrefix.Insert(0, arguments[a].Content); } return(true); } }); }
public static void AddUsing(List <KeywordUsage> keywordUsages, string codeBlock) { Func <List <IKeyword>, string> feedMethod = (arguments) => { var content = string.Empty; foreach (var argument in arguments) { if (string.IsNullOrEmpty(content)) { content += " "; } content += argument.Content; } return(content); }; keywordUsages.Add(new KeywordUsage(Glossary.Macros[FunctionKeyword.USING], Glossary.Macros[FunctionKeyword.FILE_INFO]) { arguments = ArgumentRange.AtLeast(1), onFeedCodeFile = (fileData, codeFile, codeInfos, arguments, data) => { codeFile.AddNamespace(feedMethod(arguments)); return(true); } }); keywordUsages.Add(new KeywordUsage(Glossary.Macros[FunctionKeyword.USING], codeBlock) { arguments = ArgumentRange.AtLeast(1), onFeedCodeFile = (fileData, codeFile, codeInfos, arguments, data) => { codeInfos.AddNamespace(feedMethod(arguments)); return(true); } }); }