lib-ruby-parser (C++ bindings)  4.0.1+ruby-3.1.1
C++ bindings for lib-ruby-parser library
token.hpp
Go to the documentation of this file.
1 #ifndef LIB_RUBY_PARSER_TOKEN_HPP
2 #define LIB_RUBY_PARSER_TOKEN_HPP
3 
4 #include <string>
5 #include "bytes.hpp"
6 #include "loc.hpp"
7 #include "token_ids.hpp"
8 
9 namespace lib_ruby_parser
10 {
12  class Token
13  {
14  public:
15  int32_t token_type;
19  int32_t lex_state_after;
20 
21  Token() = delete;
22  Token(
23  int32_t token_type,
25  Loc loc,
26  int32_t lex_state_before,
27  int32_t lex_state_after);
28 
29  Token(const Token &) = delete;
30  Token &operator=(Token const &) = delete;
31 
32  Token(Token &&) = default;
33  Token &operator=(Token &&) = default;
34 
36  std::string token_name() const;
37  };
38 
40  class TokenList
41  {
42  public:
44  size_t capacity;
45  size_t len;
46 
47  TokenList() = delete;
48  TokenList(Token *ptr, size_t len, size_t capacity);
49  ~TokenList();
50 
51  TokenList(const TokenList &) = delete;
52  TokenList &operator=(TokenList const &) = delete;
53 
54  TokenList(TokenList &&);
56  };
57 } // namespace lib_ruby_parser
58 
59 #endif // LIB_RUBY_PARSER_TOKEN_HPP
lib_ruby_parser::Loc
Loc struct from lib-ruby-parser
Definition: loc.hpp:12
lib_ruby_parser::TokenList::operator=
TokenList & operator=(TokenList const &)=delete
lib_ruby_parser::Token::token_type
int32_t token_type
Definition: token.hpp:15
lib_ruby_parser::TokenList::TokenList
TokenList()=delete
lib_ruby_parser::TokenList
Equivalent of Vec<lib_ruby_parser::Token>
Definition: token.hpp:40
lib_ruby_parser::Bytes
Rerpresentation of Bytes struct from lib-ruby-parser.
Definition: bytes.hpp:46
lib_ruby_parser::Token::Token
Token()=delete
lib_ruby_parser::Token::lex_state_after
int32_t lex_state_after
Definition: token.hpp:19
lib_ruby_parser::TokenList::len
size_t len
Definition: token.hpp:45
lib_ruby_parser::TokenList::capacity
size_t capacity
Definition: token.hpp:44
lib_ruby_parser::Token::operator=
Token & operator=(Token const &)=delete
lib_ruby_parser::Token::token_name
std::string token_name() const
Returns token name (like "kDEF") for a given token.
lib_ruby_parser::Token::loc
Loc loc
Definition: token.hpp:17
lib_ruby_parser::Token
Equivalent of lib_ruby_parser::Token
Definition: token.hpp:12
lib_ruby_parser
Definition: api.hpp:7
lib_ruby_parser::TokenList::~TokenList
~TokenList()
lib_ruby_parser::Token::token_value
Bytes token_value
Definition: token.hpp:16
lib_ruby_parser::TokenList::ptr
Token * ptr
Definition: token.hpp:43
lib_ruby_parser::Token::lex_state_before
int32_t lex_state_before
Definition: token.hpp:18
bytes.hpp
loc.hpp
token_ids.hpp