コード例 #1
0
ファイル: SpecParser.cs プロジェクト: risc26z/decgen
        /// <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();
        }
コード例 #2
0
ファイル: SpecParser.cs プロジェクト: risc26z/decgen
        /// <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());
        }
コード例 #3
0
ファイル: SpecParser.cs プロジェクト: risc26z/decgen
 /// <summary>
 /// Initializes a new instance of the <see cref="SpecParser"/> class.
 /// </summary>
 /// <param name="spec">Associated Specification object.</param>
 /// <param name="lexer">Associated SpecLexer, responsible for breaking the
 /// input into a sequence of Tokens and providing these to the parser.</param>
 private SpecParser(Specification spec, SpecLexer lexer)
 {
     this.lexer = lexer;
     this.spec  = spec;
 }