Skip to content

Instantly share code, notes, and snippets.

@ifknot
Created October 17, 2020 13:17
Show Gist options
  • Save ifknot/90d3a5d5617d79d0fcd541f08d33311d to your computer and use it in GitHub Desktop.
Save ifknot/90d3a5d5617d79d0fcd541f08d33311d to your computer and use it in GitHub Desktop.
tokenize header
#pragma once
#include <string>
namespace R {
/**
* The 7 R-ish data types:
* r_raw, r_integer, r_numeric, r_string, r_logical, r_complex, r_date
* converted to tokens with an extra 'broken' token for unrecognized type
*/
enum class token_t { raw_t, integer_t, numeric_t, string_t, logical_t, complex_t, date_t, broken_t };
/**
* parsing input streams requires the ability to recognize the limited R-ish PODs
* @note unrecognized lexemes return btoken_t
*
* @param lexeme - the basic lexical unit to tokenize
*/
token_t tokenize(std::string& lexeme);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment