BACnet.SchemaParser.Parser.Next C# (CSharp) Method

Next() public method

Retrieves the next named type
public Next ( ) : NamedType
return NamedType
        public NamedType Next()
        {
            string name;
            TypeDefinition definition;

            if (_peekType() == TokenType.End)
                return null;

            name = _get(TokenType.Identifier);
            _get(TokenType.DefinedAs);
            definition = _parseDefinition();

            return new NamedType(name, definition);
        }

Usage Example

Example #1
0
        public static void Main(string[] args)
        {
            using (StreamReader reader = new StreamReader(@"C:\git\bacnet\bacnet.txt"))
            {
                Lexer lexer = new Lexer(reader);
                Parser parser = new Parser(lexer);
                CSharpTypeGenerator gen = new CSharpTypeGenerator(@"C:\git\bacnet\BACnet.Ashrae\generated", "BACnet.Ashrae");

                NamedType type = parser.Next();
                while(type != null)
                {
                    gen.Generate(type);
                    type = parser.Next();
                }
            }
        }