Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/glm/function/interpreter/_load.mcfunction
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
data modify storage glm:interpreter registry set value {external:[]}

function glm:interpreter/evaluate/function/registry
function glm:interpreter/utils/ascii/table
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
data modify storage moxlib:api/string/ascii/lookup target.value set from storage glm:api/interpreter/function execute.args[0].value[0]
function moxlib:api/string/ascii/lookup
data modify storage glm:utils ascii.target.value set from storage glm:api/interpreter/function execute.args[0].value[0]
function glm:interpreter/utils/ascii/lookup
data modify storage glm:api/interpreter/function execute.return set value {type: "literal", variant: "integer", value: 0}
execute store result storage glm:api/interpreter/function execute.return.value int 1 run data get storage moxlib:api/string/ascii/lookup output.id
execute store result storage glm:api/interpreter/function execute.return.value int 1 run data get storage glm:utils ascii.output.id
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
data modify storage moxlib:api/string/ascii/lookup target.id set from storage glm:api/interpreter/function execute.args[0].value
function moxlib:api/string/ascii/lookup
data modify storage glm:utils ascii.target.id set from storage glm:api/interpreter/function execute.args[0].value
function glm:interpreter/utils/ascii/lookup
data modify storage glm:api/interpreter/function execute.return set value {type: "literal", variant: "string", value: []}
data modify storage glm:api/interpreter/function execute.return.value append from storage moxlib:api/string/ascii/lookup output.value
data modify storage glm:api/interpreter/function execute.return.value append from storage glm:utils ascii.output.value
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
data modify storage moxlib:api/string/ascii/lookup target.value set from storage glm:api/interpreter/function execute.args[0].value[0]
data modify storage glm:utils ascii.target.value set from storage glm:api/interpreter/function execute.args[0].value[0]

function moxlib:api/string/ascii/lookup
execute store result score $char glm.interpreter run data get storage moxlib:api/string/ascii/lookup output.id
function glm:interpreter/utils/ascii/lookup
execute store result score $char glm.interpreter run data get storage glm:utils ascii.output.id

execute unless score $char glm.interpreter matches 65..90 run data modify storage glm:api/interpreter/function execute.return.value append from storage glm:api/interpreter/function execute.args[0].value[0]
execute unless score $char glm.interpreter matches 65..90 run return -1

execute store result storage moxlib:api/string/ascii/lookup target.id int 1 run scoreboard players add $char glm.interpreter 32
function moxlib:api/string/ascii/lookup
data modify storage glm:api/interpreter/function execute.return.value append from storage moxlib:api/string/ascii/lookup output.value
execute store result storage glm:utils ascii.target.id int 1 run scoreboard players add $char glm.interpreter 32
function glm:interpreter/utils/ascii/lookup
data modify storage glm:api/interpreter/function execute.return.value append from storage glm:utils ascii.output.value
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
data modify storage moxlib:api/string/ascii/lookup target.value set from storage glm:api/interpreter/function execute.return.value[0]
data modify storage glm:utils ascii.target.value set from storage glm:api/interpreter/function execute.return.value[0]

function moxlib:api/string/ascii/lookup
execute store result score $char glm.interpreter run data get storage moxlib:api/string/ascii/lookup output.id
function glm:interpreter/utils/ascii/lookup
execute store result score $char glm.interpreter run data get storage glm:utils ascii.output.id

execute if score $char glm.interpreter matches 33..126 run return -1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
data modify storage moxlib:api/string/ascii/lookup target.value set from storage glm:api/interpreter/function execute.return.value[-1]
data modify storage glm:utils ascii.target.value set from storage glm:api/interpreter/function execute.return.value[-1]

function moxlib:api/string/ascii/lookup
execute store result score $char glm.interpreter run data get storage moxlib:api/string/ascii/lookup output.id
function glm:interpreter/utils/ascii/lookup
execute store result score $char glm.interpreter run data get storage glm:utils ascii.output.id

execute if score $char glm.interpreter matches 33..126 run return -1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
data modify storage moxlib:api/string/ascii/lookup target.value set from storage glm:api/interpreter/function execute.args[0].value[0]
data modify storage glm:utils ascii.target.value set from storage glm:api/interpreter/function execute.args[0].value[0]

function moxlib:api/string/ascii/lookup
execute store result score $char glm.interpreter run data get storage moxlib:api/string/ascii/lookup output.id
function glm:interpreter/utils/ascii/lookup
execute store result score $char glm.interpreter run data get storage glm:utils ascii.output.id

execute unless score $char glm.interpreter matches 97..122 run data modify storage glm:api/interpreter/function execute.return.value append from storage glm:api/interpreter/function execute.args[0].value[0]
execute unless score $char glm.interpreter matches 97..122 run return -1

execute store result storage moxlib:api/string/ascii/lookup target.id int 1 run scoreboard players remove $char glm.interpreter 32
function moxlib:api/string/ascii/lookup
data modify storage glm:api/interpreter/function execute.return.value append from storage moxlib:api/string/ascii/lookup output.value
execute store result storage glm:utils ascii.target.id int 1 run scoreboard players remove $char glm.interpreter 32
function glm:interpreter/utils/ascii/lookup
data modify storage glm:api/interpreter/function execute.return.value append from storage glm:utils ascii.output.value
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$data modify storage glm:utils ascii.output set from storage glm:utils ascii.table[$(target)]
3 changes: 3 additions & 0 deletions data/glm/function/interpreter/utils/ascii/lookup.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data modify storage glm:utils ascii.output set value {id:-1,value:""}
function glm:interpreter/utils/ascii/lookup.macro with storage glm:utils ascii
data remove storage glm:utils ascii.target
130 changes: 130 additions & 0 deletions data/glm/function/interpreter/utils/ascii/table.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
data modify storage glm:utils ascii.table set value [\
{id: 0, value: "\u0000"},\
{id: 1, value: "\u0001"},\
{id: 2, value: "\u0002"},\
{id: 3, value: "\u0003"},\
{id: 4, value: "\u0004"},\
{id: 5, value: "\u0005"},\
{id: 6, value: "\u0006"},\
{id: 7, value: "\u0007"},\
{id: 8, value: "\u0008"},\
{id: 9, value: "\u0009"},\
{id: 10, value: "\u000a"},\
{id: 11, value: "\u000b"},\
{id: 12, value: "\u000c"},\
{id: 13, value: "\u000d"},\
{id: 14, value: "\u000e"},\
{id: 15, value: "\u000f"},\
{id: 16, value: "\u0010"},\
{id: 17, value: "\u0011"},\
{id: 18, value: "\u0012"},\
{id: 19, value: "\u0013"},\
{id: 20, value: "\u0014"},\
{id: 21, value: "\u0015"},\
{id: 22, value: "\u0016"},\
{id: 23, value: "\u0017"},\
{id: 24, value: "\u0018"},\
{id: 25, value: "\u0019"},\
{id: 26, value: "\u001a"},\
{id: 27, value: "\u001b"},\
{id: 28, value: "\u001c"},\
{id: 29, value: "\u001d"},\
{id: 30, value: "\u001e"},\
{id: 31, value: "\u001f"},\
{id: 32, value: "\u0020"},\
{id: 33, value: "\u0021"},\
{id: 34, value: "\u0022"},\
{id: 35, value: "\u0023"},\
{id: 36, value: "\u0024"},\
{id: 37, value: "\u0025"},\
{id: 38, value: "\u0026"},\
{id: 39, value: "\u0027"},\
{id: 40, value: "\u0028"},\
{id: 41, value: "\u0029"},\
{id: 42, value: "\u002a"},\
{id: 43, value: "\u002b"},\
{id: 44, value: "\u002c"},\
{id: 45, value: "\u002d"},\
{id: 46, value: "\u002e"},\
{id: 47, value: "\u002f"},\
{id: 48, value: "\u0030"},\
{id: 49, value: "\u0031"},\
{id: 50, value: "\u0032"},\
{id: 51, value: "\u0033"},\
{id: 52, value: "\u0034"},\
{id: 53, value: "\u0035"},\
{id: 54, value: "\u0036"},\
{id: 55, value: "\u0037"},\
{id: 56, value: "\u0038"},\
{id: 57, value: "\u0039"},\
{id: 58, value: "\u003a"},\
{id: 59, value: "\u003b"},\
{id: 60, value: "\u003c"},\
{id: 61, value: "\u003d"},\
{id: 62, value: "\u003e"},\
{id: 63, value: "\u003f"},\
{id: 64, value: "\u0040"},\
{id: 65, value: "\u0041"},\
{id: 66, value: "\u0042"},\
{id: 67, value: "\u0043"},\
{id: 68, value: "\u0044"},\
{id: 69, value: "\u0045"},\
{id: 70, value: "\u0046"},\
{id: 71, value: "\u0047"},\
{id: 72, value: "\u0048"},\
{id: 73, value: "\u0049"},\
{id: 74, value: "\u004a"},\
{id: 75, value: "\u004b"},\
{id: 76, value: "\u004c"},\
{id: 77, value: "\u004d"},\
{id: 78, value: "\u004e"},\
{id: 79, value: "\u004f"},\
{id: 80, value: "\u0050"},\
{id: 81, value: "\u0051"},\
{id: 82, value: "\u0052"},\
{id: 83, value: "\u0053"},\
{id: 84, value: "\u0054"},\
{id: 85, value: "\u0055"},\
{id: 86, value: "\u0056"},\
{id: 87, value: "\u0057"},\
{id: 88, value: "\u0058"},\
{id: 89, value: "\u0059"},\
{id: 90, value: "\u005a"},\
{id: 91, value: "\u005b"},\
{id: 92, value: "\u005c"},\
{id: 93, value: "\u005d"},\
{id: 94, value: "\u005e"},\
{id: 95, value: "\u005f"},\
{id: 96, value: "\u0060"},\
{id: 97, value: "\u0061"},\
{id: 98, value: "\u0062"},\
{id: 99, value: "\u0063"},\
{id: 100, value: "\u0064"},\
{id: 101, value: "\u0065"},\
{id: 102, value: "\u0066"},\
{id: 103, value: "\u0067"},\
{id: 104, value: "\u0068"},\
{id: 105, value: "\u0069"},\
{id: 106, value: "\u006a"},\
{id: 107, value: "\u006b"},\
{id: 108, value: "\u006c"},\
{id: 109, value: "\u006d"},\
{id: 110, value: "\u006e"},\
{id: 111, value: "\u006f"},\
{id: 112, value: "\u0070"},\
{id: 113, value: "\u0071"},\
{id: 114, value: "\u0072"},\
{id: 115, value: "\u0073"},\
{id: 116, value: "\u0074"},\
{id: 117, value: "\u0075"},\
{id: 118, value: "\u0076"},\
{id: 119, value: "\u0077"},\
{id: 120, value: "\u0078"},\
{id: 121, value: "\u0079"},\
{id: 122, value: "\u007a"},\
{id: 123, value: "\u007b"},\
{id: 124, value: "\u007c"},\
{id: 125, value: "\u007d"},\
{id: 126, value: "\u007e"},\
{id: 127, value: "\u007f"},\
]