diff options
| -rw-r--r-- | ast.c | 2 | ||||
| -rw-r--r-- | ast.h | 1 | ||||
| -rw-r--r-- | builtins/text.c | 2 | ||||
| -rw-r--r-- | builtins/types.h | 1 | ||||
| -rw-r--r-- | compile.c | 7 | ||||
| -rw-r--r-- | parse.c | 17 | ||||
| -rw-r--r-- | typecheck.c | 2 | ||||
| -rw-r--r-- | types.h | 1 |
8 files changed, 7 insertions, 26 deletions
@@ -135,7 +135,7 @@ CORD ast_to_cord(ast_t *ast) T(Extern, "(name=%s, type=%r)", data.name, type_ast_to_cord(data.type)) T(StructDef, "(%s, fields=%r, namespace=%r)", data.name, arg_list_to_cord(data.fields), ast_to_cord(data.namespace)) T(EnumDef, "(%s, tags=%r, namespace=%r)", data.name, tags_to_cord(data.tags), ast_to_cord(data.namespace)) - T(LangDef, "(%s, secret=%s, namespace=%r)", data.name, data.secret ? "yes" : "no", ast_to_cord(data.namespace)) + T(LangDef, "(%s, namespace=%r)", data.name, ast_to_cord(data.namespace)) T(Index, "(indexed=%r, index=%r)", ast_to_cord(data.indexed), ast_to_cord(data.index)) T(FieldAccess, "(fielded=%r, field=%s)", ast_to_cord(data.fielded), data.field) T(DocTest, "(expr=%r, output=%r)", ast_to_cord(data.expr), Text__quoted(data.output, true)) @@ -241,7 +241,6 @@ struct ast_s { struct { const char *name; ast_t *namespace; - bool secret:1; } LangDef; struct { ast_t *indexed, *index; diff --git a/builtins/text.c b/builtins/text.c index 70d9be57..4641bc1d 100644 --- a/builtins/text.c +++ b/builtins/text.c @@ -25,7 +25,7 @@ public CORD Text__as_text(const void *text, bool colorize, const TypeInfo *info) { if (!text) return info->TextInfo.lang; - CORD ret = info->TextInfo.secret ? "(*****)" : Text__quoted(*(CORD*)text, colorize); + CORD ret = Text__quoted(*(CORD*)text, colorize); if (!streq(info->TextInfo.lang, "Text")) ret = colorize ? CORD_all("\x1b[1m$", info->TextInfo.lang, "\x1b[m", ret) : CORD_all("$", info->TextInfo.lang, ret); return ret; diff --git a/builtins/types.h b/builtins/types.h index 528701ff..d26c86be 100644 --- a/builtins/types.h +++ b/builtins/types.h @@ -29,7 +29,6 @@ typedef struct TypeInfo { } PointerInfo; struct { const char *lang; - bool secret; } TextInfo; struct { const struct TypeInfo *item; @@ -585,9 +585,6 @@ CORD compile(env_t *env, ast_t *ast) type_t *text_t = Table_str_get(*env->types, lang ? lang : "Text"); if (!text_t || text_t->tag != TextType) code_err(ast, "%s is not a valid text language name", lang); - if (Match(text_t, TextType)->secret) - code_err(ast, "%s text is marked secret, so you cannot use %s literals in code. Please load the content from a secure location instead", - lang, lang); table_t *lang_ns = lang ? Table_str_get(*env->type_namespaces, lang) : NULL; ast_list_t *chunks = Match(ast, TextJoin)->children; if (!chunks) { @@ -1243,9 +1240,9 @@ CORD compile(env_t *env, ast_t *ast) auto def = Match(ast, LangDef); CORD_appendf(&env->code->typedefs, "typedef CORD %s_t;\n", def->name); CORD_appendf(&env->code->typedefs, "extern const TypeInfo %s;\n", def->name); - CORD_appendf(&env->code->typeinfos, "public const TypeInfo %s = {%zu, %zu, {.tag=TextInfo, .TextInfo={%s, .secret=%s}}};\n", + CORD_appendf(&env->code->typeinfos, "public const TypeInfo %s = {%zu, %zu, {.tag=TextInfo, .TextInfo={%s}}};\n", def->name, sizeof(CORD), __alignof__(CORD), - Text__quoted(def->name, false), def->secret ? "yes" : "no"); + Text__quoted(def->name, false)); compile_namespace(env, def->name, def->namespace); return CORD_EMPTY; } @@ -1645,9 +1645,7 @@ ast_t *parse_enum_def(parse_ctx_t *ctx, const char *pos) { PARSER(parse_lang_def) { const char *start = pos; - // lang Name - // lang Name(secret) - + // lang Name [namespace...] if (!match_word(&pos, "lang")) return NULL; int64_t starting_indent = get_indent(ctx->file, pos); spaces(&pos); @@ -1656,17 +1654,6 @@ PARSER(parse_lang_def) { parser_err(ctx, start, pos, "I expected a name for this lang"); spaces(&pos); - bool secret = false; - if (match(&pos, "(")) { - whitespace(&pos); - if (match_word(&pos, "secret")) { - secret = true; - whitespace(&pos); - match(&pos, ","); - } - expect_closing(ctx, &pos, ")", "I wasn't able to parse the rest of this lang definition"); - } - const char *ns_pos = pos; whitespace(&ns_pos); int64_t ns_indent = get_indent(ctx->file, ns_pos); @@ -1678,7 +1665,7 @@ PARSER(parse_lang_def) { if (!namespace) namespace = NewAST(ctx->file, pos, pos, Block, .statements=NULL); - return NewAST(ctx->file, start, pos, LangDef, .name=name, .secret=secret, .namespace=namespace); + return NewAST(ctx->file, start, pos, LangDef, .name=name, .namespace=namespace); } arg_ast_t *parse_args(parse_ctx_t *ctx, const char **pos, bool allow_unnamed) diff --git a/typecheck.c b/typecheck.c index 9c9b3b19..5cabf3f1 100644 --- a/typecheck.c +++ b/typecheck.c @@ -182,7 +182,7 @@ void bind_statement(env_t *env, ast_t *statement) case LangDef: { auto def = Match(statement, LangDef); - type_t *type = Type(TextType, .lang=def->name, .secret=def->secret); + type_t *type = Type(TextType, .lang=def->name); Table_str_set(env->types, def->name, type); env_t *ns_env = namespace_env(env, def->name); @@ -65,7 +65,6 @@ struct type_s { } NumType; struct { const char *lang; - bool secret; } TextType; struct { type_t *item_type; |
