LCOV - code coverage report
Current view: top level - inc/lexicalAnalysis - token.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 8 8
Test Date: 2025-04-18 15:53:49 Functions: 100.0 % 5 5

            Line data    Source code
       1              : #ifndef TOKEN_H
       2              : #define TOKEN_H
       3              : 
       4              : #include "location.h"
       5              : #include "type.h"
       6              : #include <string>
       7              : 
       8              : namespace nicole {
       9              : 
      10              : // Used to simplify the parsing analysis
      11              : class Token final {
      12              : private:
      13              :   TokenType type_;
      14              :   std::string raw_;
      15              :   Location loc_;
      16              : 
      17              : public:
      18              :   explicit Token(const TokenType &type, const std::string &raw,
      19              :                  const Location &loc) noexcept
      20         8438 :       : type_{type}, raw_{raw}, loc_{loc} {};
      21              : 
      22         8046 :   [[nodiscard]] TokenType type() const noexcept { return type_; };
      23              : 
      24          144 :   [[nodiscard]] const std::string &raw() const noexcept { return raw_; }
      25              : 
      26           99 :   [[nodiscard]] const Location &location() const noexcept { return loc_; }
      27              : 
      28            9 :   [[nodiscard]] const std::string locInfo() const noexcept {
      29            9 :     return loc_.file().string() + " " + std::to_string(loc_.row()) + ':' +
      30            9 :            std::to_string(loc_.col());
      31            9 :   }
      32              : };
      33              : 
      34              : } // namespace nicole
      35              : 
      36              : #endif
        

Generated by: LCOV version 2.0-1