Пример #1
0
        static public EditorGUIElement CreateExplicitEditorGUIElementForType(this Type item, EditProperty property)
        {
            Type element_type = ForTypes.GetBestTypeForType <EditorGUIElementForTypeAttribute>(item);

            if (element_type != null)
            {
                return(element_type.CreateBestInstance <EditorGUIElement>(property, item) ??
                       element_type.CreateBestInstance <EditorGUIElement>(property));
            }

            return(null);
        }
        /// <summary>
        /// Checks if a line contains a valid parallel for pragma.
        /// </summary>
        /// <param name="line">The line of code to analyze.</param>
        /// <returns>The return message.</returns>
        protected ErrorTypes CheckForPragmas(string line)
        {
            string trimmedLine = line.Trim();
            parameterValue = 0;

            if (trimmedLine.StartsWith(parallelFor))
            {
                List<string> pragmaSplit = PragmaTokenizer.ReturnParseSequence(trimmedLine);
                
                if (!parser.ValidateExpression(pragmaSplit, pragmaGrammar))
                {
                    return ErrorTypes.Invalid;
                }
                else
                {
                    List<PIFEntry> tokenizedPragma = PragmaTokenizer.TokenizePragma(trimmedLine);
                    if (tokenizedPragma[3].Symbol == "static")
                    {
                        forType = ForTypes.Static;
                    }
                    else
                    {
                        forType = ForTypes.Dynamic;
                    }

                    if (tokenizedPragma.Count > 4)
                    {
                        if(tokenizedPragma[4].Symbol == "nosync")
                        {
                            noSyncOn = true;
                        }
                        else
                        {
                            parameterValue = Int32.Parse(tokenizedPragma[4].Symbol);
                        }

                        if (tokenizedPragma.Count == 6)
                        {
                            noSyncOn = true;
                        }
                    }
                }

                return ErrorTypes.Valid;
            }

            return ErrorTypes.Missing;
        }