Esempio n. 1
0
        /// <summary>
        /// </summary>
        /// <returns></returns>
        /// <remarks>
        ///
        /// See http://www.dmtf.org/sites/default/files/standards/documents/DSP0221_3.0.0a.pdf
        /// A.14 Complex type value
        ///
        ///     complexTypeValue  = complexValue / complexValueArray
        ///
        /// </remarks>
        internal static ComplexTypeValueAst Parse(ParserStream stream, QualifierListAst qualifiers)
        {
            var node = default(ComplexTypeValueAst);

            var peek = stream.Peek();

            if (peek is BlockOpenToken)
            {
                // complexValueArray
                node = ComplexValueArrayAst.Parse(stream);
            }
            else if (peek is IdentifierToken)
            {
                // complexValue
                node = ComplexValueAst.Parse(stream);
            }
            else
            {
                throw new UnexpectedTokenException(peek);
            }

            node.Qualifiers = qualifiers;

            return(node);
        }
 /// <summary>
 /// </summary>
 /// <returns></returns>
 /// <remarks>
 /// 
 /// See http://www.dmtf.org/sites/default/files/standards/documents/DSP0221_3.0.0a.pdf
 /// A.14 Complex type value
 /// 
 ///     complexTypeValue  = complexValue / complexValueArray
 ///     complexValueArray = "{" [ complexValue *( "," complexValue) ] "}"
 ///     complexValue      = ( INSTANCE / VALUE ) OF
 ///                         ( structureName / className / associationName )
 ///                         [ alias ] propertyValueList ";"
 ///     propertyValueList = "{" *propertySlot "}"
 ///     propertySlot      = propertyName "=" propertyValue ";"
 ///     propertyValue     = primitiveTypeValue / complexTypeValue / referenceTypeValue / enumTypeValue
 ///     alias             = AS aliasIdentifier
 ///     INSTANCE          = "instance" ; keyword: case insensitive
 ///     VALUE             = "value"    ; keyword: case insensitive
 ///     AS                = "as"       ; keyword: case insensitive
 ///     OF                = "of"       ; keyword: case insensitive 
 /// 
 ///     propertyName      = IDENTIFIER
 /// 
 /// </remarks>
 internal static new ComplexValueArrayAst Parse(ParserStream stream)
 {
     // complexValueArray =
     var node = new ComplexValueArrayAst();
     // "{"
     stream.Read<BlockOpenToken>();
     // [ complexValue
     node.Values.Add(ComplexValueAst.Parse(stream));
     // *( "," complexValue) ]
     while (stream.Peek<CommaToken>() != null)
     {
         stream.Read<CommaToken>();
         node.Values.Add(ComplexValueAst.Parse(stream));
     }
     // "}"
     stream.Read<BlockCloseToken>();
     // return the result
     return node;
 }
Esempio n. 3
0
        /// <summary>
        /// </summary>
        /// <returns></returns>
        /// <remarks>
        ///
        /// See http://www.dmtf.org/sites/default/files/standards/documents/DSP0221_3.0.0a.pdf
        /// A.14 Complex type value
        ///
        ///     propertyValue = primitiveTypeValue / complexTypeValue / referenceTypeValue / enumTypeValue
        ///
        /// 7.3.5
        ///
        ///     primitiveTypeValue = literalValue / literalValueArray
        ///     primitiveType = DT_Integer / DT_Real / DT_STRING / DT_DATETIME / DT_BOOLEAN / DT_OCTETSTRING
        ///
        /// A.1
        ///
        ///     complexTypeValue = complexValue / complexValueArray
        ///
        /// A.19
        ///
        ///     referenceTypeValue  = referenceValue / referenceValueArray
        ///     referenceValueArray = "{" [ objectPathValue *( "," objectPathValue ) ] 1163 "}"
        ///
        /// A.7
        ///
        ///     enumTypeValue = enumValue / enumValueArray
        ///     enumDeclaration = enumTypeHeader enumName ":" enumTypeDeclaration ";"
        ///
        /// </remarks>
        internal static PropertyValueAst Parse(ParserStream stream)
        {
            var node = new PropertyValueAst();
            var peek = stream.Peek();

            // propertyValue = primitiveTypeValue / complexTypeValue / referenceTypeValue / enumTypeValue
            if (LiteralValueAst.IsLiteralValueToken(peek))
            {
                // primitiveTypeValue -> literalValue
                node.Value = PrimitiveTypeValueAst.Parse(stream);
            }
            else if (peek is BlockOpenToken)
            {
                // we need to read the subsequent token to work out whether
                // this is a complexValueArray, literalValueArray, referenceValueArray or enumValueArray
                stream.Read();
                peek = stream.Peek();
                if (LiteralValueAst.IsLiteralValueToken(peek))
                {
                    // literalValueArray
                    stream.Backtrack();
                    node.Value = LiteralValueArrayAst.Parse(stream);
                }
                else
                {
                    // complexValueType
                    stream.Backtrack();
                    node.Value = ComplexValueArrayAst.Parse(stream);
                }
            }
            else if (peek is AliasIdentifierToken)
            {
                // referenceTypeValue
                node.Value = ReferenceTypeValueAst.Parse(stream);
            }
            else
            {
                throw new UnexpectedTokenException(peek);
            }
            // return the result
            return(node);
        }
Esempio n. 4
0
        /// <summary>
        /// </summary>
        /// <returns></returns>
        /// <remarks>
        ///
        /// See http://www.dmtf.org/sites/default/files/standards/documents/DSP0221_3.0.0a.pdf
        /// A.14 Complex type value
        ///
        ///     complexValueArray = "{" [ complexValue *( "," complexValue) ] "}"
        ///
        /// </remarks>
        internal new static ComplexValueArrayAst Parse(ParserStream stream)
        {
            // complexValueArray =
            var node = new ComplexValueArrayAst();

            // "{"
            stream.Read <BlockOpenToken>();
            // [ complexValue
            node.Values.Add(ComplexValueAst.Parse(stream));
            // *( "," complexValue) ]
            while (stream.Peek <CommaToken>() != null)
            {
                stream.Read <CommaToken>();
                node.Values.Add(ComplexValueAst.Parse(stream));
            }
            // "}"
            stream.Read <BlockCloseToken>();
            // return the result
            return(node);
        }