This file is indexed.

/usr/include/gpt/BasePortugolParser.hpp is in libgportugol-dev 1.1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/***************************************************************************
 *   Copyright (C) 2003-2006 by Thiago Silva                               *
 *   thiago.silva@kdemal.net                                               *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/


#ifndef BASEPORTUGOLPARSER_H
#define BASEPORTUGOLPARSER_H

#include <antlr/config.hpp>
#include <antlr/TokenStream.hpp>
#include <antlr/TokenBuffer.hpp>
#include <antlr/NoViableAltException.hpp>
#include <antlr/LLkParser.hpp>

#include "PortugolParserTokenTypes.hpp"

// #include "SymbolTable.hpp"

  using namespace std;
  using namespace antlr;

class BasePortugolParser : public LLkParser
{

public:
  BasePortugolParser(const ParserSharedInputState& lexer, int k_);
  BasePortugolParser(TokenBuffer& tokenBuf, int k_);
  BasePortugolParser(TokenStream& lexer, int k_);
  
  virtual void match(int t);
  virtual void matchNot(int t);
  virtual void match(const BitSet& b);

  string nomeAlgoritmo();

protected:
  static string expecting_algorithm_name;
  static string expecting_variable;
  static string expecting_datatype;
  static string expecting_datatype_pl;
  static string expecting_identifier;
  static string expecting_expression;
  static string expecting_valid_sentence;  
  static string expecting_attr_op;
  static string expecting_fimse;
  static string expecting_fimvar_or_var;
  static string expecting_stm_or_fim;
  static string expecting_stm_or_fimse;
  static string expecting_stm_or_fimenq;
  static string expecting_stm_or_fimpara;
  static string expecting_stm_or_ate;
  static string expecting_eof_or_function;
  static string expecting_function_name;
  static string expecting_param_or_fparen;
  static string expecting_inicio_or_vardecl;

  RefToken lastToken;

 bool isDatatype(int tk) {
    return (tk == PortugolParserTokenTypes::T_KW_INTEIRO)
           || (tk == PortugolParserTokenTypes::T_KW_INTEIROS)
           || (tk == PortugolParserTokenTypes::T_KW_REAL)
           || (tk == PortugolParserTokenTypes::T_KW_REAIS)
           || (tk == PortugolParserTokenTypes::T_KW_CARACTERE)
           || (tk == PortugolParserTokenTypes::T_KW_CARACTERES)
           || (tk == PortugolParserTokenTypes::T_KW_LITERAL)
           || (tk == PortugolParserTokenTypes::T_KW_LITERAIS)
           || (tk == PortugolParserTokenTypes::T_KW_LOGICO)
           || (tk == PortugolParserTokenTypes::T_KW_LOGICOS);
  }

  bool isKeyword(int tk) {
    return (tk == PortugolParserTokenTypes::T_KW_FIM_VARIAVEIS) 
           || (tk == PortugolParserTokenTypes::T_KW_ALGORITMO)
           || (tk == PortugolParserTokenTypes::T_KW_VARIAVEIS)
           || (tk == PortugolParserTokenTypes::T_KW_INTEIRO)
           || (tk == PortugolParserTokenTypes::T_KW_REAL)
           || (tk == PortugolParserTokenTypes::T_KW_CARACTERE)
           || (tk == PortugolParserTokenTypes::T_KW_LITERAL)
           || (tk == PortugolParserTokenTypes::T_KW_LOGICO)
           || (tk == PortugolParserTokenTypes::T_KW_INICIO)
           || (tk == PortugolParserTokenTypes::T_KW_VERDADEIRO)
           || (tk == PortugolParserTokenTypes::T_KW_FALSO)
           || (tk == PortugolParserTokenTypes::T_KW_FIM)
           || (tk == PortugolParserTokenTypes::T_KW_OU)
           || (tk == PortugolParserTokenTypes::T_KW_E)
           || (tk == PortugolParserTokenTypes::T_KW_NOT)
           || (tk == PortugolParserTokenTypes::T_KW_SE)
           || (tk == PortugolParserTokenTypes::T_KW_SENAO)
           || (tk == PortugolParserTokenTypes::T_KW_ENTAO)
           || (tk == PortugolParserTokenTypes::T_KW_FIM_SE)
           || (tk == PortugolParserTokenTypes::T_KW_ENQUANTO)
           || (tk == PortugolParserTokenTypes::T_KW_FACA)
           || (tk == PortugolParserTokenTypes::T_KW_FIM_ENQUANTO)
           || (tk == PortugolParserTokenTypes::T_KW_PARA)
           || (tk == PortugolParserTokenTypes::T_KW_DE)
           || (tk == PortugolParserTokenTypes::T_KW_ATE)
           || (tk == PortugolParserTokenTypes::T_KW_PASSO)
           || (tk == PortugolParserTokenTypes::T_KW_FIM_PARA)
           || (tk == PortugolParserTokenTypes::T_KW_REPITA)
           || (tk == PortugolParserTokenTypes::T_KW_FUNCAO)
           || (tk == PortugolParserTokenTypes::T_KW_RETORNE)
//            || (tk == PortugolParserTokenTypes::T_KW_CONJUNTO)
           || (tk == PortugolParserTokenTypes::T_KW_MATRIZ)           
           || (tk == PortugolParserTokenTypes::T_KW_INTEIROS)
           || (tk == PortugolParserTokenTypes::T_KW_REAIS)
           || (tk == PortugolParserTokenTypes::T_KW_CARACTERES)
           || (tk == PortugolParserTokenTypes::T_KW_LITERAIS)           
           || (tk == PortugolParserTokenTypes::T_KW_LOGICOS); 
  }

  string getTokenDescription(const RefToken& t);

  int reportParserError(int line, string expecting, string found = "", string after = "");

  void handleVarDeclColonMissing(const MismatchedTokenException& e, const RefToken& id);

//   void handleVarDecl(const RefToken& id);
//   void checkVarDecl(const RefToken& id);

  void printTip(const string& msg, int line, int cd);

//   SymbolTable symbtable;
  string currentScope; //global,f1(),...

  string _name;
};

#endif