public StructDescription(AStructDecl structDecl)
        {
            Parser parser = new Parser(structDecl);

            Name = parser.Name;
            IsEnum = Name.StartsWith("enum ");
            if (IsEnum)
            {
                Name = Name.Substring(5);
                foreach (VariableDescription field in parser.Fields)
                {
                    field.PlacementPrefix = "Enum Field";
                }
            }
            Fields = parser.Fields;

            Methods = parser.Methods;
            Constructors = parser.Constructors;
            Deconstructors = parser.Deconstructors;
            LineFrom = structDecl.GetName().Line;
            LineTo = structDecl.GetEndToken().Line;
            if (structDecl.GetBase() is AGenericType)
                BaseRef = (ANamedType) ((AGenericType) structDecl.GetBase()).GetBase();
            else
                BaseRef = (ANamedType) structDecl.GetBase();
            structDecl.RemoveChild(BaseRef);
            foreach (TIdentifier identifier in structDecl.GetGenericVars())
            {
                GenericVars.Add(identifier.Text);
            }
            IsClass = structDecl.GetClassToken() != null;
            Visibility = (PVisibilityModifier)structDecl.GetVisibilityModifier().Clone();
            Position = TextPoint.FromCompilerCoords(structDecl.GetName());
        }
Beispiel #2
0
        public VariableDescription(AALocalDecl localDecl, VariableTypes type)
        {
            Name = localDecl.GetName().Text;
            Type = Util.TypeToString(localDecl.GetType());
            switch (type)
            {
            case VariableTypes.LocalVariable:
                PlacementPrefix = "Local";
                break;

            case VariableTypes.Parameter:
                PlacementPrefix = "Parameter";
                break;

            case VariableTypes.StructVariable:
                PlacementPrefix = "Struct field";
                break;

            default:
                PlacementPrefix = "";
                break;
            }
            VariableType = type;
            Const        = localDecl.GetConst() != null;
            IsStatic     = localDecl.GetStatic() != null;
            Visibility   = localDecl.GetVisibilityModifier();
            realType     = (PType)localDecl.GetType().Clone();
            init         = localDecl.GetInit();
            Line         = localDecl.GetName().Line;
            Position     = TextPoint.FromCompilerCoords(localDecl.GetName());
        }
 public VariableDescription(AALocalDecl localDecl, VariableTypes type)
 {
     Name = localDecl.GetName().Text;
     Type = Util.TypeToString(localDecl.GetType());
     switch (type)
     {
         case VariableTypes.LocalVariable:
             PlacementPrefix = "Local";
             break;
         case VariableTypes.Parameter:
             PlacementPrefix = "Parameter";
             break;
         case VariableTypes.StructVariable:
             PlacementPrefix = "Struct field";
             break;
         default:
             PlacementPrefix = "";
             break;
     }
     VariableType = type;
     Const = localDecl.GetConst() != null;
     IsStatic = localDecl.GetStatic() != null;
     Visibility = localDecl.GetVisibilityModifier();
     realType = (PType) localDecl.GetType().Clone();
     init = localDecl.GetInit();
     Line = localDecl.GetName().Line;
     Position = TextPoint.FromCompilerCoords(localDecl.GetName());
 }
Beispiel #4
0
 public VariableDescription(ATriggerDecl triggerDecl)
 {
     Name            = triggerDecl.GetName().Text;
     Type            = "trigger";
     PlacementPrefix = "Field";
     VariableType    = VariableTypes.Field;
     Const           = false;
     IsStatic        = false;
     realType        = new ANamedType(new TIdentifier("trigger"), null);
     Visibility      = (PVisibilityModifier)triggerDecl.GetVisibilityModifier().Clone();
     Line            = triggerDecl.GetName().Line;
     Position        = TextPoint.FromCompilerCoords(triggerDecl.GetActionsToken());
 }
 public VariableDescription(ATriggerDecl triggerDecl)
 {
     Name = triggerDecl.GetName().Text;
     Type = "trigger";
     PlacementPrefix = "Field";
     VariableType = VariableTypes.Field;
     Const = false;
     IsStatic = false;
     realType = new ANamedType(new TIdentifier("trigger"), null);
     Visibility = (PVisibilityModifier)triggerDecl.GetVisibilityModifier().Clone();
     Line = triggerDecl.GetName().Line;
     Position = TextPoint.FromCompilerCoords(triggerDecl.GetActionsToken());
 }
Beispiel #6
0
 public VariableDescription(AFieldDecl fieldDecl)
 {
     Name            = fieldDecl.GetName().Text;
     Type            = Util.TypeToString(fieldDecl.GetType());
     PlacementPrefix = "Field";
     VariableType    = VariableTypes.Field;
     Const           = fieldDecl.GetConst() != null;
     IsStatic        = fieldDecl.GetStatic() != null;
     Visibility      = fieldDecl.GetVisibilityModifier();
     realType        = (PType)fieldDecl.GetType().Clone();
     init            = fieldDecl.GetInit();
     Line            = fieldDecl.GetName().Line;
     Position        = TextPoint.FromCompilerCoords(fieldDecl.GetName());
 }
 public VariableDescription(AFieldDecl fieldDecl)
 {
     Name = fieldDecl.GetName().Text;
     Type = Util.TypeToString(fieldDecl.GetType());
     PlacementPrefix = "Field";
     VariableType = VariableTypes.Field;
     Const = fieldDecl.GetConst() != null;
     IsStatic = fieldDecl.GetStatic() != null;
     Visibility = fieldDecl.GetVisibilityModifier();
     realType = (PType)fieldDecl.GetType().Clone();
     init = fieldDecl.GetInit();
     Line = fieldDecl.GetName().Line;
     Position = TextPoint.FromCompilerCoords(fieldDecl.GetName());
 }
Beispiel #8
0
 public VariableDescription(APropertyDecl property)
 {
     Name            = property.GetName().Text;
     IsArrayProperty = Name == "array property";
     if (IsArrayProperty)
     {
         Name = "";
     }
     Type            = Util.TypeToString(property.GetType());
     PlacementPrefix = "Property";
     VariableType    = VariableTypes.Field;
     Const           = false;
     IsStatic        = property.GetStatic() != null;
     Visibility      = property.GetVisibilityModifier();
     realType        = (PType)property.GetType().Clone();
     Line            = property.GetName().Line;
     Position        = TextPoint.FromCompilerCoords(property.GetName());
 }
        public MethodDescription(AConstructorDecl method, string type)
        {
            Parser parser = new Parser(method);

            Start = parser.Start;
            End = parser.End;
            ReturnType = type;
            Name = parser.Name;
            Formals = parser.Formals;
            Locals = parser.Locals;
            if (method.Parent() != null)
                method.Parent().RemoveChild(method);
            Decl = new AMethodDecl(new APublicVisibilityModifier(), null, null, null, null, null, new ANamedType(new TIdentifier(type), null),
                                   new TIdentifier(""), new ArrayList(), method.GetBlock());
            while (method.GetFormals().Count > 0)
                Decl.GetFormals().Add(method.GetFormals()[0]);
            Visibility = method.GetVisibilityModifier();
            Position = TextPoint.FromCompilerCoords(method.GetName());
        }
        public MethodDescription(AMethodDecl method)
        {
            Parser parser = new Parser(method);

            Start = parser.Start;
            End = parser.End;
            ReturnType = parser.ReturnType;
            Name = parser.Name;
            Formals = parser.Formals;
            Locals = parser.Locals;
            if (method.Parent() != null)
                method.Parent().RemoveChild(method);
            IsDelegate = method.GetDelegate() != null;
            //if (!IsDelegate)
                Decl = method;
            IsStatic = method.GetStatic() != null;
            Visibility = method.GetVisibilityModifier();
            realType = (PType)method.GetReturnType().Clone();
            Position = TextPoint.FromCompilerCoords(method.GetName());
        }
Beispiel #11
0
        public MethodDescription(ADeconstructorDecl method)
        {
            Parser parser = new Parser(method);


            Start      = parser.Start;
            End        = parser.End;
            ReturnType = "void";
            Name       = parser.Name;
            Formals    = parser.Formals;
            Locals     = parser.Locals;
            if (method.Parent() != null)
            {
                method.Parent().RemoveChild(method);
            }
            while (method.GetFormals().Count > 0)
            {
                Decl.GetFormals().Add(method.GetFormals()[0]);
            }
            Visibility = method.GetVisibilityModifier();
            Position   = TextPoint.FromCompilerCoords(method.GetName());
        }
Beispiel #12
0
        public StructDescription(AStructDecl structDecl)
        {
            Parser parser = new Parser(structDecl);

            Name   = parser.Name;
            IsEnum = Name.StartsWith("enum ");
            if (IsEnum)
            {
                Name = Name.Substring(5);
                foreach (VariableDescription field in parser.Fields)
                {
                    field.PlacementPrefix = "Enum Field";
                }
            }
            Fields = parser.Fields;

            Methods        = parser.Methods;
            Constructors   = parser.Constructors;
            Deconstructors = parser.Deconstructors;
            LineFrom       = structDecl.GetName().Line;
            LineTo         = structDecl.GetEndToken().Line;
            if (structDecl.GetBase() is AGenericType)
            {
                BaseRef = (ANamedType)((AGenericType)structDecl.GetBase()).GetBase();
            }
            else
            {
                BaseRef = (ANamedType)structDecl.GetBase();
            }
            structDecl.RemoveChild(BaseRef);
            foreach (TIdentifier identifier in structDecl.GetGenericVars())
            {
                GenericVars.Add(identifier.Text);
            }
            IsClass    = structDecl.GetClassToken() != null;
            Visibility = (PVisibilityModifier)structDecl.GetVisibilityModifier().Clone();
            Position   = TextPoint.FromCompilerCoords(structDecl.GetName());
        }
Beispiel #13
0
        public MethodDescription(AMethodDecl method)
        {
            Parser parser = new Parser(method);


            Start      = parser.Start;
            End        = parser.End;
            ReturnType = parser.ReturnType;
            Name       = parser.Name;
            Formals    = parser.Formals;
            Locals     = parser.Locals;
            if (method.Parent() != null)
            {
                method.Parent().RemoveChild(method);
            }
            IsDelegate = method.GetDelegate() != null;
            //if (!IsDelegate)
            Decl       = method;
            IsStatic   = method.GetStatic() != null;
            Visibility = method.GetVisibilityModifier();
            realType   = (PType)method.GetReturnType().Clone();
            Position   = TextPoint.FromCompilerCoords(method.GetName());
        }
Beispiel #14
0
        public MethodDescription(AConstructorDecl method, string type)
        {
            Parser parser = new Parser(method);


            Start      = parser.Start;
            End        = parser.End;
            ReturnType = type;
            Name       = parser.Name;
            Formals    = parser.Formals;
            Locals     = parser.Locals;
            if (method.Parent() != null)
            {
                method.Parent().RemoveChild(method);
            }
            Decl = new AMethodDecl(new APublicVisibilityModifier(), null, null, null, null, null, new ANamedType(new TIdentifier(type), null),
                                   new TIdentifier(""), new ArrayList(), method.GetBlock());
            while (method.GetFormals().Count > 0)
            {
                Decl.GetFormals().Add(method.GetFormals()[0]);
            }
            Visibility = method.GetVisibilityModifier();
            Position   = TextPoint.FromCompilerCoords(method.GetName());
        }
 public AThisArrayPropertyDecl(
         PVisibilityModifier _visibility_modifier_,
         PType _type_,
         TThis _token_,
         PType _arg_type_,
         TIdentifier _arg_name_,
         PBlock _getter_,
         PBlock _setter_
 )
 {
     SetVisibilityModifier(_visibility_modifier_);
     SetType(_type_);
     SetToken(_token_);
     SetArgType(_arg_type_);
     SetArgName(_arg_name_);
     SetGetter(_getter_);
     SetSetter(_setter_);
 }
 internal override void RemoveChild(Node child)
 {
     if (_visibility_modifier_ == child)
     {
         _visibility_modifier_ = null;
         return;
     }
     if (_class_token_ == child)
     {
         _class_token_ = null;
         return;
     }
     if (_dimention_ == child)
     {
         _dimention_ = null;
         return;
     }
     if (_int_dim_ == child)
     {
         _int_dim_ = null;
         return;
     }
     if (_end_token_ == child)
     {
         _end_token_ = null;
         return;
     }
     if (_name_ == child)
     {
         _name_ = null;
         return;
     }
     if (_generic_vars_.Contains(child))
     {
         _generic_vars_.Remove(child);
         return;
     }
     if (_base_ == child)
     {
         _base_ = null;
         return;
     }
     if (_locals_.Contains(child))
     {
         _locals_.Remove(child);
         return;
     }
 }
 public AStructDecl(
         PVisibilityModifier _visibility_modifier_,
         TClassToken _class_token_,
         PExp _dimention_,
         TIntegerLiteral _int_dim_,
         TRBrace _end_token_,
         TIdentifier _name_,
         IList _generic_vars_,
         PType _base_,
         IList _locals_
 )
 {
     SetVisibilityModifier(_visibility_modifier_);
     SetClassToken(_class_token_);
     SetDimention(_dimention_);
     SetIntDim(_int_dim_);
     SetEndToken(_end_token_);
     SetName(_name_);
     this._generic_vars_ = new TypedList(new GenericVars_Cast(this));
     this._generic_vars_.Clear();
     this._generic_vars_.AddAll(_generic_vars_);
     SetBase(_base_);
     this._locals_ = new TypedList(new Locals_Cast(this));
     this._locals_.Clear();
     this._locals_.AddAll(_locals_);
 }
 public APropertyDecl(
         PVisibilityModifier _visibility_modifier_,
         TStatic _static_,
         PType _type_,
         TIdentifier _name_,
         PBlock _getter_,
         PBlock _setter_
 )
 {
     SetVisibilityModifier(_visibility_modifier_);
     SetStatic(_static_);
     SetType(_type_);
     SetName(_name_);
     SetGetter(_getter_);
     SetSetter(_setter_);
 }
 public ADeconstructorDecl(
         PVisibilityModifier _visibility_modifier_,
         TIdentifier _name_,
         IList _formals_,
         PBlock _block_
 )
 {
     SetVisibilityModifier(_visibility_modifier_);
     SetName(_name_);
     this._formals_ = new TypedList(new Formals_Cast(this));
     this._formals_.Clear();
     this._formals_.AddAll(_formals_);
     SetBlock(_block_);
 }
 public ATypedefDecl(
         PVisibilityModifier _visibility_modifier_,
         TStatic _static_,
         TTypedef _token_,
         PType _type_,
         PType _name_
 )
 {
     SetVisibilityModifier(_visibility_modifier_);
     SetStatic(_static_);
     SetToken(_token_);
     SetType(_type_);
     SetName(_name_);
 }
 internal override void RemoveChild(Node child)
 {
     if (_visibility_modifier_ == child)
     {
         _visibility_modifier_ = null;
         return;
     }
     if (_static_ == child)
     {
         _static_ = null;
         return;
     }
     if (_token_ == child)
     {
         _token_ = null;
         return;
     }
     if (_name_ == child)
     {
         _name_ = null;
         return;
     }
     if (_values_.Contains(child))
     {
         _values_.Remove(child);
         return;
     }
     if (_end_token_ == child)
     {
         _end_token_ = null;
         return;
     }
 }
 public AALocalDecl(
         PVisibilityModifier _visibility_modifier_,
         TStatic _static_,
         TRef _ref_,
         TOut _out_,
         TConst _const_,
         PType _type_,
         TIdentifier _name_,
         PExp _init_
 )
 {
     SetVisibilityModifier(_visibility_modifier_);
     SetStatic(_static_);
     SetRef(_ref_);
     SetOut(_out_);
     SetConst(_const_);
     SetType(_type_);
     SetName(_name_);
     SetInit(_init_);
 }
        public MethodDescription(ADeconstructorDecl method)
        {
            Parser parser = new Parser(method);

            Start = parser.Start;
            End = parser.End;
            ReturnType = "void";
            Name = parser.Name;
            Formals = parser.Formals;
            Locals = parser.Locals;
            if (method.Parent() != null)
                method.Parent().RemoveChild(method);
            while (method.GetFormals().Count > 0)
                Decl.GetFormals().Add(method.GetFormals()[0]);
            Visibility = method.GetVisibilityModifier();
            Position = TextPoint.FromCompilerCoords(method.GetName());
        }
 public ATriggerDecl(
         PVisibilityModifier _visibility_modifier_,
         TIdentifier _name_,
         TEvents _event_token_,
         PBlock _events_,
         TConditions _conditions_token_,
         PBlock _conditions_,
         TActions _actions_token_,
         PBlock _actions_
 )
 {
     SetVisibilityModifier(_visibility_modifier_);
     SetName(_name_);
     SetEventToken(_event_token_);
     SetEvents(_events_);
     SetConditionsToken(_conditions_token_);
     SetConditions(_conditions_);
     SetActionsToken(_actions_token_);
     SetActions(_actions_);
 }
 internal override void RemoveChild(Node child)
 {
     if (_visibility_modifier_ == child)
     {
         _visibility_modifier_ = null;
         return;
     }
     if (_name_ == child)
     {
         _name_ = null;
         return;
     }
     if (_event_token_ == child)
     {
         _event_token_ = null;
         return;
     }
     if (_events_ == child)
     {
         _events_ = null;
         return;
     }
     if (_conditions_token_ == child)
     {
         _conditions_token_ = null;
         return;
     }
     if (_conditions_ == child)
     {
         _conditions_ = null;
         return;
     }
     if (_actions_token_ == child)
     {
         _actions_token_ = null;
         return;
     }
     if (_actions_ == child)
     {
         _actions_ = null;
         return;
     }
 }
        public void SetVisibilityModifier(PVisibilityModifier node)
        {
            if (_visibility_modifier_ != null)
            {
                _visibility_modifier_.Parent(null);
            }

            if (node != null)
            {
                if (node.Parent() != null)
                {
                    node.Parent().RemoveChild(node);
                }

                node.Parent(this);
            }

            _visibility_modifier_ = node;
        }
 internal override void RemoveChild(Node child)
 {
     if (_visibility_modifier_ == child)
     {
         _visibility_modifier_ = null;
         return;
     }
     if (_static_ == child)
     {
         _static_ = null;
         return;
     }
     if (_token_ == child)
     {
         _token_ = null;
         return;
     }
     if (_type_ == child)
     {
         _type_ = null;
         return;
     }
     if (_name_ == child)
     {
         _name_ = null;
         return;
     }
 }
 public VariableDescription(APropertyDecl property)
 {
     Name = property.GetName().Text;
     IsArrayProperty = Name == "array property";
     if (IsArrayProperty)
         Name = "";
     Type = Util.TypeToString(property.GetType());
     PlacementPrefix = "Property";
     VariableType = VariableTypes.Field;
     Const = false;
     IsStatic = property.GetStatic() != null;
     Visibility = property.GetVisibilityModifier();
     realType = (PType)property.GetType().Clone();
     Line = property.GetName().Line;
     Position = TextPoint.FromCompilerCoords(property.GetName());
 }
 internal override void RemoveChild(Node child)
 {
     if (_visibility_modifier_ == child)
     {
         _visibility_modifier_ = null;
         return;
     }
     if (_name_ == child)
     {
         _name_ = null;
         return;
     }
     if (_formals_.Contains(child))
     {
         _formals_.Remove(child);
         return;
     }
     if (_block_ == child)
     {
         _block_ = null;
         return;
     }
 }
 internal override void RemoveChild(Node child)
 {
     if (_visibility_modifier_ == child)
     {
         _visibility_modifier_ = null;
         return;
     }
     if (_static_ == child)
     {
         _static_ = null;
         return;
     }
     if (_return_type_ == child)
     {
         _return_type_ = null;
         return;
     }
     if (_token_ == child)
     {
         _token_ = null;
         return;
     }
     if (_operator_ == child)
     {
         _operator_ = null;
         return;
     }
     if (_formals_.Contains(child))
     {
         _formals_.Remove(child);
         return;
     }
     if (_block_ == child)
     {
         _block_ = null;
         return;
     }
 }
 public AEnumDecl(
         PVisibilityModifier _visibility_modifier_,
         TStatic _static_,
         TEnum _token_,
         TIdentifier _name_,
         IList _values_,
         TRBrace _end_token_
 )
 {
     SetVisibilityModifier(_visibility_modifier_);
     SetStatic(_static_);
     SetToken(_token_);
     SetName(_name_);
     this._values_ = new TypedList(new Values_Cast(this));
     this._values_.Clear();
     this._values_.AddAll(_values_);
     SetEndToken(_end_token_);
 }
 public AMethodDecl(
         PVisibilityModifier _visibility_modifier_,
         TTrigger _trigger_,
         TStatic _static_,
         TNative _native_,
         TInline _inline_,
         TDelegate _delegate_,
         PType _return_type_,
         TIdentifier _name_,
         IList _formals_,
         PBlock _block_
 )
 {
     SetVisibilityModifier(_visibility_modifier_);
     SetTrigger(_trigger_);
     SetStatic(_static_);
     SetNative(_native_);
     SetInline(_inline_);
     SetDelegate(_delegate_);
     SetReturnType(_return_type_);
     SetName(_name_);
     this._formals_ = new TypedList(new Formals_Cast(this));
     this._formals_.Clear();
     this._formals_.AddAll(_formals_);
     SetBlock(_block_);
 }
 public AFieldDecl(
         PVisibilityModifier _visibility_modifier_,
         TStatic _static_,
         TConst _const_,
         PType _type_,
         TIdentifier _name_,
         PExp _init_
 )
 {
     SetVisibilityModifier(_visibility_modifier_);
     SetStatic(_static_);
     SetConst(_const_);
     SetType(_type_);
     SetName(_name_);
     SetInit(_init_);
 }
 internal override void RemoveChild(Node child)
 {
     if (_visibility_modifier_ == child)
     {
         _visibility_modifier_ = null;
         return;
     }
     if (_trigger_ == child)
     {
         _trigger_ = null;
         return;
     }
     if (_static_ == child)
     {
         _static_ = null;
         return;
     }
     if (_native_ == child)
     {
         _native_ = null;
         return;
     }
     if (_inline_ == child)
     {
         _inline_ = null;
         return;
     }
     if (_delegate_ == child)
     {
         _delegate_ = null;
         return;
     }
     if (_return_type_ == child)
     {
         _return_type_ = null;
         return;
     }
     if (_name_ == child)
     {
         _name_ = null;
         return;
     }
     if (_formals_.Contains(child))
     {
         _formals_.Remove(child);
         return;
     }
     if (_block_ == child)
     {
         _block_ = null;
         return;
     }
 }
 internal override void RemoveChild(Node child)
 {
     if (_visibility_modifier_ == child)
     {
         _visibility_modifier_ = null;
         return;
     }
     if (_static_ == child)
     {
         _static_ = null;
         return;
     }
     if (_ref_ == child)
     {
         _ref_ = null;
         return;
     }
     if (_out_ == child)
     {
         _out_ = null;
         return;
     }
     if (_const_ == child)
     {
         _const_ = null;
         return;
     }
     if (_type_ == child)
     {
         _type_ = null;
         return;
     }
     if (_name_ == child)
     {
         _name_ = null;
         return;
     }
     if (_init_ == child)
     {
         _init_ = null;
         return;
     }
 }
 public AOperatorDecl(
         PVisibilityModifier _visibility_modifier_,
         TStatic _static_,
         PType _return_type_,
         TOperator _token_,
         PBinop _operator_,
         IList _formals_,
         PBlock _block_
 )
 {
     SetVisibilityModifier(_visibility_modifier_);
     SetStatic(_static_);
     SetReturnType(_return_type_);
     SetToken(_token_);
     SetOperator(_operator_);
     this._formals_ = new TypedList(new Formals_Cast(this));
     this._formals_.Clear();
     this._formals_.AddAll(_formals_);
     SetBlock(_block_);
 }