Renamed replace to sub
@@ -8,8 +8,8 @@ if exists("b:current_syntax")
finish endif -syntax keyword hexNativeSymbol if while error symbols throw try dup pop swap stack and or not xor int str hex dec type -syntax keyword hexNativeSymbol cat chr len get ord index join split replace debug map puts warn print gets +syntax keyword hexNativeSymbol if while error symbols throw try dup drop swap stack and or not xor int str hex dec type +syntax keyword hexNativeSymbol cat chr len get ord index join split sub debug map puts warn print gets syntax keyword hexNativeSymbol read write append args exit exec run syntax match hexNativeSymbol /\v\!/ syntax match hexNativeSymbol /\v\!\=/
@@ -103,8 +103,8 @@ ((0x2 0x3 0x4) 0x2 get 0x4 ==)
("abcde" 0x1 get "b" ==) ;40 - ("a/b/c" "t-path" : (t-path "/" index 0x0 >=) (t-path "/" "\\" replace "t-path" :) while t-path "a\\b\\c" == "t-path" #) - ("assets\"" "\"" "/" replace "assets/" ==) + ("a/b/c" "t-path" : (t-path "/" index 0x0 >=) (t-path "/" "\\" sub "t-path" :) while t-path "a\\b\\c" == "t-path" #) + ("assets\"" "\"" "/" sub "assets/" ==) (("" () cat) (error) try "[symbol cat] Two quotations or two strings required" ==) ((0x4 len) (error) try "[symbol len] Quotation or string required" ==) ;44@@ -116,7 +116,7 @@ (("0" "0" "0" "0") "." join "0.0.0.0"==)
;48 ("0.0.0.0" "." split ("0" "0" "0" "0") ==) - ("Hello, World!" "Hello" "Goodbye" replace "Goodbye, World!" ==) + ("Hello, World!" "Hello" "Goodbye" sub "Goodbye, World!" ==) ("test" "test.txt" write "test.txt" read "test" ==) ("!" "test.txt" append "test.txt" read "test!" ==) ;52@@ -242,7 +242,7 @@ ;128
((("a" "b" "c") 0x1 join) (error) try "[symbol join] Quotation and string required" ==) (("a" 0x1 split) (error) try "[symbol split] Two strings required" ==) - ((("aaa") "a" "b" replace) (error) try "[symbol replace] Three strings required" ==) + ((("aaa") "a" "b" sub) (error) try "[symbol sub] Three strings required" ==) ((0x1 read) (error) try "[symbol read] String required" ==) ;132
@@ -60,10 +60,10 @@ (t-count highlight-delimiters len <)
( highlight-delimiters t-count get "t-delimiter" : highlight-replacements t-count get "t-replacement" : - ; Find delimiter in text and replace it with the corresponding replacement + ; Find delimiter in text and substitute it with the corresponding replacement (t-text t-delimiter index 0x0 >=) ( - t-text t-delimiter t-replacement replace "t-text" : + t-text t-delimiter t-replacement sub "t-text" : ) while t-count 0x1 + "t-count" :@@ -89,7 +89,7 @@ "pt-repl" :
"pt-tag" : "pt-content" : (pt-content pt-tag tag index 0x0 >=) - (pt-content pt-tag tag pt-repl replace "pt-content" :) + (pt-content pt-tag tag pt-repl sub "pt-content" :) while pt-content "pt-repl" #@@ -151,7 +151,7 @@ releases len "_gct_count" :
; Reverse releases order (_gct_count 0x0 >) ( - releases _gct_count 0x1 - get ".html" "" replace "id-release" : + releases _gct_count 0x1 - get ".html" "" sub "id-release" : changelog-toc ("<li><a href=\"#v" id-release "\">v" id-release "</a></li>\n") () map "" join cat@@ -203,7 +203,7 @@ 0x0 "_c" :
(_c contents len <) ( contents _c get "fn-content" : - fn-content ".html" "" replace "id-content" : + fn-content ".html" "" sub "id-content" : d-contents "/" fn-content cat cat read "content" : t-page read ; Replace tags
@@ -106,7 +106,7 @@ hex_set_doc(docs, "get", "(s|q)", "a", "Gets the item at position 'i' in 's' or 'q'.");
hex_set_doc(docs, "index", "(s a|q a)", "i", "Returns the index of 'a' within 's' or 'q'."); hex_set_doc(docs, "join", "q s", "s", "Joins the strings in 'q' using separator 's'."); hex_set_doc(docs, "split", "s1 s2", "q", "Splits 's1' using separator 's2'."); - hex_set_doc(docs, "replace", "s1 s2 s3", "s", "Replaces 's2' with 's3' within 's1'."); + hex_set_doc(docs, "sub", "s1 s2 s3", "s", "Replaces 's2' with 's3' within 's1'."); hex_set_doc(docs, "map", "q1 q2", "q3", "Applies 'q2' to 'q1' items and returns results."); // I/O
@@ -185,9 +185,9 @@ HEX_OP_QUOTE = 0x1f,
HEX_OP_DEBUG = 0x20, HEX_OP_ADD = 0x21, - HEX_OP_SUB = 0x22, - HEX_OP_MUL = 0x23, - HEX_OP_DIV = 0x24, + HEX_OP_SUBTRACT = 0x22, + HEX_OP_MULTIPLY = 0x23, + HEX_OP_DIVIDE = 0x24, HEX_OP_MOD = 0x25, HEX_OP_BITAND = 0x26,@@ -223,7 +223,7 @@ HEX_OP_GET = 0x3f,
HEX_OP_INDEX = 0x40, HEX_OP_JOIN = 0x41, HEX_OP_SPLIT = 0x42, - HEX_OP_REPLACE = 0x43, + HEX_OP_SUB = 0x43, HEX_OP_MAP = 0x44, HEX_OP_PUTS = 0x45,@@ -353,7 +353,7 @@ int hex_symbol_insert(hex_context_t *ctx);
int hex_symbol_index(hex_context_t *ctx); int hex_symbol_join(hex_context_t *ctx); int hex_symbol_split(hex_context_t *ctx); -int hex_symbol_replace(hex_context_t *ctx); +int hex_symbol_sub(hex_context_t *ctx); int hex_symbol_read(hex_context_t *ctx); int hex_symbol_write(hex_context_t *ctx); int hex_symbol_append(hex_context_t *ctx);
@@ -79,15 +79,15 @@ return HEX_OP_ADD;
} else if (strcmp(symbol, "-") == 0) { - return HEX_OP_SUB; + return HEX_OP_SUBTRACT; } else if (strcmp(symbol, "*") == 0) { - return HEX_OP_MUL; + return HEX_OP_MULTIPLY; } else if (strcmp(symbol, "/") == 0) { - return HEX_OP_DIV; + return HEX_OP_DIVIDE; } else if (strcmp(symbol, "%") == 0) {@@ -209,9 +209,9 @@ else if (strcmp(symbol, "split") == 0)
{ return HEX_OP_SPLIT; } - else if (strcmp(symbol, "replace") == 0) + else if (strcmp(symbol, "sub") == 0) { - return HEX_OP_REPLACE; + return HEX_OP_SUB; } else if (strcmp(symbol, "map") == 0) {@@ -304,11 +304,11 @@ case HEX_OP_DEBUG:
return "debug"; case HEX_OP_ADD: return "+"; - case HEX_OP_SUB: + case HEX_OP_SUBTRACT: return "-"; - case HEX_OP_MUL: + case HEX_OP_MULTIPLY: return "*"; - case HEX_OP_DIV: + case HEX_OP_DIVIDE: return "/"; case HEX_OP_MOD: return "%";@@ -370,8 +370,8 @@ case HEX_OP_JOIN:
return "join"; case HEX_OP_SPLIT: return "split"; - case HEX_OP_REPLACE: - return "replace"; + case HEX_OP_SUB: + return "sub"; case HEX_OP_MAP: return "map"; case HEX_OP_PUTS:
@@ -1703,7 +1703,7 @@ }
return result; } -int hex_symbol_replace(hex_context_t *ctx) +int hex_symbol_sub(hex_context_t *ctx) { HEX_POP(ctx, replacement); if (replacement->type == HEX_TYPE_INVALID)@@ -1741,7 +1741,7 @@ int newLen = strlen(str) - findLen + replaceLen + 1;
char *newStr = (char *)malloc(newLen); if (!newStr) { - hex_error(ctx, "[symbol replace] Memory allocation failed"); + hex_error(ctx, "[symbol sub] Memory allocation failed"); result = 1; } else@@ -1759,7 +1759,7 @@ }
} else { - hex_error(ctx, "[symbol replace] Three strings required"); + hex_error(ctx, "[symbol sub] Three strings required"); result = 1; } if (result != 0)@@ -2760,7 +2760,7 @@ hex_set_native_symbol(ctx, "get", hex_symbol_get);
hex_set_native_symbol(ctx, "index", hex_symbol_index); hex_set_native_symbol(ctx, "join", hex_symbol_join); hex_set_native_symbol(ctx, "split", hex_symbol_split); - hex_set_native_symbol(ctx, "replace", hex_symbol_replace); + hex_set_native_symbol(ctx, "sub", hex_symbol_sub); hex_set_native_symbol(ctx, "read", hex_symbol_read); hex_set_native_symbol(ctx, "write", hex_symbol_write); hex_set_native_symbol(ctx, "append", hex_symbol_append);