diff options
Добавяне на второ домашно (#30)
* Add 1st hw
* --amend
* moving readme for 1st hw to designated folder
* renamed TokenType enum to TokenClass
* fixed character constant lexing. added sampe output file
* add new line at end-of-file. added gitignore
* a bit of refactoring
* adding cyclomatic complexity
* refactored
* adding cyclomatic complexity
* refactored
1 files changed, 5 insertions, 13 deletions
| -rw-r--r-- | homework/81568/c2html/lexcer.h | 18 |
diff --git a/homework/81568/c2html/lexcer.h b/homework/81568/c2html/lexcer.h index e329a90..eb8afe0 100644 --- a/homework/81568/c2html/lexcer.h +++ b/homework/81568/c2html/lexcer.h @@ -9,7 +9,7 @@ namespace LexCer { -enum class TokenClass : short { +enum TokenClass : short { Operator, Keyword, PreprocessorDirective, @@ -20,6 +20,8 @@ enum class TokenClass : short { Number, LeftParen, RightParen, + LeftCurly, + RightCurly, Skip, Eof, @@ -46,16 +48,10 @@ private: public: Tokenizer(FILE *in, FILE *out); - unsigned lineNumber() const { return line; } - Token currentToken() const { return token; } - - TokenClass nextToken(std::string *lexeme, double *number); - void makeToken(TokenClass type, unsigned line, - std::string lexeme = std::string(), double number = 0.0); - bool writeToOutput(); + Token nextToken(std::string *lexeme, double *number); private: - std::string escapeHTML(const std::string &lexeme); + Token makeToken(TokenClass type, std::string lexeme = std::string(), double number = 0.0); bool readNextDirective(std::string *lexeme); bool readNextString(std::string *lexeme, char oldc); bool readNextIdentifier(std::string *lexeme); @@ -75,10 +71,6 @@ private: std::unordered_set<std::string> typenames; }; - -std::string getOutputFileName(const std::string &name); -void lexCit(FILE *in, FILE *out); - } /* Namespace LexCer */ #endif |
