Ejemplo n.º 1
0
 public static void AddDefault(List <KeywordUsage> keywordUsages, string codeBlock)
 {
     keywordUsages.Add(new KeywordUsage(Glossary.Macros[FunctionKeyword.DEFAULT], codeBlock)
     {
         arguments      = ArgumentRange.Between(2, 3),
         onFeedCodeFile = (fileData, codeFile, codeInfos, arguments, data) =>
         {
             codeInfos.classDefaultType       = arguments[0].Content;
             codeInfos.classDefaultValue      = arguments[1].Content;
             codeInfos.classDefaultExportOnly = (arguments.Count == 2 || arguments[2].Content == "false") ? false : true;
             return(true);
         }
     });
 }
Ejemplo n.º 2
0
        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);
                }
            });
        }