Пример #1
0
        /// <summary>
        /// Parse a string containing a flags specification, using the
        /// supplied Specification to look up flag names, and return the
        /// flag specification in binary form.
        /// </summary>
        /// <param name="spec">Associated specification.</param>
        /// <param name="flags">String to be parsed.  The format is the
        /// same as that in specification rules (excluding the square
        /// brackets).</param>
        /// <returns>Binary representation of the specified flags.</returns>
        public static TristateBitArray ParseFlags(Specification spec, string flags)
        {
            var lexer  = new SpecLexer(flags);
            var parser = new SpecParser(spec, lexer);

            return(parser.ParseFlags());
        }
Пример #2
0
        /// <summary>
        /// Parse a specification file/resource and populate the Specification
        /// with its contents.
        /// </summary>
        public static void Parse(Specification spec, StreamReader file)
        {
            var lexer  = new SpecLexer(file);
            var parser = new SpecParser(spec, lexer);

            parser.Parse();
        }
Пример #3
0
 /// <summary>
 /// Load specification from file or resource.
 /// </summary>
 public void Load(StreamReader textReader)
 {
     SpecParser.Parse(this, textReader);
 }