public Preprocessor_directiveContext preprocessor_directive()
        {
            Preprocessor_directiveContext _localctx = new Preprocessor_directiveContext(Context, State);

            EnterRule(_localctx, 0, RULE_preprocessor_directive);
            int _la;

            try {
                State = 75;
                ErrorHandler.Sync(this);
                switch (TokenStream.LA(1))
                {
                case DEFINE:
                    _localctx = new PreprocessorDeclarationContext(_localctx);
                    EnterOuterAlt(_localctx, 1);
                    {
                        State = 6; Match(DEFINE);
                        State = 7; ((PreprocessorDeclarationContext)_localctx)._CONDITIONAL_SYMBOL = Match(CONDITIONAL_SYMBOL);
                        State = 8; directive_new_line_or_sharp();
                        ConditionalSymbols.Add((((PreprocessorDeclarationContext)_localctx)._CONDITIONAL_SYMBOL != null?((PreprocessorDeclarationContext)_localctx)._CONDITIONAL_SYMBOL.Text:null));
                        ((PreprocessorDeclarationContext)_localctx).value = conditions.All(c => c);
                    }
                    break;

                case UNDEF:
                    _localctx = new PreprocessorDeclarationContext(_localctx);
                    EnterOuterAlt(_localctx, 2);
                    {
                        State = 11; Match(UNDEF);
                        State = 12; ((PreprocessorDeclarationContext)_localctx)._CONDITIONAL_SYMBOL = Match(CONDITIONAL_SYMBOL);
                        State = 13; directive_new_line_or_sharp();
                        ConditionalSymbols.Remove((((PreprocessorDeclarationContext)_localctx)._CONDITIONAL_SYMBOL != null?((PreprocessorDeclarationContext)_localctx)._CONDITIONAL_SYMBOL.Text:null));
                        ((PreprocessorDeclarationContext)_localctx).value = conditions.All(c => c);
                    }
                    break;

                case IF:
                    _localctx = new PreprocessorConditionalContext(_localctx);
                    EnterOuterAlt(_localctx, 3);
                    {
                        State = 16; Match(IF);
                        State = 17; ((PreprocessorConditionalContext)_localctx).expr = preprocessor_expression(0);
                        State = 18; directive_new_line_or_sharp();
                        ((PreprocessorConditionalContext)_localctx).value = ((PreprocessorConditionalContext)_localctx).expr.value == "true" && conditions.All(c => c); conditions.Push(((PreprocessorConditionalContext)_localctx).expr.value == "true");
                    }
                    break;

                case ELIF:
                    _localctx = new PreprocessorConditionalContext(_localctx);
                    EnterOuterAlt(_localctx, 4);
                    {
                        State = 21; Match(ELIF);
                        State = 22; ((PreprocessorConditionalContext)_localctx).expr = preprocessor_expression(0);
                        State = 23; directive_new_line_or_sharp();
                        if (!conditions.Peek())
                        {
                            conditions.Pop(); ((PreprocessorConditionalContext)_localctx).value = ((PreprocessorConditionalContext)_localctx).expr.value == "true" && conditions.All(c => c);
                            conditions.Push(((PreprocessorConditionalContext)_localctx).expr.value == "true");
                        }
                        else
                        {
                            ((PreprocessorConditionalContext)_localctx).value = false;
                        }
                    }
                    break;

                case ELSE:
                    _localctx = new PreprocessorConditionalContext(_localctx);
                    EnterOuterAlt(_localctx, 5);
                    {
                        State = 26; Match(ELSE);
                        State = 27; directive_new_line_or_sharp();
                        if (!conditions.Peek())
                        {
                            conditions.Pop(); ((PreprocessorConditionalContext)_localctx).value = true && conditions.All(c => c); conditions.Push(true);
                        }
                        else
                        {
                            ((PreprocessorConditionalContext)_localctx).value = false;
                        }
                    }
                    break;

                case ENDIF:
                    _localctx = new PreprocessorConditionalContext(_localctx);
                    EnterOuterAlt(_localctx, 6);
                    {
                        State = 30; Match(ENDIF);
                        State = 31; directive_new_line_or_sharp();
                        conditions.Pop(); ((PreprocessorConditionalContext)_localctx).value = conditions.Peek();
                    }
                    break;

                case LINE:
                    _localctx = new PreprocessorLineContext(_localctx);
                    EnterOuterAlt(_localctx, 7);
                    {
                        State = 34; Match(LINE);
                        State = 41;
                        ErrorHandler.Sync(this);
                        switch (TokenStream.LA(1))
                        {
                        case DIGITS:
                        {
                            State = 35; Match(DIGITS);
                            State = 37;
                            ErrorHandler.Sync(this);
                            _la = TokenStream.LA(1);
                            if (_la == STRING)
                            {
                                {
                                    State = 36; Match(STRING);
                                }
                            }
                        }
                        break;

                        case DEFAULT:
                        {
                            State = 39; Match(DEFAULT);
                        }
                        break;

                        case DIRECTIVE_HIDDEN:
                        {
                            State = 40; Match(DIRECTIVE_HIDDEN);
                        }
                        break;

                        default:
                            throw new NoViableAltException(this);
                        }
                        State = 43; directive_new_line_or_sharp();
                        ((PreprocessorLineContext)_localctx).value = conditions.All(c => c);
                    }
                    break;

                case ERROR:
                    _localctx = new PreprocessorDiagnosticContext(_localctx);
                    EnterOuterAlt(_localctx, 8);
                    {
                        State = 46; Match(ERROR);
                        State = 47; Match(TEXT);
                        State = 48; directive_new_line_or_sharp();
                        ((PreprocessorDiagnosticContext)_localctx).value = conditions.All(c => c);
                    }
                    break;

                case WARNING:
                    _localctx = new PreprocessorDiagnosticContext(_localctx);
                    EnterOuterAlt(_localctx, 9);
                    {
                        State = 51; Match(WARNING);
                        State = 52; Match(TEXT);
                        State = 53; directive_new_line_or_sharp();
                        ((PreprocessorDiagnosticContext)_localctx).value = conditions.All(c => c);
                    }
                    break;

                case REGION:
                    _localctx = new PreprocessorRegionContext(_localctx);
                    EnterOuterAlt(_localctx, 10);
                    {
                        State = 56; Match(REGION);
                        State = 58;
                        ErrorHandler.Sync(this);
                        _la = TokenStream.LA(1);
                        if (_la == TEXT)
                        {
                            {
                                State = 57; Match(TEXT);
                            }
                        }

                        State = 60; directive_new_line_or_sharp();
                        ((PreprocessorRegionContext)_localctx).value = conditions.All(c => c);
                    }
                    break;

                case ENDREGION:
                    _localctx = new PreprocessorRegionContext(_localctx);
                    EnterOuterAlt(_localctx, 11);
                    {
                        State = 63; Match(ENDREGION);
                        State = 65;
                        ErrorHandler.Sync(this);
                        _la = TokenStream.LA(1);
                        if (_la == TEXT)
                        {
                            {
                                State = 64; Match(TEXT);
                            }
                        }

                        State = 67; directive_new_line_or_sharp();
                        ((PreprocessorRegionContext)_localctx).value = conditions.All(c => c);
                    }
                    break;

                case PRAGMA:
                    _localctx = new PreprocessorPragmaContext(_localctx);
                    EnterOuterAlt(_localctx, 12);
                    {
                        State = 70; Match(PRAGMA);
                        State = 71; Match(TEXT);
                        State = 72; directive_new_line_or_sharp();
                        ((PreprocessorPragmaContext)_localctx).value = conditions.All(c => c);
                    }
                    break;

                default:
                    throw new NoViableAltException(this);
                }
            }
            catch (RecognitionException re) {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally {
                ExitRule();
            }
            return(_localctx);
        }
 public PreprocessorLineContext(Preprocessor_directiveContext context)
 {
     CopyFrom(context);
 }
 public PreprocessorConditionalContext(Preprocessor_directiveContext context)
 {
     CopyFrom(context);
 }
 public PreprocessorDeclarationContext(Preprocessor_directiveContext context)
 {
     CopyFrom(context);
 }
 public PreprocessorDiagnosticContext(Preprocessor_directiveContext context)
 {
     CopyFrom(context);
 }
 public virtual void CopyFrom(Preprocessor_directiveContext context)
 {
     base.CopyFrom(context);
     this.value = context.value;
 }