示例#1
0
        /// <exception cref="BadSyntaxException">
        /// The <paramref name="declaration"/> does not fit to the syntax.
        /// </exception>
        public override void InitFromString(string declaration)
        {
            Match match = methodRegex.Match(declaration);

            if (match.Success)
            {
                try {
                    Group nameGroup     = match.Groups["name"];
                    Group typeGroup     = match.Groups["type"];
                    Group accessGroup   = match.Groups["access"];
                    Group modifierGroup = match.Groups["modifier"];
                    Group staticGroup   = match.Groups["static"];
                    Group operatorGroup = match.Groups["operator"];
                    Group convopGroup   = match.Groups["convop"];
                    Group argsGroup     = match.Groups["args"];

                    base.Name            = nameGroup.Value;
                    base.Type            = typeGroup.Value;
                    IsOperator           = operatorGroup.Success;
                    IsConversionOperator = convopGroup.Success;
                    AccessModifier       = SyntaxHelper.ParseAccessModifier(accessGroup.Value);
                    Modifier             = SyntaxHelper.ParseOperationModifier(modifierGroup.Value);
                    IsStatic             = staticGroup.Success;
                    ParameterList.InitFromString(argsGroup.Value);
                }
                catch (BadSyntaxException ex) {
                    throw new BadSyntaxException("error_invalid_declaration" + ex.Message);
                }
            }
            else
            {
                throw new BadSyntaxException("error_invalid_declaration");
            }
        }
示例#2
0
        /// <exception cref="BadSyntaxException">
        /// The <paramref name="declaration"/> does not fit to the syntax.
        /// </exception>
        public override void InitFromString(string declaration)
        {
            Match match = fieldRegex.Match(declaration);

            if (match.Success)
            {
                try {
                    Group nameGroup     = match.Groups["name"];
                    Group typeGroup     = match.Groups["type"];
                    Group accessGroup   = match.Groups["access"];
                    Group staticGroup   = match.Groups["static"];
                    Group readonlyGroup = match.Groups["readonly"];
                    Group constGroup    = match.Groups["const"];
                    Group initGroup     = match.Groups["initvalue"];

                    Name           = nameGroup.Value;
                    Type           = typeGroup.Value;
                    AccessModifier = SyntaxHelper.ParseAccessModifier(accessGroup.Value);
                    IsStatic       = staticGroup.Success;
                    IsReadonly     = readonlyGroup.Success;
                    InitialValue   = (initGroup.Success) ? initGroup.Value : "";
                    IsConst        = constGroup.Success;
                }
                catch (BadSyntaxException ex) {
                    throw new BadSyntaxException("error_invalid_declaration" + ex.Message);
                }
            }
            else
            {
                throw new BadSyntaxException("error_invalid_declaration");
            }
        }
示例#3
0
        /// <exception cref="BadSyntaxException">
        /// The <paramref name="declaration"/> does not fit to the syntax.
        /// </exception>
        public override void InitFromString(string declaration)
        {
            Match match = eventRegex.Match(declaration);

            if (match.Success)
            {
                try {
                    Group nameGroup     = match.Groups["name"];
                    Group typeGroup     = match.Groups["type"];
                    Group accessGroup   = match.Groups["access"];
                    Group modifierGroup = match.Groups["modifier"];
                    Group staticGroup   = match.Groups["static"];

                    Name           = nameGroup.Value;
                    Type           = typeGroup.Value;
                    AccessModifier = SyntaxHelper.ParseAccessModifier(accessGroup.Value);
                    Modifier       = SyntaxHelper.ParseOperationModifier(modifierGroup.Value);
                    IsStatic       = staticGroup.Success;
                }
                catch (BadSyntaxException ex) {
                    throw new BadSyntaxException("error_invalid_declaration" + ex.Message);
                }
            }
            else
            {
                throw new BadSyntaxException("error_invalid_declaration");
            }
        }
示例#4
0
        /// <exception cref="BadSyntaxException">
        /// An error occured in building the class.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="node"/> is null.
        /// </exception>
        internal override void Deserialize(XmlNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            XmlElement child = node["Access"];

            if (child != null)
            {
                access = SyntaxHelper.ParseAccessModifier(child.InnerText);
            }
        }
示例#5
0
        /// <exception cref="BadSyntaxException">
        /// The <paramref name="declaration"/> does not fit to the syntax.
        /// </exception>
        public override void InitFromString(string declaration)
        {
            Match match = propertyRegex.Match(declaration);

            if (match.Success)
            {
                try {
                    ReadAccess  = AccessModifier.Default;
                    WriteAccess = AccessModifier.Default;

                    Group nameGroup      = match.Groups["name"];
                    Group typeGroup      = match.Groups["type"];
                    Group accessGroup    = match.Groups["access"];
                    Group modifierGroup  = match.Groups["modifier"];
                    Group staticGroup    = match.Groups["static"];
                    Group argsGroup      = match.Groups["args"];
                    Group getGroup       = match.Groups["get"];
                    Group setGroup       = match.Groups["set"];
                    Group getAccessGroup = match.Groups["getaccess"];
                    Group setAccessGroup = match.Groups["setaccess"];

                    Name           = nameGroup.Value;
                    Type           = typeGroup.Value;
                    AccessModifier = SyntaxHelper.ParseAccessModifier(accessGroup.Value);
                    Modifier       = SyntaxHelper.ParseOperationModifier(modifierGroup.Value);
                    IsStatic       = staticGroup.Success;
                    ParameterList.InitFromString(argsGroup.Value);
                    IsReadonly  = getGroup.Success && !setGroup.Success;
                    IsWriteonly = !getGroup.Success && setGroup.Success;
                    ReadAccess  = SyntaxHelper.ParseAccessModifier(getAccessGroup.Value);
                    WriteAccess = SyntaxHelper.ParseAccessModifier(setAccessGroup.Value);
                }
                catch (BadSyntaxException ex) {
                    throw new BadSyntaxException("error_invalid_declaration" + ex.Message);
                }
            }
            else
            {
                throw new BadSyntaxException("error_invalid_declaration");
            }
        }