<commit_before>#include "Recognizer.hpp"

#include <boost/lexical_cast.hpp>
#include <cctype>
#include <cassert>

namespace sexp_cpp
{

  bool Recognizer::IsInteger(const std::string& token)
  {
    try
    {
      boost::lexical_cast<int>(token);
      return true;
    }
    catch(boost::bad_lexical_cast)
    {
      return false;
    }
  }

  bool Recognizer::IsBoolean(const std::string& token)
  {
    if(token[0] == '#' && (token[1] == 't' || token[1] == 'f') && token.size() == 2)
    {
      return true;
    }

    return false;
  }
  bool Recognizer::IsSymbol(const std::string& token)
  {
    if(isalpha(token[0])) // TODO: '*' '/' '>' '<' '=' '?' '!' can are allowed to?
    {
      return true;
    }

    return false;
  }

  bool Recognizer::IsEmptyList(const std::list<std::string>& tokens)
  {
    if(tokens.size() == 2 && tokens.front() == "(" && tokens.back() == ")") // 2 brackets
    {
      return true;
    }

    return false;
  }

  bool Recognizer::IsList(const std::list<std::string>& tokens)
  {
    if(tokens.size() >= 4 && tokens.front() == "(" && tokens.back() == ")") // 2 brackets + 2 args
    {
      return true;
    }

    return false;
  }

  bool Recognizer::IsSingleQuoted(const std::list<std::string>& tokens)
  {
    if(tokens.front() == "'")
    {
      return true;
    }

    return false;
  }

  bool Recognizer::IsQuotedList(const std::list<std::string>& tokens)
  {
    if(IsList(tokens))
    {
      std::list<std::string>::const_iterator it = tokens.begin();
      assert(*it == "("); it++;
      if(*it == "quote")
      {
        return true;
      }
    }
    return false;
  }

} // sexp_cpp

<commit_msg>fixed the only issue that CppCheck reported<commit_after>#include "Recognizer.hpp"

#include <boost/lexical_cast.hpp>
#include <cctype>
#include <cassert>

namespace sexp_cpp
{

  bool Recognizer::IsInteger(const std::string& token)
  {
    try
    {
      boost::lexical_cast<int>(token);
      return true;
    }
    catch(boost::bad_lexical_cast)
    {
      return false;
    }
  }

  bool Recognizer::IsBoolean(const std::string& token)
  {
    if(token[0] == '#' && (token[1] == 't' || token[1] == 'f') && token.size() == 2)
    {
      return true;
    }

    return false;
  }
  bool Recognizer::IsSymbol(const std::string& token)
  {
    if(isalpha(token[0])) // TODO: '*' '/' '>' '<' '=' '?' '!' can are allowed to?
    {
      return true;
    }

    return false;
  }

  bool Recognizer::IsEmptyList(const std::list<std::string>& tokens)
  {
    if(tokens.size() == 2 && tokens.front() == "(" && tokens.back() == ")") // 2 brackets
    {
      return true;
    }

    return false;
  }

  bool Recognizer::IsList(const std::list<std::string>& tokens)
  {
    if(tokens.size() >= 4 && tokens.front() == "(" && tokens.back() == ")") // 2 brackets + 2 args
    {
      return true;
    }

    return false;
  }

  bool Recognizer::IsSingleQuoted(const std::list<std::string>& tokens)
  {
    if(tokens.front() == "'")
    {
      return true;
    }

    return false;
  }

  bool Recognizer::IsQuotedList(const std::list<std::string>& tokens)
  {
    if(IsList(tokens))
    {
      std::list<std::string>::const_iterator it = tokens.begin();
      assert(*it == "("); ++it;
      if(*it == "quote")
      {
        return true;
      }
    }
    return false;
  }

} // sexp_cpp


{'fraction_non_alphanumeric': 0.1875746714456392, 'fraction_numerical': 0.005973715651135006, 'mean_word_length': 2.581818181818182, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6495062', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1186, 'n_words': 218}