예제 #1
0
        internal new static QualifierDeclarationAst Parse(ParserStream stream)
        {
            var ast = new QualifierDeclarationAst();

            ast.Name = stream.Read <IdentifierToken>();

            if (stream.Peek <ParenthesesOpenToken>() != null)
            {
                stream.Read <ParenthesesOpenToken>();
                ast.Initializer = LiteralValueAst.Parse(stream);
                stream.Read <ParenthesesCloseToken>();
            }
            else if (stream.Peek <BlockOpenToken>() != null)
            {
                ast.Initializer = LiteralValueArrayAst.Parse(stream);
            }

            if (stream.Peek <ColonToken>() != null)
            {
                stream.Read <ColonToken>();
                while (stream.Peek <IdentifierToken>() != null)
                {
                    ast.Flavors.Add(stream.Read <IdentifierToken>().Name);
                }
            }

            return(ast);
        }
예제 #2
0
        internal static QualifierListAst Parse(ParserStream stream)
        {
            var ast = new QualifierListAst();

            stream.Read <AttributeOpenToken>();

            while (!stream.Eof)
            {
                ast.Qualifiers.Add(QualifierDeclarationAst.Parse(stream));
                if (stream.Peek <CommaToken>() == null)
                {
                    break;
                }
                stream.Read <CommaToken>();
            }

            stream.Read <AttributeCloseToken>();

            return(ast);
        }