public override object VisitPreprocessDerective(UHeaderParser.PreprocessDerectiveContext context) { var text = context.GetText(); if (text.StartsWith("#if ")) { if (text.StartsWith("#if WITH_EDITOR")) { _ignoreOfPragma = true; } if (_ignoreOfPragma) { _preprocessorIfCount++; } } else if (text.StartsWith("#endif") && _ignoreOfPragma) { _preprocessorIfCount--; if (_preprocessorIfCount == 0) { _ignoreOfPragma = false; } } return(base.VisitPreprocessDerective(context)); }
/// <summary> /// Visit a parse tree produced by <see cref="UHeaderParser.preprocessDerective"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitPreprocessDerective([NotNull] UHeaderParser.PreprocessDerectiveContext context) { return(VisitChildren(context)); }