Look for a LOGO (.LGO) file on the mbed and run the commands in it. Only supports a small subset of the LOGO commands.
Diff: tokens.h
- Revision:
- 0:864f6ee5169b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tokens.h Sat Apr 09 18:06:27 2011 +0000 @@ -0,0 +1,39 @@ +/* + * Source file tokenization + */ + +enum TokenType { + UNKNOWN, + WORD, + INTEGER, + EOL +}; + +struct Token +{ + Token(); + ~Token(); + + TokenType getType() const { return type_; } + bool isValid() const { return type_ != UNKNOWN; } + + bool isWord() const { return type_ == WORD; } + bool isInteger() const { return type_ == INTEGER; } + bool isEOL() const { return type_ == EOL; } + + const char* getWord() const; + int getInteger() const; + + static void get_token(Token* token, const char* str, int* pos); + +private: + TokenType type_; + union { + char* word; + int value; + } u; +}; + +inline void get_token(Token* token, const char* str, int* pos) { + Token::get_token(token, str, pos); +} \ No newline at end of file