Commit graph

86 commits

Author SHA1 Message Date
Olivier Goffart
4981c3ca75 Some check for the two way bindings 2020-09-23 14:06:08 +02:00
Olivier Goffart
e3459f39d4 Parse two ways bindings 2020-09-23 14:06:08 +02:00
Olivier Goffart
e0ed5252a8 Parse type declaration
```
export Foo := {
    property <int> xxx;
}
```
2020-09-16 18:26:13 +02:00
Olivier Goffart
c809638003 Parse signal handler with arguments (parsing only) 2020-09-07 18:14:17 +02:00
Olivier Goffart
9f026c820d Parse declaration of signal with arguments 2020-09-07 17:41:24 +02:00
Simon Hausmann
2a9c962b8d Exclude exposure of easing and duration typed properties
We decided that their type mapping is not ready for public API yet. For
example for duration we'd like to replace the opaque i64 with another
opaque type that however has convenient conversions to
std::time::Duration or std::chrono::milliseconds. We can't use either
directly because we need ffi compatibility, in order to create an
instance in C++ and pass it to the Rust run-time.

So this hides such properties and instead produces a warning.
2020-09-04 21:25:11 +02:00
Olivier Goffart
9fbb40d91b Start working on a debug statement 2020-09-03 19:10:07 +02:00
Olivier Goffart
9d405060e2 Parse object and array type 2020-09-03 07:43:20 +02:00
Patrick José Pereira
b63852967e sixtyfps_compiler: parser: Move code to use new nth and kind functions
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-08-31 15:02:41 +02:00
Patrick José Pereira
9cd4cb80e2 sixtyfps_compiler: parser: Change nth function of Parser to return Token
Improve the Parser functionality allowing access to the nth Token,
resulting in a much more flexible API.

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-08-31 15:02:41 +02:00
Patrick José Pereira
a7b376fe7b sixtyfps_compiler: parser: Add kind function for Token
This allow access to the private property

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-08-31 15:02:41 +02:00
Simon Hausmann
c1aa4b28c6 Add support for children insertion points for components
Sometimes re-usable components need to act as containers that allow the
user to place other items inside. The component needs to be able to
control the placement of these user-provided elements. That is what the
new

    $children

expression inside elements does.
2020-08-28 15:05:21 +02:00
Olivier Goffart
10e8d7ffb9 Replace the regexp-based lexer with a custom lexer
The regexp crate is huge and takes more than a third of the size of the
wasm-interpreter.
2020-08-28 13:34:43 +02:00
Olivier Goffart
58cdaeb8dd Update license header to mention that commertial option are available 2020-08-26 13:23:42 +02:00
Simon Hausmann
2823f32692 Apply license headers to all non-binary/non-json sources 2020-08-17 17:55:20 +02:00
Olivier Goffart
0199b70cea if statements 2020-08-04 17:36:20 +02:00
Simon Hausmann
84406cc70b Add support for renaming imports
This is very useful to avoid name clashes.
2020-07-23 10:12:45 +02:00
Simon Hausmann
a9b0d84a72 Improve source file propagation
Instead of doing the SyntaxNodeWithSourceFile construction as late as
possible (in Document::from_node), we can do it as early as possible.
That'll reduce the chances of missing out the source file and prepares
for dependency loading just based on a SNWS :)

This also makes the source_file optional in the SNWS, but that's
consistent with what the diagnostics expect.
2020-07-22 16:10:02 +02:00
Simon Hausmann
0b5f4054ea Improve import uri parsing
Avoid unnecessary SyntaxKind variants. The import uri is simply the first string literal in the ImportSpecifier.

Also covert the case of an empty import list and use expect() instead of
test() to produce a meaningful error message.
2020-07-22 14:06:42 +02:00
Simon Hausmann
3e619170cd Extend the parser with support for import statements 2020-07-22 11:31:58 +02:00
Simon Hausmann
3e21aafab9 Add support for direct export for convenience 2020-07-22 08:45:49 +02:00
Simon Hausmann
921a41b07c Add support for explicit exports from files
Using an ES module inspired syntax, this allows free naming and control
over exported names.
2020-07-22 08:40:30 +02:00
Simon Hausmann
abe6888296 Collect proper per-file diagnostics in the compiler passes
When creating diagnostics in the passes, report them correctly in the
build diagnostics. There's no automated test yet, but it was manually
verified.
2020-07-21 15:27:41 +02:00
Simon Hausmann
26528a8e9c Keep track of the source file in the syntax tree
When going from the plain rowan::SyntaxNode tree to the syntax_nodes::*
elements, attach the source file and keep track of it from that point
on. That'll pave the way for proper multi-file diagnostics generated
later on from the passes, where we store syntax_nodes::* types.
2020-07-21 15:27:41 +02:00
Olivier Goffart
9d735d98cd Build the transitions tree and more flexible animations 2020-07-20 18:46:04 +02:00
Simon Hausmann
f8c0eb0bd6 Prepare for passing passing more information from syntax node to diagnostics
Let the bulk of the push_error() calls take a Spanned trait impl, so
that we can pass node on the call sites. Then when later change the
underyling trait to pass something that can also provide the source file
and we don't have to change all call sites again.
2020-07-20 16:01:15 +02:00
Simon Hausmann
0cb59381e4 Fix type of PropertyDeclaration::type_location
In preparation for passing through the source file, avoid storing the Span
in the object tree and instead store the syntax node.
2020-07-20 15:36:17 +02:00
Simon Hausmann
31223c4b96 Store the path in the diagnostics as Rc
This string (path) will be shared a lot more often in the future.
2020-07-20 15:35:43 +02:00
Olivier Goffart
0dff3f5f78 Parse state and transition 2020-07-20 12:59:12 +02:00
Simon Hausmann
e914715d88 Rename Diagnostics to FileDiagnostics
As this structure holds the diagnostics just for one file.
2020-07-16 18:25:42 +02:00
Olivier Goffart
170564ecea Implement % as a unit 2020-07-16 11:24:46 +02:00
Simon Hausmann
64a4e749b7 Simplify path setup in the Diagnostics
Pass the path to the parse function, as that's easier at most call sites.
Also offer a convenience parse_file function.
2020-07-15 19:21:25 +02:00
Simon Hausmann
8e047d3761 Simplify compiler diagnostics API
Don't require the callers to hold on to the source code string until an
eventual diagnostics code path is hit. Instead it turns out it's
simpler to let the parser consume the source code as string, where
internally after tokenizing it can be moved into the diagnostics and
from there into the code map if needed.

There are a few places where we now clone the source code, but that's
only in cases where we also extract stuff separately (test code) or the
syntax updater.
2020-07-15 17:34:11 +02:00
Olivier Goffart
c30aa370f3 Parse units
They currently have no real meaning
2020-07-14 11:35:45 +02:00
Simon Hausmann
4c0755d6cc Change the way boolean literals are implemented
Instead of catching them at parsing time, catch them when trying to convert a qualified name node into an expression.
2020-07-07 22:53:35 +02:00
Simon Hausmann
22d838ffae Add support for true and false boolean literals 2020-07-07 22:11:41 +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
Olivier Goffart
19a8559d3f WIP: Conditional elements
The parsing part is implemented, but not the backend as it requires
non-const "models"
2020-06-29 15:03:09 +02:00
Simon Hausmann
388c98bba5 Parse animate someProperty { ... } declarations 2020-06-24 17:43:48 +02:00
Olivier Goffart
897edb8ac1 Parse object literal 2020-06-18 12:35:37 +02:00
Olivier Goffart
93dbc3b02d Parse array 2020-06-18 12:20:04 +02:00
Olivier Goffart
5cd4ed7347 Arithmetic operations 2020-06-16 19:04:03 +02:00
Olivier Goffart
8713c10d48 Color literals 2020-06-11 19:26:41 +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
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
8b6bb47af8 Create a type alias for Rc<RefCell<Element>> 2020-06-11 15:28:51 +02:00
Olivier Goffart
708e62800d Test that the tree is well formed for what we expect 2020-06-11 15:01:09 +02:00
Simon Hausmann
fdbef8c3c4 Add support for parsing conditional expression syntax 2020-06-10 15:40:27 +02:00