Example #1
0
        private void getMethodParameters(string methodDeclaration)
        {
            if (!string.IsNullOrWhiteSpace(BaseMethodDefinition))
            {
                methodDeclaration = methodDeclaration.Replace(BaseMethodDefinition, "");
            }
            if (!string.IsNullOrWhiteSpace(_condensedGenericMethodTypeConditions))
            {
                methodDeclaration = methodDeclaration.Replace(_condensedGenericMethodTypeConditions, "");
            }
            var parameterBlock       = ParenthesisBlock.InnerBlock(methodDeclaration);
            var inlineParameterBlock = parameterBlock.AsSingleLine();

            if (string.IsNullOrEmpty(inlineParameterBlock))
            {
                return;
            }
            var condensedParamBlock = GenericTypeBlock.SymboliseBlock(inlineParameterBlock, this);

            condensedParamBlock = AttributeBlock.SymboliseBlock(condensedParamBlock, this);
            foreach (var parameter in condensedParamBlock.Split(','))
            {
                Parameters.Add(new DeclaredParameter(parameter.Trim(), this));
            }
        }
Example #2
0
        /* Attribútum mixin-t nézünk meg.
         *
         * Végigmegyünk az összes benne foglalt attribútumon, és ami helyes azt hozzáadjuk az AttributeBlock listájához.
         * Ami nem volt helyes, arre a VisitAttr dob majd egy warning-ot és szimplán nem vesszük figyelembe.
         * A duplikátumokat a listába adás visszatérési értékével szűrjük, a false jelentése, hogy duplikátum keletkezett
         * és a régebbi attribútum eltávolításra került.
         * Mindig a forráskódban lentebb lévő attribútum fogja hordozni a valódi értéket.
         *
         * Kivétel a rotation-axis és rotation-angle, mert könnyen lehet, hogy a felhasználó forgatások sorozatát akarja alkalmazni.
         */
        public override object VisitAttr_group([NotNull] DDD_layout_scriptParser.Attr_groupContext context)
        {
            AttributeBlock attributeBlock = new AttributeBlock(context.STRING().GetText());

            foreach (var attr in context.attr())
            {
                dynamic attrToAdd = VisitAttr(attr);
                if (attrToAdd == null)
                {
                    continue;
                }

                attrToAdd = (Attribute)attrToAdd;
                if (attributeBlock.Add(attrToAdd) == false)
                {
                    alerts.Add(new warning(attr.Start.Line, $"Attribute value '{attrToAdd.Name}' is set twice or more. Only the last defined will be valid"));
                }
            }

            foreach (var attrBlock in attributeBlocks)
            {
                if (attrBlock.Name == attributeBlock.Name)
                {
                    alerts.Add(new error(context.Start.Line, $"There is another attr-block defined with the name '{attributeBlock.Name}'. This one is ignored"));
                    return(null);
                }
            }

            attributeBlocks.Add(attributeBlock);
            return(null);
        }
Example #3
0
 private void getParameterAttributes(ref string parameterContent)
 {
     if (!parameterContent.Contains("__ATTRIBUTE_BLOCK__"))
     {
         return;
     }
     AttributeBlock.GetAttributes(ref parameterContent, this);
 }
Example #4
0
    //Trinket??

    public virtual void Awake()
    {
        position  = new Vector2();
        stats     = new AttributeBlock();
        inventory = new Inventory();
        rb        = GetComponent <Rigidbody2D>();

        stats     = new AttributeBlock();
        inventory = new Inventory();
    }
Example #5
0
 public object VisitAttributeBlock(AttributeBlock attributeBlock, object data)
 {
     throw new NotImplementedException();
 }