starting stuff

This commit is contained in:
conzer 2024-12-07 13:44:53 -05:00
parent 8a66ea7971
commit ed3c7d4278
7 changed files with 121 additions and 10 deletions

35
importer/import.go Normal file
View file

@ -0,0 +1,35 @@
package importer
import (
"errors"
"fmt"
"io/ioutil"
"path/filepath"
"strings"
)
type Class struct {
Name string
Content string
FilePath string
}
func ImportClasses(filePath string) (map[string]Class, error) {
content, err := ioutil.ReadFile(filePath)
if err != nil {
return nil, fmt.Errorf("error reading file '%s': %w", filePath, err)
}
classes := make(map[string]Class)
lines := strings.Split(string(content), "\n")
var currentClass *Class
var nestedContent strings.Builder
for _, line := range lines {
line = strings.TrimSpace(line)
if strings.HasPrefix(line, "<class") {
name := extractAttributeValue(line, "name")
}
}
}