Website Summary Files Commits Branches @commit @diff @stats
path: root / homework / 81281 / c2html / c2html.pl
diff options
context:
space:
mode:
Commitaeb0d4f887a0c18c36b59acc7b5df08e62020c50 (patch)
Author
 Dimitar Trendafilov <dimitar@coherent-labs.com>
2020-10-11 21:32:48 +0300
Committer
 Dimitar Trendafilov <dimitar@coherent-labs.com>
2020-10-11 21:33:38 +0300
Filesb6abdc6e1810326b587f2a160f39570f1f568f27 /homework/81281/c2html/c2html.pl
IPL-aeb0d4f887a0c18c36b59acc7b5df08e62020c50.tar
IPL-aeb0d4f887a0c18c36b59acc7b5df08e62020c50.tar.gz
IPL-aeb0d4f887a0c18c36b59acc7b5df08e62020c50.zip
Parent154b7cd30f21af1554ca26986ff1643e28857727 (diff)
Removed old homeworks
1 files changed, 0 insertions, 132 deletions
-rw-r--r--homework/81281/c2html/c2html.pl132
diff --git a/homework/81281/c2html/c2html.pl b/homework/81281/c2html/c2html.pl
deleted file mode 100644
index 9479b96..0000000
--- a/homework/81281/c2html/c2html.pl
+++ /dev/null
@@ -1,132 +0,0 @@
-:- use_module(library(dcg/basics)).
-:- use_module(library(readutil)).
-:- [tokens, prettify, print, essentials, controlStructures].
-:- set_prolog_flag(verbose, silent).
-
-:- initialization(main, main).
-
-main :-
- current_prolog_flag(argv, Argv),
- Argv = [H1, H2|_],
- atom_string(H1, File),
- atom_string(H2, Number),
- mainy(File, Number),
- format('You can see the result in the html file.~n'),
- halt.
-main :-
- halt(1).
-
-mainy(File, Number):-
-
- open(File, read, RFile),
- read_stream_to_codes(RFile, CSource),
- close(RFile),
- phrase(tokens(Tokens), CSource),
- flattenMine(Tokens, TokenStream),
- ((Number == "0", PrettyCode = TokenStream);
- (Number == "1", prettify(TokenStream, Raw),
- flattenMine(Raw, PrettyCode));
- (Number == "2", prettify(TokenStream, Raw),
- identifyControlStructures(Raw, RawF),
- flattenMine(RawF, PrettyCode))),
- open('page.html', write, WFile),
- write(WFile,'<!doctype>
- <html>
-
- <head>
- <title>hello.c</title>
- <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
- <style>
- .keyword {
- color: blue;
- }
-
- .number {
- color: violet;
- }
-
- .identifier {
- color: green;
- }
-
- .operator {
- font-style: bold;
- color: blue;
- }
-
- .comment {
- color: lime;
- }
-
- .string {
- color: orange;
- }
-
- .parenthese {
- font-style: bold;
- color: brown;
- }
-
- .quotation {
- font-style: bold;
- color: black;
- }
-
- .unknown {
- font-style: bold;
- color: red;
- }
-
- .function {
- color: purple;
- }
-
- .collapsible {
- background-color: PaleGreen;
- cursor: pointer;
- padding: 10px;
- width: 100%;
- border: none;
- text-align: left;
- outline: none;
- font-size: 15px;
- }
-
- .active,
- .collapsible:hover {
- background-color: PaleGoldenRod;
- }
-
- .content {
- padding: 0 18px;
- display: none;
- overflow: hidden;
- background-color: #f1f1f1;
- }
- </style>
- </head>
-
- <body>
- <pre class=\"code\">'),
- tohtmlfile(WFile, PrettyCode),
- write(WFile, ' <script>
- var coll = document.getElementsByClassName(\"collapsible\");
- var i;
-
- for (i = 0; i < coll.length; i++) {
- coll[i].addEventListener(\"click\", function() {
- this.classList.toggle(\"active\");
- var content = this.nextElementSibling;
- if (content.style.display === \"block\") {
- content.style.display = \"none\";
- } else {
- content.style.display = \"block\";
- }
- });
- }
- </script>
- </pre>
- </body>
-
- </html>'),
- close(WFile).