Olivier Goffart
c956fb94f0
Put the RepeatedElement in the object_tree
2020-06-15 10:09:32 +02:00
Olivier Goffart
136a90907b
Refactor the element children to account for RepeatedElements
2020-06-12 22:24:50 +02:00
Simon Hausmann
9a935bdd0f
Provide convenience accessors for public signals in C++ and Rust
...
Typically their emission requires an evaluation context parameter.
Similar to properties, provide a public emitter function that takes care
of the context.
This also required two fixes in the compiler, in order to make the
following (as part of the test case) work:
signal foo;
foo => { ... }
(1) Register declared signals before attempting to implement the
connection handlers.
(2) When looking up the signal property, not only look in the base
type but also in the current type.
2020-06-11 21:05:52 +02:00
Olivier Goffart
e95d7da888
Parser: typed syntax node accessor
2020-06-11 17:50:28 +02:00
Olivier Goffart
d4594cff97
Introduce a new DeclaredIdentifier
syntax kind to disambiguiate identifiers when there are several
2020-06-11 16:55:38 +02:00
Simon Hausmann
be3d0ab369
Provide convenience accessors for public properties in C++
...
While properties declared in the root component are named as-is and
exposed as Property<T>, their get() function in particular is hard to
use because it requires an EvaluationContext as a parameter.
This patch adds get_foo() and set_foo() accessors for each public
property and hides the evaluation context business for the getter.
The added test uses this right away and adds missing test coverage for
the conditional expression.
2020-06-11 15:45:16 +02:00
Olivier Goffart
8b6bb47af8
Create a type alias for Rc<RefCell<Element>>
2020-06-11 15:28:51 +02:00
Olivier Goffart
96a372e45d
Grid layout in the interpreter
...
current imploementation is just a prototype
2020-06-10 19:40:47 +02:00
Olivier Goffart
ed69f4c432
WIP layouts
2020-06-10 19:40:47 +02:00
Simon Hausmann
1404cb73ae
Add support for embedding resources in the rust generator
...
This is relatively straight-forward via a pass in the compiler to
collect the resources to embed and then use include_bytes! (once per
resource).
What's really annoying is that the rust resource enum can't store a
&'static [u8] because cbindgen doesn't represent that, probably because
the slice representation isn't guaranteed to stay as it is. So instead
this, for now, uses raw pointers.
2020-06-09 22:54:29 +02:00
Olivier Goffart
a756b7fa0e
Keep a reference to the AST node in the Element structure
...
So we can give error for elements
2020-06-09 18:20:32 +02:00
Olivier Goffart
c05da294a1
Add GridLayout and Row
...
The compiler currently lowers them to nothing
2020-06-09 12:46:16 +02:00
Olivier Goffart
e86a7d3192
Merge signal and property declaration
...
A Signal is just a property of type Type::Signal
Simplifies the code a bit
2020-05-28 12:49:18 +02:00
Olivier Goffart
95b671c97c
Support for code blocks and signal call
2020-05-28 12:30:08 +02:00
Olivier Goffart
3472674262
Add a pass to assign unique id to the elements
2020-05-27 08:20:52 +02:00
Olivier Goffart
36fb526811
Do inlining in a pass before the lowering
2020-05-26 15:10:27 +02:00
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
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
747cf18fcd
Small typo fix
...
(Unkown -> Unknown)
2020-05-25 16:42:09 +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
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
4575011293
More work on signal: the C++ part is working
2020-05-20 19:28:58 +02:00
Olivier Goffart
0e85886301
Only allow to connect to existing signals
2020-05-20 13:36:47 +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
6e794bec18
Have a small Expression AST
2020-05-12 14:54:32 +02:00
Olivier Goffart
b9cd725f78
Allow to use proc_macro tokens
...
And report errors
2020-05-11 22:24:28 +02:00
Olivier Goffart
6cf327166e
Parser: add support for parentheses in expressions
2020-05-11 11:19:57 +02:00
Olivier Goffart
1673f12652
Implement for loop in the parser
...
Not yet implemented in the object tree
2020-05-11 10:46:42 +02:00
Olivier Goffart
a9690a2fa3
Add a bunch of comments
2020-05-07 14:39:54 +02:00
Olivier Goffart
bdaf14ae23
Parse numbers
2020-05-07 09:06:58 +02:00
Olivier Goffart
05624c68ee
Add some properties in the Rectangle
2020-05-06 17:53:42 +02:00
Olivier Goffart
3a541ec1eb
Handle children elements
2020-05-06 16:43:04 +02:00
Olivier Goffart
30646068c0
Fix the CodeStatement::from_node
2020-05-05 18:36:24 +02:00
Olivier Goffart
acccb33c8c
Lower and generate some C++
2020-05-05 18:31:00 +02:00
Olivier Goffart
3a6d39bfe9
Generate an object tree
2020-05-05 11:18:13 +02:00