Lexer#

class numpy::Lexer#

numpy C++ class.

Example#

#include <numpy/np_ndarray.h>
using namespace numpy;

// Use Lexer
Lexer obj;
// ... operations ...

Other Methods#

Signature

Return Type

Location

Example

void advance()

void

df_query.h:89

char current() const

char

df_query.h:80

explicit Lexer(std::string input) : input\_(std::move(input))

explicit Lexer(std::string input) :

df_query.h:164

Token next_token()

Token

df_query.h:166

char peek(size_t ahead = 1) const

char

df_query.h:84

Token read_identifier()

Token

df_query.h:99

Token read_number()

Token

df_query.h:115

Token read_string(char quote)

Token

df_query.h:141

void skip_whitespace()

void

df_query.h:93

View

Token tok(TokenType::NUMBER, num)

Token

df_query.h:136

Code Examples#

The following examples are extracted from the test suite.

skip_whitespace (np_test_5_all.cpp:976)
966      assert_condition(type1 == "int", "Failed to detect int type");
967      assert_condition(type2 == "float", "Failed to detect float type");
968      assert_condition(type3 == "string", "Failed to detect string type");
969
970      // std::cout << "  Tested value type detection" << std::endl;
971
972      std::cout << " -> tests passed" << std::endl;
973    }
974
975    void np_test_io_skip_whitespace() {
976      std::cout << "========= skip_whitespace() utility ============================";
977
978      // Test whitespace skipping
979      std::string test = "   \t\n  text";
980      size_t pos = 0;
981
982      // Skip whitespace
983      while (pos < test.size() && std::isspace(test[pos])) {
984        ++pos;
985      }