From aeb0d4f887a0c18c36b59acc7b5df08e62020c50 Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Sun, 11 Oct 2020 21:32:48 +0300 Subject: Removed old homeworks --- homework/81270/js2html/Highlighter.cpp | 71 ---------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 homework/81270/js2html/Highlighter.cpp (limited to 'homework/81270/js2html/Highlighter.cpp') diff --git a/homework/81270/js2html/Highlighter.cpp b/homework/81270/js2html/Highlighter.cpp deleted file mode 100644 index cd56496..0000000 --- a/homework/81270/js2html/Highlighter.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// -// Created by bmestanov on 25.10.18. -// - -#include "Highlighter.h" -#include -#include -#include - -Highlighter::Highlighter(const char *outputPath, const char *stylePath) : - outputPath(outputPath), stylePath(stylePath) {} - -void Highlighter::highlight(const IPLVector &tokens) { - std::stringstream ss; - - ss << "\n"; - ss << "\n"; - ss << " \n"; - ss << " hello.js\n"; - ss << " \n"; - ss << " \n"; - ss << " \n"; - ss << "
\n";
-
-    for (auto &token : tokens) {
-        IPLString cssClass = getClass(token);
-        if (cssClass.empty()) {
-            // Print with no formatting
-            ss << token.lexeme;
-        } else {
-            ss << "" << token.lexeme << "";
-        }
-    }
-
-    ss << " \n";
-    ss << "\n";
-
-    std::ofstream fs(outputPath);
-    if (fs) {
-        fs << ss.rdbuf();
-    } else {
-        std::cout << ss.rdbuf();
-    }
-}
-
-IPLString Highlighter::getClass(const Token &token) {
-    switch (token.type) {
-        case Whitespace:
-        case NewLine:
-        case Raw:
-            return "";
-        case Comment:
-            return "comment";
-        case Keyword:
-            return "keyword";
-        case NumericLiteral:
-            return "numeric";
-        case StringLiteral:
-            return "string";
-        case TemplateLiteral:
-            return "template";
-        case Regex:
-            return "regex";
-        case Identifier:
-            return "identifier";
-        case BooleanLiteral:
-            return "boolean";
-        case Global:
-            return "global";
-    }
-}
-- 
cgit v1.3.1-23-gd82d