ShaderTools.Hlsl.Parser.DirectiveParser.ParseIfDirective C# (CSharp) Method

ParseIfDirective() private method

private ParseIfDirective ( SyntaxToken hash, SyntaxToken keyword, bool isActive ) : IfDirectiveTriviaSyntax
hash SyntaxToken
keyword SyntaxToken
isActive bool
return IfDirectiveTriviaSyntax
        private IfDirectiveTriviaSyntax ParseIfDirective(SyntaxToken hash, SyntaxToken keyword, bool isActive)
        {
            _lexer.ExpandMacros = true;
            var expr = ParseDirectiveExpression();
            _lexer.ExpandMacros = false;

            var eod = ParseEndOfDirective(false);

            var isTrue = EvaluateBool(expr);
            var branchTaken = isActive && isTrue;

            return new IfDirectiveTriviaSyntax(
                hash, keyword, expr, eod,
                isActive, branchTaken, isTrue);
        }