Commit graph

44 commits

Author SHA1 Message Date
Olivier Goffart
8e7e3aaa7a Make the length its own unit 2020-07-14 17:45:03 +02:00
Olivier Goffart
4b20bf97ef Add px unit in many places
(This was done automatically with the updater)
2020-07-14 17:14:59 +02:00
Olivier Goffart
952ddda7c4 Force duration to have an unit 2020-07-14 16:18:12 +02:00
Olivier Goffart
c30aa370f3 Parse units
They currently have no real meaning
2020-07-14 11:35:45 +02:00
Simon Hausmann
5e8d23a287 Accept PathLayout just by syntax 2020-07-09 14:18:26 +02:00
Simon Hausmann
251ef7fc97 Add support for SVG commands in Path elements
Using the commands property we can just paste SVG paths. This makes it
much easier to write examples/demos. A good online path designer is
for example https://codepen.io/anthonydugois/pen/mewdyZ
2020-07-09 13:41:57 +02:00
Simon Hausmann
c17c06c6e7 Making closing of a path optional
By default paths are not closed and they can be closed using a Close {}
element.
2020-07-09 09:52:09 +02:00
Simon Hausmann
f03ba40d50 Fix spurious test failures
The accepted child element types are stored in a hash map, so sort them
as part of the error message.
2020-07-07 18:21:59 +02:00
Simon Hausmann
f646809ff4 Added ArcTo element for paths 2020-07-07 16:02:46 +02:00
Olivier Goffart
009addf9b4 Logical operations and comparisons and unary operators 2020-06-29 18:40:37 +02:00
Olivier Goffart
c4b1feeea0 Parse Equality opreration
(Code generation still missing)
2020-06-29 18:40:37 +02:00
Simon Hausmann
c653f555ea Begin parsing Path elements
As types they follow the regular syntax convention of elements and
properties, but they are contextually restricted.
2020-06-29 16:48:20 +02:00
Simon Hausmann
ab697ab71d Parse animation declarations into the object tree
So

    animate x { ... }

is basically a short-hand for

    PropertyAnimation {
        ...
    }

    <magically associated that animation with x whenever x is changed>

We could also support a shared animation syntax in the future:

    blah := PropertyAnimation { ... }

    animate x with blah;
    animate y with blah;

This patch also adds a primitive PropertyAnimation struct, which will be
used by the generated code to collect the values specified in the .60
markup.
2020-06-24 17:43:48 +02:00
Olivier Goffart
911d34e777 Use BTreeMap for the object type so that type order is deterministic 2020-06-18 17:48:08 +02:00
Olivier Goffart
be8f127317 Object and array parsing 2020-06-18 15:22:30 +02:00
Olivier Goffart
93dbc3b02d Parse array 2020-06-18 12:20:04 +02:00
Olivier Goffart
9adc55cd70 Partially revert the refactoring that changed the Element::children list
Put the information about RepeatedElement in an Option within the normlal Element
2020-06-15 13:42:11 +02:00
Olivier Goffart
c956fb94f0 Put the RepeatedElement in the object_tree 2020-06-15 10:09:32 +02:00
Olivier Goffart
ef9d3963e4 Fix casting of conditional operator 2020-06-12 10:32:56 +02:00
Olivier Goffart
788137e3d5 Parser: allow to specify an index token in bracket in the for loop 2020-06-11 16:55:22 +02:00
Olivier Goffart
96a372e45d Grid layout in the interpreter
current imploementation is just a prototype
2020-06-10 19:40:47 +02:00
Simon Hausmann
63f81e1991 Add basic support for conditional expressions
Todo are automated tests and cleaning up the C++ implementation.
2020-06-10 16:04:15 +02:00
Simon Hausmann
fdbef8c3c4 Add support for parsing conditional expression syntax 2020-06-10 15:40:27 +02:00
Simon Hausmann
5bae6e01a5 Prepare for the ability to embed image data
The Image's source property used to be a string. Now it is a Resource
enum, which can either be None or an absolute file path to the image on
disk. This also replaces the internal Image type.

The compiler internally resolves the img bang expression to a resource
reference, which shall remain just an absolute path. For now the target
generator passes that through, but in the future the target generator
may choose a target specific way of embedding the data and thus
generating a different Resource type in the final code (through
compile_expression in the cpp and rust generator).

The C++ binding is a bit messy as cbindgen doesn't really support
exporting enums that can be constructed on the C++ side. So instead we
use cbindgen to merely export the type internally and only use the tag
from it then. The public API is then a custom Resource type that is
meant to be binary compatible.
2020-06-09 22:54:29 +02:00
Olivier Goffart
0e67a0ecbc Block comments 2020-06-08 10:40:02 +02:00
Olivier Goffart
95b671c97c Support for code blocks and signal call 2020-05-28 12:30:08 +02:00
Olivier Goffart
92697ec6b0 Add some code to parse statements in blocks (separated with semicolon) 2020-05-28 07:22:08 +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
b12e63de52 Fix lookup of property within component 2020-05-26 07:43:12 +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
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
32b99547f1 Parse property declarations
For now this uses the syntax

    property<qualified type name> name;
2020-05-25 12:38:29 +02:00
Olivier Goffart
d8601621c0 Use the tool to replace = with := 2020-05-25 10:44:22 +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
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
260f17a3e0 Support for inline components within a .60 file 2020-05-19 17:43:56 +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
b128a848e2 Parse quoted string 2020-05-06 18:24:30 +02:00
Olivier Goffart
05624c68ee Add some properties in the Rectangle 2020-05-06 17:53:42 +02:00
Olivier Goffart
cd670d6012 Compiler tests 2020-05-05 12:43:42 +02:00