renamed confusingly named scanners

This commit is contained in:
anon 2024-06-19 13:01:30 +02:00
parent c2d2eda0e8
commit c6d2bf69d2
7 changed files with 14 additions and 10 deletions

View File

@ -16,7 +16,7 @@ OBJECT.d := object/
TEST.d := test/
INSTALL.d := /bin/
SOURCE := main.cpp xml.cpp csml.cpp cli.cpp html_special.cpp
SOURCE := main.cpp from_xml_to_csml.cpp from_csml_to_xml.cpp cli.cpp html_special.cpp
OBJECT := $(addprefix ${OBJECT.d}/,${SOURCE})
OBJECT := ${OBJECT:.cpp=.o}
OBJECT := ${OBJECT:.c=.o}

View File

@ -143,13 +143,13 @@ signed parse_round2_arguments(int argc, char * * argv) {
switch (input_type) {
case input_type_t::CSML: {
yylex(csml_in, csml_out, csml_lex);
yylex(from_csml_to_xml_in, from_csml_to_xml_out, from_csml_to_xml_lex);
if (not tag_stack.empty()) {
exit(POLUTED_STACK);
}
} break;
case input_type_t::XML: {
yylex(xml_in, xml_out, xml_lex);
yylex(from_xml_to_csml_in, from_xml_to_csml_out, from_xml_to_csml_lex);
if (not tag_stack.empty()) {
exit(POLUTED_STACK);
}

View File

@ -12,7 +12,7 @@ extern "C" void usage(void);
extern "C" signed parse_colon_list(char * const list, std::vector<std::string> destination);
extern "C" signed parse_sets(char * const list);
/* Parse arguments with perminant effects (-h)
/* Parse arguments with global effects (-h)
* Perform validation.
*/
extern "C" signed parse_round1_arguments(int argc, char * * argv);

View File

@ -10,6 +10,7 @@
#include "scanner.hpp"
#include "exit_values.hpp"
// Define declared variables from 'scanner.hpp' here
std::vector<std::string> ignore_list;
std::vector<std::string> asymmetric_special_list;
@ -19,9 +20,10 @@ std::string buffer;
std::string tag_candidate;
std::stack<std::string> tag_stack;
/* --------------- */
extern int xml_lex_destroy(void);
extern int csml_lex_destroy(void);
extern int from_xml_to_csml_lex_destroy(void);
extern int from_csml_to_xml_lex_destroy(void);
char * output_name_from_input_name(const char * const input, const char * const extension) {
char * input_duplicate = strdup(input);
@ -87,8 +89,8 @@ signed main(int argc, char * * argv) {
usage();
}
xml_lex_destroy();
csml_lex_destroy();
from_xml_to_csml_lex_destroy();
from_csml_to_xml_lex_destroy();
return EXIT_SUCCESS;
}

View File

@ -5,14 +5,16 @@
#include <algorithm>
#include <stack>
// NOTE: definitions are in 'main.cpp'
#define DECLARE_LEXER(x) \
extern FILE * x ## _in; \
extern FILE * x ## _out; \
extern int x ## _lex(void); \
extern int x ## _lex_destroy(void);
DECLARE_LEXER(csml);
DECLARE_LEXER(xml);
DECLARE_LEXER(from_csml_to_xml);
DECLARE_LEXER(from_xml_to_csml);
#define ECHOS(s) do { \
const char * const ss = s; \