internal static bool Evaluate(this IPreprocessorCLogicalAndConditionExp expression, IOilexerGrammarProductionRuleEntry currentEntry, IList <IOilexerGrammarTokenEntry> availableStock, ProductionRuleTemplateArgumentSeries argumentLookup, IOilexerGrammarProductionRuleTemplateEntry entry, OilexerGrammarFile file, ICompilerErrorCollection errors) { //rule 2. if (expression.Left == null) { try { return((bool)expression.Right.Evaluate(currentEntry, availableStock, argumentLookup, entry, file, errors)); } catch { errors.SourceError(OilexerGrammarCore.CompilerErrors.InvalidPreprocessorCondition, new LineColumnPair(expression.Line, expression.Column), LineColumnPair.Zero, new Uri(entry.FileName, UriKind.RelativeOrAbsolute), expression.ToString()); } } //rule 1. else { return((bool)expression.Left.Evaluate(currentEntry, availableStock, argumentLookup, entry, file, errors) && (bool)expression.Right.Evaluate(currentEntry, availableStock, argumentLookup, entry, file, errors)); } return(false); }
/// <summary> /// Creates a new <see cref="PreprocessorCLogicalOrConditionExp"/> with the <paramref name="right"/>, <paramref name="column"/>, /// <paramref name="line"/>, and <paramref name="position"/> /// provided. /// </summary> /// <param name="right">The <see cref="IPreprocessorCLogicalAndConditionExp"/> the /// <see cref="PreprocessorCLogicalOrConditionExp"/> links to.</param> /// <remarks>Rule 2</remarks> /// <param name="column">The column at the current <paramref name="line"/> the /// <see cref="PreprocessorCLogicalOrConditionExp"/> was declared at. </param> /// <param name="line">The line index the <see cref="PreprocessorCLogicalOrConditionExp"/> was declared at.</param> /// <param name="position">The position in the file the <see cref="PreprocessorCLogicalOrConditionExp"/> /// was declared at.</param> public PreprocessorCLogicalOrConditionExp(IPreprocessorCLogicalAndConditionExp right, int column, int line, long position) : base(column, line, position) { this.right = right; }
/// <summary> /// Creates a new <see cref="PreprocessorCLogicalAndConditionExp"/> with the <paramref name="left"/>, /// <paramref name="right"/>, <paramref name="column"/>, /// <paramref name="line"/>, and <paramref name="position"/> provided. /// </summary> /// <param name="left">The previous <see cref="IPreprocessorCLogicalAndConditionExp"/>.</param> /// <param name="right">The <see cref="IPreprocessorCEqualityExp"/> /// that is next.</param> /// <remarks>Rule 1</remarks> /// <param name="column">The column at the current <paramref name="line"/> the /// <see cref="PreprocessorCLogicalOrConditionExp"/> was declared at. </param> /// <param name="line">The line index the <see cref="PreprocessorCLogicalOrConditionExp"/> was declared at.</param> /// <param name="position">The position in the file the <see cref="PreprocessorCLogicalOrConditionExp"/> /// was declared at.</param> public PreprocessorCLogicalAndConditionExp(IPreprocessorCLogicalAndConditionExp left, IPreprocessorCEqualityExp right, int column, int line, long position) : base(column, line, position) { this.left = left; this.right = right; }