ESH

Executive Shell
git clone http://git.omkov.net/ESH
Log | Tree | Refs | README | Download

AuthorJamozed <[email protected]>
Date2021-03-30 00:03:11
Commit8b9271124ffd98418df623614c09c301ed86ca4e
Parent826f57a64a662e1df99120bb167f42096d70a104

Remove depreciated lexer files

Diffstat

D src/lex.c | 78 ------------------------------------------------------------------------------
D src/lex.h | 46 ----------------------------------------------
D src/str.h | 75 ---------------------------------------------------------------------------

3 files changed, 0 insertions, 199 deletions

diff --git a/src/lex.c b/src/lex.c
deleted file mode 100644
index d3092b0..0000000
--- a/src/lex.c
+++ /dev/null
@@ -1,78 +0,0 @@
-// lex.c
-// Lexer source file for OSH
-// Copyright (C) 2020, Jakob Wakeling
-// All rights reserved.
-
-/*
-OMKOV Permissive Licence, version 1.0
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-* Redistributions of source code must retain the above copyright notice, this
-  list of conditions and the following disclaimers.
-* Redistributions in binary form must reproduce the above copyright notice, this
-  list of conditions and the following disclaimers in the documentation and/or
-  other materials provided with the distribution.
-* Neither the names of the copyright holders, nor the names of its contributors
-  may be used to endorse or promote products derived from this Software without
-  specific prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT
-HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
-*/
-
-#include "lex.h"
-#include "str.h"
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define GETC c = fgetc(file)
-
-tok_t lex(FILE *file) { tok_t tok; tok.str = NULL;
-	int c = fgetc(file);
-	
-skip:;
-	for (; isspace(c) && c != '\n'; GETC);
-	if (c == '\n') { tok.tok = NEWLINE; return tok; }
-	if (c == EOF) { tok.tok = EOF; return tok; }
-	if (c == '#') { for (GETC; !(c == EOF || c == '\n'); GETC) {} goto skip; }
-	
-	str_t str = sinit();
-	if (0) {}
-	else { tok.tok = WORD; goto word;
-		for (;;) { GETC;
-word:		if (c == '\\') { c = fgetc(file);
-				if (c == '\n') { fputs("> ", stdout); continue; }
-				else { spush(&str, '\\'); }
-			}
-			else if (c == '\'') for (;;) { c = fgetc(file);
-				if (c == '\'') { break; } else { spush(&str, c); }
-			}
-			else if (c == '\"') for (;;) { c = fgetc(file);
-				if (c == '\\') { c = fgetc(file);
-					if (c == '$' || c == '`' || c == '\"' || c == '\\');
-					else if (c == '\n') { continue; }
-					else { spush(&str, '\\'); } spush(&str, c);
-				}
-				else if (c == '\"') { break; } else { spush(&str, c); }
-			}
-			else if (isspace(c) && c != '\n') { break; }
-			else if (c == '\n' || c == EOF) { ungetc('\n', file); break; }
-			else { spush(&str, c); }
-		} tok.str = str.dat;
-	}
-	
-	return tok;
-}
diff --git a/src/lex.h b/src/lex.h
deleted file mode 100644
index 20e3d47..0000000
--- a/src/lex.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// lex.h
-// Lexer header file for OSH
-// Copyright (C) 2020, Jakob Wakeling
-// All rights reserved.
-
-/*
-OMKOV Permissive Licence, version 1.0
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-* Redistributions of source code must retain the above copyright notice, this
-  list of conditions and the following disclaimers.
-* Redistributions in binary form must reproduce the above copyright notice, this
-  list of conditions and the following disclaimers in the documentation and/or
-  other materials provided with the distribution.
-* Neither the names of the copyright holders, nor the names of its contributors
-  may be used to endorse or promote products derived from this Software without
-  specific prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT
-HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
-*/
-
-#ifndef OMKOV_OSH_LEX_H_MA6B50VH
-#define OMKOV_OSH_LEX_H_MA6B50VH
-
-#include <stdio.h>
-
-enum token {
-	END = EOF, NUL = 0, NEWLINE, WORD
-};
-
-typedef struct { enum token tok; char *str; } tok_t;
-
-extern tok_t lex(FILE *file);
-
-#endif // OMKOV_OSH_LEX_H_MA6B50VH
diff --git a/src/str.h b/src/str.h
deleted file mode 100644
index ead6846..0000000
--- a/src/str.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// str.h
-// Dynamic string header file for OSH
-// Copyright (C) 2020, Jakob Wakeling
-// All rights reserved.
-
-/*
-OMKOV Permissive Licence, version 1.0
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-* Redistributions of source code must retain the above copyright notice, this
-  list of conditions and the following disclaimers.
-* Redistributions in binary form must reproduce the above copyright notice, this
-  list of conditions and the following disclaimers in the documentation and/or
-  other materials provided with the distribution.
-* Neither the names of the copyright holders, nor the names of its contributors
-  may be used to endorse or promote products derived from this Software without
-  specific prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT
-HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
-*/
-
-#ifndef OSH_STR_H_LJ7LE814
-#define OSH_STR_H_LJ7LE814
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-typedef struct { char *dat; size_t cap, len; } str_t;
-
-static inline str_t sinit(void) {
-	str_t str; str.cap = 64; str.len = 0;
-	str.dat = (char *)malloc(str.cap);
-	return str;
-}
-
-static void spush(str_t *str, char c) {
-	if (str->len + 1 > str->cap) { str->cap *= 2;
-		str->dat = (char *)realloc(str->dat, str->cap);
-	} str->dat[str->len] = c; str->dat[++str->len] = 0;
-	return;
-}
-
-static char spop(str_t *str) {
-	char c = str->dat[--str->len];
-	str->dat[str->len] = 0;
-	return c;
-}
-
-static void sapp(str_t *str, char *s) {
-	size_t len = strlen(s);
-	if (str->len + len > str->cap) {
-		str->cap += len * 2; str->dat = (char *)realloc(str->dat, str->cap);
-	} memcpy(&str->dat[str->len], s, len);
-	str->len += len; str->dat[str->len] = 0;
-	return;
-}
-
-static inline void sclear(str_t *str) {
-	str->len = 0; str->dat[0] = 0;
-	return;
-}
-
-#endif // OSH_STR_H_LJ7LE814