diff options
| author | _ov4 <ov4@ov4.org> | 2026-09-21 04:50:06 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-09-21 04:50:06 +0000 |
| commit | 1c630655b2beb0f4b84fb7e1bc034ba62520be37 (patch) | |
| tree | e90e70c425813df29c8bbd5c1e84ef22f4e4a176 | |
| parent | 9f5936bf64deb625a27259d778937e281ca19cea (diff) | |
fix name typo, and remove outdated parse
| -rw-r--r-- | include/all.h | 1 | ||||
| -rw-r--r-- | include/eval.h | 2 | ||||
| -rw-r--r-- | include/lang_analysis/ast.h (renamed from include/lexer/ast.h) | 6 | ||||
| -rw-r--r-- | include/lang_analysis/enum_type.h (renamed from include/lexer/enum_type.h) | 0 | ||||
| -rw-r--r-- | include/lang_analysis/lexer_class.h (renamed from include/lexer/lexer_class.h) | 2 | ||||
| -rw-r--r-- | include/lang_analysis/parseline.h (renamed from include/lexer/parseline.h) | 0 | ||||
| -rw-r--r-- | include/lang_analysis/symbol_property.h (renamed from include/lexer/symbol_property.h) | 2 | ||||
| -rw-r--r-- | include/lang_analysis/token.h (renamed from include/lexer/token.h) | 6 | ||||
| -rw-r--r-- | include/parse.h | 13 | ||||
| -rw-r--r-- | module-test/lexer_test.cc | 12 | ||||
| -rw-r--r-- | module-test/parseline_test.cc | 6 | ||||
| -rw-r--r-- | src/eval.cc | 12 | ||||
| -rw-r--r-- | src/lang_analysis/ast.cc (renamed from src/lexer/ast.cc) | 10 | ||||
| -rw-r--r-- | src/lang_analysis/parseline.cc (renamed from src/lexer/parseline.cc) | 4 | ||||
| -rw-r--r-- | src/lang_analysis/symbol_property.cc (renamed from src/lexer/symbol_property.cc) | 4 | ||||
| -rw-r--r-- | src/lang_analysis/token.cc (renamed from src/lexer/token.cc) | 8 | ||||
| -rw-r--r-- | src/parse.cc | 72 |
17 files changed, 37 insertions, 123 deletions
diff --git a/include/all.h b/include/all.h index 8c0d6f9..742eb00 100644 --- a/include/all.h +++ b/include/all.h @@ -12,6 +12,5 @@ #include "handler.h" #include "init.h" #include "job.h" -#include "parse.h" #include "path.h" #include "option.h" diff --git a/include/eval.h b/include/eval.h index 0466cb4..360de66 100644 --- a/include/eval.h +++ b/include/eval.h @@ -1,7 +1,7 @@ #pragma once #include "all.h" -#include "lexer/lexer_class.h" +#include "lang_analysis/lexer_class.h" namespace ov4 { diff --git a/include/lexer/ast.h b/include/lang_analysis/ast.h index 871afaf..9e5a717 100644 --- a/include/lexer/ast.h +++ b/include/lang_analysis/ast.h @@ -2,9 +2,9 @@ #include <string> -#include "lexer/lexer_class.h" -#include "lexer/enum_type.h" -#include "lexer/token.h" +#include "lang_analysis/lexer_class.h" +#include "lang_analysis/enum_type.h" +#include "lang_analysis/token.h" using namespace std; // remove this diff --git a/include/lexer/enum_type.h b/include/lang_analysis/enum_type.h index bfc7cdc..bfc7cdc 100644 --- a/include/lexer/enum_type.h +++ b/include/lang_analysis/enum_type.h diff --git a/include/lexer/lexer_class.h b/include/lang_analysis/lexer_class.h index 04b2e1c..4100b97 100644 --- a/include/lexer/lexer_class.h +++ b/include/lang_analysis/lexer_class.h @@ -4,7 +4,7 @@ #include <unordered_map> #include <vector> -#include "lexer/enum_type.h" +#include "lang_analysis/enum_type.h" using namespace std; diff --git a/include/lexer/parseline.h b/include/lang_analysis/parseline.h index e52b50e..e52b50e 100644 --- a/include/lexer/parseline.h +++ b/include/lang_analysis/parseline.h diff --git a/include/lexer/symbol_property.h b/include/lang_analysis/symbol_property.h index c933605..f21b145 100644 --- a/include/lexer/symbol_property.h +++ b/include/lang_analysis/symbol_property.h @@ -3,7 +3,7 @@ #include <unordered_map> #include <string> -#include "lexer/enum_type.h" +#include "lang_analysis/enum_type.h" using namespace std; diff --git a/include/lexer/token.h b/include/lang_analysis/token.h index 93bdc22..508d142 100644 --- a/include/lexer/token.h +++ b/include/lang_analysis/token.h @@ -2,9 +2,9 @@ #include <string> -#include "lexer/lexer_class.h" -#include "lexer/enum_type.h" -#include "lexer/symbol_property.h" +#include "lang_analysis/lexer_class.h" +#include "lang_analysis/enum_type.h" +#include "lang_analysis/symbol_property.h" using namespace std; // remove this diff --git a/include/parse.h b/include/parse.h deleted file mode 100644 index 8fdbe12..0000000 --- a/include/parse.h +++ /dev/null @@ -1,13 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> - -#include "global.h" - -namespace ov4 -{ - -int parseline(const char *cmdline, char **argv); - -} diff --git a/module-test/lexer_test.cc b/module-test/lexer_test.cc index cbc55d7..b563f74 100644 --- a/module-test/lexer_test.cc +++ b/module-test/lexer_test.cc @@ -3,9 +3,9 @@ $ g++ \ module-test/lexer_test.cc \ - src/lexer/token.cc \ - src/lexer/ast.cc \ - src/lexer/symbol_property.cc \ + src/lang_analysis/token.cc \ + src/lang_analysis/ast.cc \ + src/lang_analysis/symbol_property.cc \ src/util/string.cc \ -std=c++23 -Iinclude -Ithird_party/magic_enum/include \ -O0 -ggdb3 -fno-omit-frame-pointer -fno-inline -D_GLIBCXX_ASSERTIONS \ @@ -23,9 +23,9 @@ g++ \ #include "magic_enum/magic_enum.hpp" -#include "lexer/ast.h" -#include "lexer/enum_type.h" -#include "lexer/token.h" +#include "lang_analysis/ast.h" +#include "lang_analysis/enum_type.h" +#include "lang_analysis/token.h" #include "global.h" #include "error.h" #include "util/string.h" diff --git a/module-test/parseline_test.cc b/module-test/parseline_test.cc index 047be48..e9aae88 100644 --- a/module-test/parseline_test.cc +++ b/module-test/parseline_test.cc @@ -1,9 +1,9 @@ /* - * test lexer/parseline + * test lang_analysis/parseline $ g++ \ module-test/parseline_test.cc \ - src/lexer/parseline.cc \ + src/lang_analysis/parseline.cc \ src/util/string.cc \ -std=c++23 -Iinclude \ -O0 -ggdb3 -fno-omit-frame-pointer -fno-inline -D_GLIBCXX_ASSERTIONS \ @@ -13,7 +13,7 @@ g++ \ #include <iostream> #include <print> -#include "lexer/parseline.h" +#include "lang_analysis/parseline.h" using namespace std; diff --git a/src/eval.cc b/src/eval.cc index c188105..9db9b9d 100644 --- a/src/eval.cc +++ b/src/eval.cc @@ -16,12 +16,12 @@ #include "magic_enum/magic_enum.hpp" #include "error.h" -#include "lexer/lexer_class.h" -#include "lexer/ast.h" -#include "lexer/token.h" -#include "lexer/enum_type.h" -#include "lexer/symbol_property.h" -#include "lexer/parseline.h" +#include "lang_analysis/lexer_class.h" +#include "lang_analysis/ast.h" +#include "lang_analysis/token.h" +#include "lang_analysis/enum_type.h" +#include "lang_analysis/symbol_property.h" +#include "lang_analysis/parseline.h" #include "handler.h" using namespace std; diff --git a/src/lexer/ast.cc b/src/lang_analysis/ast.cc index da96c6f..ce931bc 100644 --- a/src/lexer/ast.cc +++ b/src/lang_analysis/ast.cc @@ -1,13 +1,13 @@ -#include "lexer/ast.h" +#include "lang_analysis/ast.h" #include <string> #include <iostream> #include <print> -#include "lexer/lexer_class.h" -#include "lexer/enum_type.h" -#include "lexer/token.h" -#include "lexer/symbol_property.h" +#include "lang_analysis/lexer_class.h" +#include "lang_analysis/enum_type.h" +#include "lang_analysis/token.h" +#include "lang_analysis/symbol_property.h" #include "util/io.h" #include "error.h" #include "magic_enum/magic_enum.hpp" diff --git a/src/lexer/parseline.cc b/src/lang_analysis/parseline.cc index 064f876..d71cf6f 100644 --- a/src/lexer/parseline.cc +++ b/src/lang_analysis/parseline.cc @@ -1,8 +1,8 @@ -#include "lexer/parseline.h" +#include "lang_analysis/parseline.h" #include <vector> -#include "lexer/enum_type.h" +#include "lang_analysis/enum_type.h" #include "util/string.h" using namespace std; diff --git a/src/lexer/symbol_property.cc b/src/lang_analysis/symbol_property.cc index c78dd61..bb5015c 100644 --- a/src/lexer/symbol_property.cc +++ b/src/lang_analysis/symbol_property.cc @@ -1,8 +1,8 @@ -#include "lexer/symbol_property.h" +#include "lang_analysis/symbol_property.h" #include <string> -#include "lexer/enum_type.h" +#include "lang_analysis/enum_type.h" using namespace std; diff --git a/src/lexer/token.cc b/src/lang_analysis/token.cc index ec69090..f210e57 100644 --- a/src/lexer/token.cc +++ b/src/lang_analysis/token.cc @@ -1,12 +1,12 @@ -#include "lexer/token.h" +#include "lang_analysis/token.h" #include <string> #include <iostream> #include <print> -#include "lexer/lexer_class.h" -#include "lexer/enum_type.h" -#include "lexer/symbol_property.h" +#include "lang_analysis/lexer_class.h" +#include "lang_analysis/enum_type.h" +#include "lang_analysis/symbol_property.h" #include "util/io.h" #include "error.h" diff --git a/src/parse.cc b/src/parse.cc deleted file mode 100644 index f61913a..0000000 --- a/src/parse.cc +++ /dev/null @@ -1,72 +0,0 @@ -#include "parse.h" - -namespace ov4 -{ - -/* - * parseline - Parse the command line and build the argv array. - * - * Characters enclosed in single quotes are treated as a single - * argument. Return true if the user has requested a BG job, false if - * the user has requested a FG job. - */ -int parseline(const char *cmdline, char **argv) -{ - static char array[MAXLINE]; /* holds local copy of command line */ - char *buf = array; /* ptr that traverses command line */ - char *delim; /* points to first space delimiter */ - int argc; /* number of args */ - int bg; /* background job? */ - - strcpy(buf, cmdline); - if (buf[strlen(buf)-1] == '\n') - buf[strlen(buf)-1] = ' '; /* replace trailing '\n' with space */ - else - { - // if buffer is not large enough - // might be UB - // TODO: fix UB - buf[strlen(buf)] = ' '; - buf[strlen(buf)+1] = '\0'; - } - while (*buf && (*buf == ' ')) /* ignore leading spaces */ - buf++; - - /* Build the argv list */ - argc = 0; - if (*buf == '\'') { - buf++; - delim = strchr(buf, '\''); - } - else { - delim = strchr(buf, ' '); - } - - while (delim) { - argv[argc++] = buf; - *delim = '\0'; - buf = delim + 1; - while (*buf && (*buf == ' ')) /* ignore spaces */ - buf++; - - if (*buf == '\'') { - buf++; - delim = strchr(buf, '\''); - } - else { - delim = strchr(buf, ' '); - } - } - argv[argc] = NULL; - - if (argc == 0) /* ignore blank line */ - return 1; - - /* should the job run in the background? */ - if ((bg = (*argv[argc-1] == '&')) != 0) { - argv[--argc] = NULL; - } - return bg; -} - -} |
