Patch a bug in the obi2 annotation parser on map indexed by integers

This commit is contained in:
Eric Coissac
2025-03-27 14:54:13 +01:00
parent fd80249b85
commit 2d52322876
2 changed files with 3 additions and 1 deletions

View File

@ -18,6 +18,7 @@ import (
var __obi_header_value_string_pattern__ = regexp.MustCompile(`^'\s*([^']*'|"[^"]*")\s*;`) var __obi_header_value_string_pattern__ = regexp.MustCompile(`^'\s*([^']*'|"[^"]*")\s*;`)
var __obi_header_value_numeric_pattern__ = regexp.MustCompile(`^\s*([+-]?\.\d+|[+-]?\d+(\.\d*)?([eE][+-]?\d+)?)\s*;`) var __obi_header_value_numeric_pattern__ = regexp.MustCompile(`^\s*([+-]?\.\d+|[+-]?\d+(\.\d*)?([eE][+-]?\d+)?)\s*;`)
var __obi_header_map_int_key__ = regexp.MustCompile("([{,])([0-9]+):")
func __match__dict__(text []byte) []int { func __match__dict__(text []byte) []int {
@ -212,6 +213,7 @@ func ParseOBIFeatures(text string, annotations obiseq.Annotation) string {
if len(m) > 0 { if len(m) > 0 {
bvalue = bytes.TrimSpace(part[m[0]:(m[1] - 1)]) bvalue = bytes.TrimSpace(part[m[0]:(m[1] - 1)])
j := bytes.ReplaceAll(bvalue, []byte("'"), []byte(`"`)) j := bytes.ReplaceAll(bvalue, []byte("'"), []byte(`"`))
j = __obi_header_map_int_key__.ReplaceAll(j, []byte(`$1"$2":`))
var err error var err error
switch { switch {
case strings.HasPrefix(key, "merged_") || case strings.HasPrefix(key, "merged_") ||

View File

@ -8,7 +8,7 @@ import (
// corresponds to the last commit, and not the one when the file will be // corresponds to the last commit, and not the one when the file will be
// commited // commited
var _Commit = "5a3705b" var _Commit = "fd80249"
var _Version = "Release 4.4.0" var _Version = "Release 4.4.0"
// Version returns the version of the obitools package. // Version returns the version of the obitools package.