egg

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 3cb5549e7b1ae14d3c3ea7be8ca16995dcbee2a3
parent fe15699ecccf5136a4f81f9b70bfd8ebcd684124
Author: Gabriel G. de Brito <gabrielgbrito@icloud.com>
Date:   Sat,  6 Jul 2024 18:24:01 -0300

Hotfix: Infinite loop when encountering trailing % in literals

Diffstat:
Massembler/assembler.go | 5+++++
Mmain.go | 2+-
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/assembler/assembler.go b/assembler/assembler.go @@ -150,6 +150,7 @@ func getHexNumber(r rune) (uint8, error) { // Parses everything cleanly excepts that any % followed by a two-digit hex // number (e.g., %FA) in substituted by it's own value. Use %% for a literal %. +// Trailing % are also inserted. func ParseLiteral(lit string) string { var b strings.Builder i := 0 @@ -157,6 +158,7 @@ func ParseLiteral(lit string) string { if lit[i] == '%' { if i + 1 < len(lit) && lit[i + 1] == '%' { b.WriteRune('%') + i += 2 } else if i + 2 < len(lit) { b2, err := getHexNumber(rune(lit[i + 1])) if err != nil { @@ -172,6 +174,9 @@ func ParseLiteral(lit string) string { } b.WriteRune(rune(b1 | (b2 << 4))) i += 3 + } else { + b.WriteRune('%') + i++ } } else { b.WriteRune(rune(lit[i])) diff --git a/main.go b/main.go @@ -14,7 +14,7 @@ import ( "github.com/gboncoffee/egg/sagui" ) -const VERSION = "2.4.1" +const VERSION = "2.4.2" // Put new architetures here... (main.go:/switch architeture) func listArchs() {