Commit graph

94 commits

Author SHA1 Message Date
Olivier Goffart
dc276290e9 Add support for self assignment (+=, -=, ...) 2020-05-28 17:02:06 +02:00
Simon Hausmann
993caa1cd4 Fix conversion from float to string in Rust frontend
Use as_str() to fix the compilation and call the macro with a bang :)
2020-05-28 15:20:30 +02:00
Simon Hausmann
97dc677854 Emit signal handler bindings and expressions for emitting signals in the Rust frontend 2020-05-28 15:20:30 +02:00
Simon Hausmann
a3892ea102 Emit declared signals in the rust frontend 2020-05-28 15:20:30 +02:00
Simon Hausmann
e227f8a46e Use both set() and set_binding() in the rust frontend
When an expression holds just a constant value, then we can avoid creating a binding.
2020-05-28 14:41:15 +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
Simon Hausmann
f2df9293a9 Fix the C++ build
Remove the Optional from the evaluation context passing for property
evaluation. Unfortunately there are nullptr uses left on the C++ side,
that need to be replaced with passing through.
2020-05-28 12:07:11 +02:00
Simon Hausmann
4f9c53879b Implement property references as bindings in the Rust frontend 2020-05-28 11:37:59 +02:00
Olivier Goffart
250b0a2e5b Rust macro: get the right span for the diagnostics
Merge the features proc_macro_span and proc_macro_diagnostics, they are the same.
2020-05-27 18:37:45 +02:00
Olivier Goffart
486b2ab8f8 Do type checking and convert from number to string 2020-05-27 15:43:45 +02:00
Simon Hausmann
c8b64f5c4b Remove the lowering
The LoweredItem and LoweredComponent contained, in essence, the same
information as the Element and Component in object_tree. Since the
moving declarations pass moved everything to the root element and the
LoweredPropertyDeclarations have been removed as well, this is the last
step.
2020-05-27 14:45:35 +02:00
Simon Hausmann
32990e15e2 Remove LoweredPropertyDeclaration
This type that allowed indexing the property declarations in the hierarchy
to the properties moved to the root is not needed anymore.
For now a simple set remains in the LoweredItem to generate
correct accessor prefixes.
2020-05-27 11:13:58 +02:00
Simon Hausmann
0504ea566c Add support for declaring properties in Rust 2020-05-26 15:21:33 +02:00
Simon Hausmann
e77fe37568 Make it more convenient to deal with diagnostics in the Rust frontend
Provide a ToTokens implementation of Diagnostics by moving the code from the macro.
This makes it easier later to re-use the same logic to return
with diagnostics.
2020-05-26 15:17:18 +02:00
Olivier Goffart
36fb526811 Do inlining in a pass before the lowering 2020-05-26 15:10:27 +02:00
Olivier Goffart
4ea78134d8 Recactor the compiler so there are passes 2020-05-26 09:40:36 +02:00
Olivier Goffart
5a7a95dbc8 Make sure that we do not recognize ': =' or '= >' as one token 2020-05-25 18:15:06 +02:00
Olivier Goffart
e34ac8c3f4 Get signals and toucharea working on the rust example 2020-05-25 17:41:24 +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
Olivier Goffart
1de4eb476b Lookup of identifier is now done while resolving expressions 2020-05-25 14:37:09 +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
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
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
25bf149e13 Add a shared string that can be used in properties 2020-05-18 17:09:40 +02:00
Olivier Goffart
751a3fbe59 Work on const field offset crate to give type safe offsets 2020-05-18 11:06:44 +02:00
Olivier Goffart
aff3d7e14b vtable: add safe way to construct references 2020-05-18 11:06:44 +02:00
Olivier Goffart
4ca45ca4da vtable crate: Some refactoring and simplifications 2020-05-18 11:06:44 +02:00
Olivier Goffart
4988fcb543 More fix to use vtable for component. All rust code compiles 2020-05-18 11:06:31 +02:00
Olivier Goffart
686f4c9591 More work on the vtable macro to adapt the Component
This does not work yet
2020-05-18 11:04:54 +02:00
Olivier Goffart
4b19818f6c WIP: port Component to vtable 2020-05-18 11:04:54 +02:00
Simon Hausmann
3aac8282a8 Allow passing string literals to string properties in Rust
In the Rust code generator, convert to a null terminated byte literal.
2020-05-13 10:01:19 +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
dbada7977e Fix C++ build 2020-05-12 08:03:18 +02:00
Olivier Goffart
b9cd725f78 Allow to use proc_macro tokens
And report errors
2020-05-11 22:24:28 +02:00
Olivier Goffart
dc33cbbcda Dummy structure for the rust example 2020-05-11 20:39:16 +02:00
Simon Hausmann
a4b69b23c0 Fix contact info in Cargo manifests 2020-05-04 11:54:45 +02:00
Simon Hausmann
c6553d007e Initial commit laying out the structure 2020-05-04 10:49:58 +02:00