From 65c7618c2a8834616b009195f10c6cd762f43b8a Mon Sep 17 00:00:00 2001 From: Mincho Paskalev Date: Wed, 7 Nov 2018 10:31:59 +0200 Subject: Добавяне на второ домашно (#30) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- homework/81568/c2html/lexcer.h | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'homework/81568/c2html/lexcer.h') 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 typenames; }; - -std::string getOutputFileName(const std::string &name); -void lexCit(FILE *in, FILE *out); - } /* Namespace LexCer */ #endif -- cgit v1.3.1-26-gb76a