Exemple #1
0
 /// <summary>
 /// Parses the portion of the document at the current position, according to the type.
 /// </summary>
 /// <param name="Document">ASN.1 document being parsed.</param>
 /// <param name="Macro">Macro performing parsing.</param>
 /// <returns>Parsed ASN.1 node.</returns>
 public override Asn1Node Parse(Asn1Document Document, Asn1Macro Macro)
 {
     if (Document.ParseValue() is Values.Asn1FloatingPointValue Value)
     {
         return(Value);
     }
     else
     {
         throw Document.SyntaxError("String value expected.");
     }
 }
Exemple #2
0
 /// <summary>
 /// Parses the portion of the document at the current position, according to the type.
 /// </summary>
 /// <param name="Document">ASN.1 document being parsed.</param>
 /// <param name="Macro">Macro performing parsing.</param>
 /// <returns>Parsed ASN.1 node.</returns>
 public override Asn1Node Parse(Asn1Document Document, Asn1Macro Macro)
 {
     if (Document.ParseValue() is Values.Asn1BooleanValue Value)
     {
         return(Value);
     }
     else
     {
         throw Document.SyntaxError("Boolean value expected.");
     }
 }
        /// <summary>
        /// Parses the portion of the document at the current position, according to the type.
        /// </summary>
        /// <param name="Document">ASN.1 document being parsed.</param>
        /// <param name="Macro">Macro performing parsing.</param>
        /// <returns>Parsed ASN.1 node.</returns>
        public override Asn1Node Parse(Asn1Document Document, Asn1Macro Macro)
        {
            if (!(Macro.Document.namedNodes.TryGetValue(this.identifier, out Asn1Node Node)))
            {
                throw Document.SyntaxError("Type named " + this.identifier + " not found.");
            }

            if (!(Node is Asn1Type Type))
            {
                throw Document.SyntaxError("Type expected.");
            }

            return(Type.Parse(Document, Macro));
        }
Exemple #4
0
        /// <summary>
        /// Parses the portion of the document at the current position, according to the type.
        /// </summary>
        /// <param name="Document">ASN.1 document being parsed.</param>
        /// <param name="Macro">Macro performing parsing.</param>
        /// <returns>Parsed ASN.1 node.</returns>
        public override Asn1Node Parse(Asn1Document Document, Asn1Macro Macro)
        {
            int Bak = Document.pos;

            foreach (Asn1Node Choice in this.Nodes)
            {
                if (Choice is Asn1Type Type)
                {
                    try
                    {
                        Document.pos = Bak;
                        return(Type.Parse(Document, Macro));
                    }
                    catch (Exception)
                    {
                        // Ignore
                    }
                }
            }

            throw Document.SyntaxError("Unable to parse choices.");
        }
Exemple #5
0
 /// <summary>
 /// Parses the portion of the document at the current position, according to the type.
 /// </summary>
 /// <param name="Document">ASN.1 document being parsed.</param>
 /// <param name="Macro">Macro performing parsing.</param>
 /// <returns>Parsed ASN.1 node.</returns>
 public override Asn1Node Parse(Asn1Document Document, Asn1Macro Macro)
 {
     return(null);
 }
Exemple #6
0
 /// <summary>
 /// Parses the portion of the document at the current position, according to the type.
 /// </summary>
 /// <param name="Document">ASN.1 document being parsed.</param>
 /// <param name="Macro">Macro performing parsing.</param>
 /// <returns>Parsed ASN.1 node.</returns>
 public override Asn1Node Parse(Asn1Document Document, Asn1Macro Macro)
 {
     return(this.definition.Parse(Document, Macro));
 }
Exemple #7
0
 /// <summary>
 /// Parses the portion of the document at the current position, according to the type.
 /// </summary>
 /// <param name="Document">ASN.1 document being parsed.</param>
 /// <param name="Macro">Macro performing parsing.</param>
 /// <returns>Parsed ASN.1 node.</returns>
 public override Asn1Node Parse(Asn1Document Document, Asn1Macro Macro)
 {
     return(Document.ParseValue());
 }
Exemple #8
0
        /// <summary>
        /// Parses the portion of the document at the current position, according to the type.
        /// </summary>
        /// <param name="Document">ASN.1 document being parsed.</param>
        /// <param name="Macro">Macro performing parsing.</param>
        /// <returns>Parsed ASN.1 node.</returns>
        public override Asn1Node Parse(Asn1Document Document, Asn1Macro Macro)
        {
            Asn1Value Value = Document.ParseValue();

            return Value;
        }