Exemplo n.º 1
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");
            }
        }
Exemplo n.º 2
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");
            }
        }
Exemplo n.º 3
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");
            }
        }