Commit graph

32 commits

Author SHA1 Message Date
James Westman
a12d3f5c81
decompile: Fix bug in lookup tags
A lookup tag with no type attribute would crash the decompiler, even if
that was valid. This wasn't caught by the tests since blueprint never
generates such XML.

Also fixed a bug in the tests that caused decompiler-only tests not to
run.
2025-04-25 20:13:01 -05:00
James Westman
21d5ce86e9 decompiler: Support sub-templates
Support GtkBuilderListItemFactory syntax by decompiling the nested XML,
rather than preserving it as a string literal.
2024-08-24 13:04:21 -05:00
James Westman
25d9826aea decompiler: Fix translator comments in properties 2024-08-24 12:40:04 -05:00
James Westman
a12ac1b976 decompiler: Support Adw.Breakpoint syntax
Also, improve handling of translated strings.
2024-08-24 12:29:14 -05:00
James Westman
4d3dc92448 decompiler: Support list accessibility properties 2024-08-23 18:16:02 -05:00
James Westman
b308adc3af Remove backslash from f-string expression
This restriction was removed in Python 3.12, but plenty of users still
have older versions.
2024-08-15 18:28:29 -05:00
James Westman
c1a82a034b decompiler: Add more decompilable tags
Add more tags to the list of things the decompiler can handle. This
required some changes to track the containing object class in the
DecompileCtx, since some objects use the same tag names.

The improved support means we can test the decompiler on most of the
test suite. Any new test samples will by default be tested to ensure the
decompiler produces the original blueprint file.

Also, updated the decompiler to always use double quotes.
2024-07-26 23:05:37 -05:00
Sonny Piers
e44494e6e2 decompiler: Use bind instead of bind-property 2024-06-29 13:32:34 +00:00
Gregor Niehl
cb30bec7b1 decompiler: Format resulting Blueprints 2023-12-29 02:30:13 +00:00
James Westman
3d5a5521aa decompiler: Use single quotes 2023-09-28 17:18:45 -05:00
James Westman
ea92838cf3 Parse escape sequences instead of using replace
That way we can warn about invalid sequences. Also, the previous code had at least one subtle bug (`\\\\'`).
2023-09-28 17:18:45 -05:00
gregorni
3730e2e726 Add isort to CI and run on files 2023-07-09 14:26:37 +00:00
James Westman
04509e4b2e Change template syntax
Templates now use a TypeName instead of an identifier, which makes it
clearer that it's an extern symbol (or that it's a Gtk.ListItem).
2023-05-13 16:49:48 -05:00
James Westman
0cf9a8e4fc
Add Adw.MessageDialog responses extension 2023-03-28 12:43:53 -05:00
Sonny Piers
6f4806bfb3 lsp: Add compile an decompile commands 2023-03-19 22:14:42 +00:00
James Westman
1df46b5a06
Change the way values work
Change the parsing for values to make them more reusable, in particular
for when I implement extensions.
2023-01-12 15:49:19 -06:00
James Westman
0b7dbaf90d
Add some type hints 2023-01-12 15:49:19 -06:00
James Westman
6c67e1fc5a
xml: Fix flags and enums
GtkBuilder XML uses enum nicknames, full names, or integer values, but
we accept GIR names, so passing those through doesn't work if the name
has an underscore (which traditionally turns into a dash in the
nickname). Avoid the problem by always writing the integer value of the
enum member.
2022-12-19 15:15:25 -06:00
James Westman
8fee46ec68
Format using black 2022-12-19 11:52:59 -06:00
James Westman
06f54c8ff8
Use typelib instead of XML
For normal compilation, use .typelib files rather than .gir XML files.
This is much faster.

Rather than using libgirepository, which would try to actually load the
libraries, we use a custom parser.

The language server will still read XML because it needs to access
documentation, which is not in the typelib, but that's generally fine
because it's a long lived process and only has to do that once.
2022-06-25 00:15:20 -05:00
James Westman
7eb0c1ae0d
decompiler: Fix Adwaita version 2022-06-11 02:15:56 -05:00
James Westman
cebd9ecadc
Remove references to gtk-blueprint-tool
It's blueprint-compiler now
2022-05-27 12:25:56 -05:00
James Westman
d73c83aa63 decompiler: Allow and ignore <placeholder/>
Some existing files contain <placeholder/> tags, which should be
permitted but ignored.
2022-03-28 14:34:27 -05:00
James Westman
32d4769f65 Change sync-create to no-sync-create
Fixes #31
2022-02-09 15:39:02 -06:00
James Westman
1150ae1a09 reorganization: Move decompilers 2022-01-26 22:55:27 -06:00
James Westman
34f525beaa reorganization: Rename extensions -> language
I want all language elements to be defined in the same folder, rather
than having the "core" language split by parsing/AST/completions and the rest
split by language element.
2022-01-26 14:10:39 -06:00
Gleb Smirnov
e4283ed0c1 fix: replace non-existing bind flag with existing one
Replace non-existing `after` binding flag with `invert-boolean` flag. Use `inverted` name for convenience.
2022-01-24 20:35:31 +00:00
Gleb Smirnov
8a545d596b
feat: add support of internal children 2022-01-22 09:42:49 +03:00
Gleb Smirnov
4d3c2569c4 decompiler: add support for signal's object attribute 2022-01-17 05:37:17 +00:00
James Westman
34e78de338
decompiler: Support GtkFileFilter tags 2021-12-15 11:32:33 -06:00
Tijder
168b87bb4a Add bind for bidirectional 2021-12-14 19:59:09 +00:00
James Westman
8e4433a487
Create an interactive porting tool
`blueprint-compiler port` interactively ports a project to blueprint.
It will create the subproject wrap file, add it to .gitignore, decompile
your GtkBuilder XML files, emit code to copy and paste into your
meson.build file, and update POTFILES.in.

It can't quite handle all of the features the forward compiler can, so
it will skip those files.
2021-12-01 23:38:28 -06:00