From e4283ed0c189f5052ea045afa9c6c8f5e50e305b Mon Sep 17 00:00:00 2001 From: Gleb Smirnov Date: Fri, 21 Jan 2022 20:00:59 +0300 Subject: [PATCH] fix: replace non-existing bind flag with existing one Replace non-existing `after` binding flag with `invert-boolean` flag. Use `inverted` name for convenience. --- blueprintcompiler/ast.py | 4 ++-- blueprintcompiler/decompiler.py | 4 ++-- blueprintcompiler/parser.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/blueprintcompiler/ast.py b/blueprintcompiler/ast.py index a7f1f65..0ac40f9 100644 --- a/blueprintcompiler/ast.py +++ b/blueprintcompiler/ast.py @@ -287,8 +287,8 @@ class Property(AstNode): bind_flags = [] if self.tokens["sync_create"]: bind_flags.append("sync-create") - if self.tokens["after"]: - bind_flags.append("after") + if self.tokens["inverted"]: + bind_flags.append("invert-boolean") if self.tokens["bidirectional"]: bind_flags.append("bidirectional") bind_flags_str = "|".join(bind_flags) or None diff --git a/blueprintcompiler/decompiler.py b/blueprintcompiler/decompiler.py index aa315ec..7a6ea81 100644 --- a/blueprintcompiler/decompiler.py +++ b/blueprintcompiler/decompiler.py @@ -283,8 +283,8 @@ def decompile_property(ctx, gir, name, cdata, bind_source=None, bind_property=No if bind_flags: if "sync-create" in bind_flags: flags += " sync-create" - if "after" in bind_flags: - flags += " after" + if "invert-boolean" in bind_flags: + flags += " inverted" if "bidirectional" in bind_flags: flags += " bidirectional" ctx.print(f"{name}: bind {bind_source}.{bind_property}{flags};") diff --git a/blueprintcompiler/parser.py b/blueprintcompiler/parser.py index 0c6d9fe..d2c8f36 100644 --- a/blueprintcompiler/parser.py +++ b/blueprintcompiler/parser.py @@ -76,7 +76,7 @@ def parse(tokens) -> T.Tuple[ast.UI, T.Optional[MultipleErrors]]: UseIdent("bind_property").expected("a property name to bind from"), ZeroOrMore(AnyOf( Sequence(Keyword("sync-create"), UseLiteral("sync_create", True)), - Sequence(Keyword("after"), UseLiteral("after", True)), + Sequence(Keyword("inverted"), UseLiteral("invert-boolean", True)), Sequence(Keyword("bidirectional"), UseLiteral("bidirectional", True)), )), )