Commit graph

281 commits

Author SHA1 Message Date
Simon Hausmann
96d5165d28 Correctly report type conversion errors in the C++ backend
This requires a bit of error propagation, but now the errors are
reported correctly, in the unlikely event that they occur.
2020-05-26 11:45:22 +02:00
Olivier Goffart
a39a72b240 Fix the syntax_tests to actually match the regexp
The error regexp was not properly matched, being effectively ignoed.
Fixed that and the tests.
Added self tests to syntax_tests.
2020-05-26 11:24:37 +02:00
Olivier Goffart
7ba39f0a1c Make sure that we cannot override a property from the base 2020-05-26 11:23:54 +02:00
Olivier Goffart
4ea78134d8 Recactor the compiler so there are passes 2020-05-26 09:40:36 +02:00
Olivier Goffart
e8e1567975 Make the compiler actualy use the lib rather than re-declaring everything 2020-05-26 09:18:31 +02:00
Olivier Goffart
dee50a6fe8 More fixes to property lookup with components 2020-05-26 08:10:37 +02:00
Olivier Goffart
b12e63de52 Fix lookup of property within component 2020-05-26 07:43:12 +02:00
Simon Hausmann
0932953ac8 Implement property declarations for the C++ backend 2020-05-25 19:13:52 +02:00
Olivier Goffart
905f6c7b15 Fix signal lookup for now
Real signal lookup is still not implemented, any identifier for a signal property is considered as a signal
2020-05-25 17:34:38 +02:00
Olivier Goffart
9e4c355fa1 Lookup of quallified id 2020-05-25 17:24:31 +02:00
Simon Hausmann
1efa80882e Parse initializers for property declarations 2020-05-25 16:42:09 +02:00
Simon Hausmann
b3ee72b6c5 Permit bindings on declared properties
At least syntactically :-)
2020-05-25 16:42:09 +02:00
Simon Hausmann
88faafe305 Fix property declaration storage in the object tree
We need to maintain an associated data structure to permit checking for
duplicate property declarations.
2020-05-25 16:42:09 +02:00
Simon Hausmann
a55cad05b9 Allow running specific syntax tests
By specifying the relative path as a command line argument, it's easier to
debug a specific case in the IDE.
2020-05-25 16:42:09 +02:00
Simon Hausmann
747cf18fcd Small typo fix
(Unkown -> Unknown)
2020-05-25 16:42:09 +02:00
Olivier Goffart
19eca01dff Lookup of property within the root component 2020-05-25 16:13:17 +02:00
Olivier Goffart
ce657a5b01 Add test for failled lookup 2020-05-25 15:50:34 +02:00
Olivier Goffart
2bc695643d Fix the type of color 2020-05-25 15:43:19 +02:00
Olivier Goffart
c0a4902240 Rename expressions -> expression_tree
there is already an expressions module in the parser
2020-05-25 15:28:37 +02:00
Simon Hausmann
73917187d6 Fix error message for duplicate property bindings 2020-05-25 15:05:11 +02:00
Olivier Goffart
11e5ce5887 Rename the CondeStatement syntax node to BindingExpression
This is the right-hand-side of a binding, and it is a pure expression.
Statements will be reserved for signals
2020-05-25 14:58:26 +02:00
Olivier Goffart
1de4eb476b Lookup of identifier is now done while resolving expressions 2020-05-25 14:37:09 +02:00
Simon Hausmann
e6bed90ced Resolve the type in property declarations
... and added int32 as another primitive type.
2020-05-25 14:03:01 +02:00
Simon Hausmann
d4387b74b9 Rename Type::Number to Type::Float32
Properties of that type are implemented as f32.
2020-05-25 13:52:31 +02:00
Olivier Goffart
3629e5f158 Refactor the Expression
So we will resolve the expression in a different step
2020-05-25 13:15:10 +02:00
Simon Hausmann
32b99547f1 Parse property declarations
For now this uses the syntax

    property<qualified type name> name;
2020-05-25 12:38:29 +02:00
Simon Hausmann
5accea4cdd Add support for qualified type names to the parser 2020-05-25 11:53:44 +02:00
Olivier Goffart
dd756ef112 Adapt the parser to parse := instead of = 2020-05-25 10:46:00 +02:00
Olivier Goffart
d8601621c0 Use the tool to replace = with := 2020-05-25 10:44:22 +02:00
Olivier Goffart
270c626c6c Make the Parser a trait
Because the rowan::GreenNode is read-only but i want to use the parser
to generate something that can be mutated
2020-05-22 15:31:27 +02:00
Simon Hausmann
8b854c32c3 Add Text::font_family and font_pixel_size properties
We can fine-tune the API, this works for now to change :-)
2020-05-21 21:04:07 +02:00
Olivier Goffart
54eb0f831b Fix the children allocation array
The offsets was not computed properly
2020-05-21 13:14:28 +02:00
Olivier Goffart
4575011293 More work on signal: the C++ part is working 2020-05-20 19:28:58 +02:00
Olivier Goffart
4f22e2c341 Add a bool property type 2020-05-20 13:36:47 +02:00
Olivier Goffart
0e85886301 Only allow to connect to existing signals 2020-05-20 13:36:47 +02:00
Olivier Goffart
efe0ccfb3f Add support for signal in the parser
(currently not doing anything else than parsing)
2020-05-20 12:53:08 +02:00
Olivier Goffart
300cd9653a Move the expression parse funciton in their own module 2020-05-20 12:30:30 +02:00
Olivier Goffart
6b3765857a Add a TouchArea builtin item (currently does nothing) 2020-05-20 09:32:01 +02:00
Olivier Goffart
260f17a3e0 Support for inline components within a .60 file 2020-05-19 17:43:56 +02:00
Olivier Goffart
ab28828351 Support for img!("foo.png") to make string absolute
This is a temporary solution until we get better ressource handling
2020-05-19 16:30:48 +02:00
Olivier Goffart
a4569ddca3 BangExpression allow for finding relative paths 2020-05-19 15:36:56 +02:00
Olivier Goffart
f4bfc3a5b4 Use the property system for our components 2020-05-19 15:15:23 +02:00
Simon Hausmann
23d3964a0d Add boilerplate for text items
Forward the text and color properties to the rendering backend, where
right now we just rendering all the glyphs into a dedicated texture.

Next steps are a glyph atlas texture, blending the specified color with
the alpha of the glyphs, configurable size and family, shaping with
Harfbuzz and may more things.
2020-05-18 19:04:12 +02:00
Olivier Goffart
544cb1a198 Fix C++ compilation using the vtable crate 2020-05-18 11:06:42 +02:00
Olivier Goffart
f88d856990 Put the diagnostic printing in the compiler lib
(with an option so we don't drag the codemap dependencies for the proc_macro case)
2020-05-12 17:42:25 +02:00
Olivier Goffart
638c445cf9 Support for rendering sub-elements with proper offset 2020-05-12 15:38:50 +02:00
Olivier Goffart
6e794bec18 Have a small Expression AST 2020-05-12 14:54:32 +02:00
Olivier Goffart
7c2f40da90 Generator for the rust API 2020-05-12 11:43:29 +02:00
Olivier Goffart
3936272384 Move the build_array_helper in the generator module 2020-05-12 09:47:54 +02:00
Olivier Goffart
8bcd4b1115 CI: build with all features 2020-05-12 08:23:51 +02:00