Created
January 26, 2014 12:30
-
-
Save alksl/8632046 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _SCHEMESE_SCANNER_H_ | |
#define _SCHEMESE_SCANNER_H_ | |
#include <iostream> | |
#include <vector> | |
#include <string> | |
namespace Schemese { | |
/* | |
* Start compound tokens at end of unicode range | |
* for future considirations. | |
*/ | |
#define TOKENS_START 0x110000 | |
enum SchemeseTokenType { | |
LPAREN = '(', | |
RPAREN = ')', | |
LBRACKET = '{', | |
RBRACKET = '}', | |
QUOTE = ''', | |
BACKQUOTE = '`', | |
IDENTIFIER = TOKENS_START, | |
BOOLEAN, | |
VECTOR, | |
BYTE_VECTOR, | |
INTEGER, | |
REAL, | |
CHARACTER, | |
STRING | |
}; | |
struct Token { | |
SchemeseTokenType type; | |
std::string text; | |
}; | |
class Scanner { | |
public: | |
Scanner(std::istream input); | |
Token scan(); | |
Token peek(); | |
void put_back(Token& token); | |
private: | |
std::vector<Token> token_buffer; | |
}; | |
}; | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment