Website Summary Files Commits Branches @commit @diff @stats
path: root / homework / 81568 / c2html / lexcer.h
diff options
context:
space:
mode:
Commit65c7618c2a8834616b009195f10c6cd762f43b8a (patch)
Author
 Mincho Paskalev <minchopaskal@gmail.com>
2018-11-07 10:31:59 +0200
Committer
 dtrendafilov <trendafilov.dn@gmail.com>
2018-11-07 10:31:59 +0200
Files57440acdc2731e7b060928881fa55e983d83f956 /homework/81568/c2html/lexcer.h
IPL-65c7618c2a8834616b009195f10c6cd762f43b8a.tar
IPL-65c7618c2a8834616b009195f10c6cd762f43b8a.tar.gz
IPL-65c7618c2a8834616b009195f10c6cd762f43b8a.zip
Parent2044770601dff8f1bd1c6cb9d0617f669b430e1d (diff)
Добавяне на второ домашно (#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.h18
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