Commit graph

126 commits

Author SHA1 Message Date
Tobias Hunger
13d7f5e7bd Janitor: Fix typos in comments and user-facing strings
Also adapt tests for error messages containing the fixed strings.

No behavior change is intended!
2021-06-28 08:32:25 +02:00
Olivier Goffart
42c25248a8 Allow to give a name to for and if 2021-06-18 16:40:40 +02:00
Olivier Goffart
7384d334c1 WIP: parse callback aliases 2021-06-07 20:40:36 +02:00
Olivier Goffart
715d38903f Allow to omit the type of aliases 2021-06-07 10:48:09 +02:00
Olivier Goffart
01c00251b0 Move parsing code for elements to its own modules 2021-06-07 10:48:09 +02:00
Olivier Goffart
fed73bbd67 syntax_tests: Try to build the object_tree::document even in case of parse error
To make sure it doesn't panic.

Also fix a bunch of errors that were causing panic bacause missing elements in the tree

The goal it to be able to generate a best effort node required for the LSP
2021-04-14 11:46:49 +02:00
Olivier Goffart
84e0b24550 Some refactoring of the syntax_nodes module
Ensure that the node always contains the write kind by panicking
if it doesn't.

Add some documentation for the macro that declares them
2021-04-14 11:46:49 +02:00
Simon Hausmann
a92c9196eb Typeloader cleanup
There are currently two places where we resolve relative file names,
once in the import handling and once when processing @image-url.

Both places called first `loader.find_file_in_include_path` and then `resolve_import_path`,
which this patch combines into one function.

That will make it easier (and less error-prone) for future call sites.
2021-04-14 09:01:52 +02:00
Simon Hausmann
cbf2b51670 Allow empty imports
Allow import "blah.60" or, more likely in the future, import "foo.ttf".
2021-04-14 09:01:49 +02:00
Olivier Goffart
7a65f31cc1 the source_file is not optional 2021-04-13 17:26:24 +02:00
Olivier Goffart
84501e630a Rename SyntaxNodeWithSourceFile to SyntaxNode
Same for SyntaxToken
2021-04-13 17:10:56 +02:00
Olivier Goffart
cb06394685 Remove some more use of SyntaxNode and SyntaxToken 2021-04-13 17:10:56 +02:00
Olivier Goffart
5c795e7bab Use SyntaxNodeWithSourceFile everywhere instead of SyntaxNode 2021-04-13 17:10:56 +02:00
Olivier Goffart
81ebb2177e LSP: completion of properties 2021-04-07 23:55:46 +02:00
Olivier Goffart
72f4827617 Fix message in assert not being a string literal
assert! does take a format string anyway so one need not to use format! as the
message of an assert. (That's better since then a string is not allocated when
the assert is going to succeed anyway
2021-03-25 17:08:15 +01:00
Olivier Goffart
cae88f0823 Create a Diagnostic quen the main .60 file can't be loaded 2021-03-15 11:44:20 +01:00
Olivier Goffart
730b1ccff2 Refactor diagnostic: Merge BuildDiagnostic and FileDiagnostic 2021-03-12 19:32:50 +01:00
Olivier Goffart
968dfaae87 Put what is the FileDiagnostics into the SourceFile so the SourceFile has the content 2021-03-11 16:23:46 +01:00
Olivier Goffart
7c48bcdd4c Add the source file getter to the Spanned trait, and remove SpannedWithSourceFile 2021-03-11 14:09:55 +01:00
Olivier Goffart
2d12e118ac Resolve linear gradients 2021-02-01 14:25:27 +01:00
Olivier Goffart
8ab713c681 Parse @linear-gradient(...) 2021-02-01 14:25:27 +01:00
Olivier Goffart
82aa658cef Update rowan 2021-01-28 15:37:01 +01:00
Olivier Goffart
3b968c8a8e Fixup previous commit
the $children replacement shouldn't have replaced rust code
2021-01-28 11:58:43 +01:00
Olivier Goffart
07df517473 Replace $children with @children 2021-01-28 11:55:08 +01:00
Olivier Goffart
bb4212f0aa Remove bang macro support 2021-01-28 11:49:24 +01:00
Olivier Goffart
5debc08f98 Parse @image-url 2021-01-28 11:49:24 +01:00
Simon Hausmann
16a75a2ff8 Parse return statements 2021-01-25 15:32:00 +01:00
Olivier Goffart
8dc79699de String template concatenation
Currently not supported in the sixtyfps macro
2021-01-18 16:09:58 +01:00
Olivier Goffart
882bd7ddb7 Lex template string 2021-01-18 14:43:54 +01:00
Olivier Goffart
7fcb49bef1 Implement Go to definition for elements 2020-12-23 15:15:53 +01:00
Olivier Goffart
0d2d48be4f Rename "signal" to "callback" 2020-12-18 09:51:01 +01:00
Olivier Goffart
7f78bea8b5 Fix a bunch of cargo clippy warnings in the compiler 2020-12-07 12:54:38 +01:00
Olivier Goffart
8b10414451 Parse signal return type
(currently does nothing with it)
2020-12-01 18:47:49 +01:00
Simon Hausmann
6fba6aca56 Consistency fix for transitions API
Use "in" and "out" instead of "to" and "out".
2020-12-01 11:18:47 +01:00
Olivier Goffart
281a744e86 Load the builtin from a fake .60 file 2020-11-04 16:56:35 +01:00
Simon Hausmann
ef18e89e4f Typeloader cleanup
Split the document loading related part of load_dependency into a
separate ensure_document helper function.
2020-11-04 14:16:58 +01:00
Olivier Goffart
11e55dd8d2 String -> Float conversions 2020-11-03 15:19:58 +01:00
Olivier Goffart
980aceded6 Parser: put the component name in a DeclaredIdentifier node
that way we will be able to have the global keyword as another identifier there
2020-10-28 07:18:24 +01:00
Olivier Goffart
b9533a217e Parse struct declaration 2020-10-27 16:09:05 +01:00
Olivier Goffart
76b7f1aef6 Allow dashes in identifier
Currenly, dashes are normalized to '_'.
Dashes are not allowed at the begining of an identifier.
If an identifier with a dash is not found, we also look for identifier
without a dash and if that exist, we hint the user to use spaces.

Issue #52
2020-10-22 18:32:25 +02:00
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