Skip to content

fails on some valid kdl syntax #13

Description

@Alexthemediocre

See AvengeMedia/DankMaterialShell#2230. This library seems to expect a space where one is not required by the kdl v1 spec, such as in the following kdl:

recent-windows {
    binds {
        Alt+Tab         { next-window scope="output"; }
        Alt+Shift+Tab   { previous-window scope="output"; }
        Alt+grave       { next-window filter="app-id"; }
        Alt+Shift+grave { previous-window filter="app-id"; }
        Alt+Escape      { next-window scope="all"; }
        Alt+Shift+Escape{ previous-window scope="all"; }
    }
}
Short reproducible example

package main

import (
	"strings"
	"fmt"
	"github.com/sblinch/kdl-go"
)

func main() {
	data := `
		recent-windows {
			binds {
				Alt+Tab         { next-window scope="output"; }
				Alt+Shift+Tab   { previous-window scope="output"; }
				Alt+grave       { next-window filter="app-id"; }
				Alt+Shift+grave { previous-window filter="app-id"; }
				Alt+Escape      { next-window scope="all"; }
				Alt+Shift+Escape{ previous-window scope="all"; }
			}
		}
	`

	_, err := kdl.Parse(strings.NewReader(data))
	if err == nil {
		fmt.Println("success")
	} else {
		fmt.Println(err)
	}
}

Above example prints:
parse failed: unexpected BraceOpen in state stateNode at line 8, column 23:
...}       Alt+Shift+Escape{...
                           ^

This same kdl snippet is considered valid by niri (e.g. niri validate) using kdl-rs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions