Commit graph

50 commits

Author SHA1 Message Date
Simon Hausmann
01c3347d19 Make fluent the new default style
It's not ugly :-)
2021-08-10 15:56:38 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
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
Tobias Hunger
a38868b4aa Janitor: Fix typo in local function name
No behavior change is intended!
2021-06-28 08:32:00 +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
f1a7847820 Fixup syntax_tests 2021-03-15 12:41:10 +01:00
Olivier Goffart
a203097b88 Attempt to fix windows syntax_tests
Looks like the slashes were not canonical on Windows
2021-03-15 12:05:03 +01:00
Olivier Goffart
014e13b05f Make Diagnostic field private 2021-03-15 10:37:24 +01:00
Olivier Goffart
730b1ccff2 Refactor diagnostic: Merge BuildDiagnostic and FileDiagnostic 2021-03-12 19:32:50 +01:00
Olivier Goffart
fc35d101d9 Rename diagnostics::level to DiagnosticLevel 2021-03-11 16:27:40 +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
Simon Hausmann
5f9f1ce047 Fix the build
Fix the remaining CompilerConfiguration uses that I missed :(
2020-12-10 16:13:17 +01:00
Olivier Goffart
359f42c5f7 Prepare the compiler to be async
This will allow the online editor to load imports from URL asynchroniously later

Since currently the compiler is only working on a single thread, and that we
never await on a future that could block, it is allowed to use the spin_on executor
2020-10-30 15:00:04 +01:00
Simon Hausmann
14ad99fed4 Add support for checking diagnostics in imported files 2020-10-29 12:51:36 +01:00
Olivier Goffart
84f0fb7b07 Display a warning when no style is selected 2020-10-12 11:50:39 +02:00
Olivier Goffart
4845920dea On windows, the files are checked in with \r\n, and the test must accept that 2020-09-05 19:27:35 +02:00
Simon Hausmann
d8e51dc03d Include warnings in the expected diagnostics of the syntax tests
Since some lines may produce multiple warnings/errors, the regex
supports now multiple carets, which indicates the number of lines to
walk back. This is a bit hacky, but it works :-)
2020-09-04 21:26:21 +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
38cd9158ac Report the error while building the Document node
Instead of panicking in later phase.

Use the same function in the syntax_tests that the one we use in the different
compiler frontend so that the problems would also be shown in the tests
2020-08-05 10:54:59 +02:00
Olivier Goffart
733f44f50b Error when using a layout property outside of a layout 2020-07-28 18:24:36 +02:00
Simon Hausmann
bd1c760eca Change object_tree::Document to take a syntax_nodes::Document
We're going to need the Document earlier on anyway for dependency
analysis.
2020-07-23 08:35:35 +02:00
Simon Hausmann
7b7f38ae65 Clean up compiler tests directory a little
I added files unrelated to the syntax tests in the tests/ folder, but
that won't scale. Those files aren't meant to be subject to the syntax
test and there are more files to come in the future. So this change
moves the syntax test related cases into a dedicated sub-folder, as well
as the type loader/registry related ones.
2020-07-22 14:36:01 +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
Simon Hausmann
732a56259f Simplify compilation call sites further
Move run_passes into the library compilation function. That way the
FileDiagnostics are created by the parser, can be passed on to the library
compilation function and after that we don't need them anymore and can
replace them with future BuildDiagnostics for example.
2020-07-16 18:53:59 +02:00
Simon Hausmann
4c65760322 Fold FileLoadError into the diagnostics module
The FileDiagnostics now hold a vector of Diagnostic elements, which is an
enum of either a CompilerDiagnostic or a FileLoadError.
2020-07-16 18:28:27 +02:00
Simon Hausmann
c3aae7648a Further simplify compilation call sites
Remove the need to construct the type registry at all the call sites by
offering a compile_syntax_node function in the compiler library.
2020-07-16 09:25:26 +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
Simon Hausmann
5b43962bb2 Split up TypeRegistry
For a .60 files the locally defined components are now stored in a separate
per-document TypeRegistry instance that falls back to the global registry
for lookups.
2020-07-15 13:09:43 +02:00
Olivier Goffart
8e7e3aaa7a Make the length its own unit 2020-07-14 17:45:03 +02:00
Olivier Goffart
952ddda7c4 Force duration to have an unit 2020-07-14 16:18:12 +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
195a5d0e84 Syntax tests: do not try to generate a document tree if the parser did not succeed 2020-06-15 09:37:56 +02:00
Olivier Goffart
f71b778e76 Syntax tests: Log which file is causing a panic 2020-06-15 09:34:41 +02:00
Olivier Goffart
e95d7da888 Parser: typed syntax node accessor 2020-06-11 17:50:28 +02:00
Simon Hausmann
f95b31bca4 Fix build 2020-06-09 23:24:38 +02:00
Olivier Goffart
3651885d87 Move the compiler binary in tools/
And rename sixtyfps_compiler to sixtyfps_compilerlib
2020-06-05 09:23:38 +02:00
Olivier Goffart
b3d1a7196c Compile fix 2020-05-26 12:15:31 +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
4ea78134d8 Recactor the compiler so there are passes 2020-05-26 09:40:36 +02:00
Simon Hausmann
a55cad05b9 Allow running specific syntax tests
By specifying the relative path as a command line argument, it's easier to
debug a specific case in the IDE.
2020-05-25 16:42:09 +02:00
Olivier Goffart
ce657a5b01 Add test for failled lookup 2020-05-25 15:50:34 +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
b9cd725f78 Allow to use proc_macro tokens
And report errors
2020-05-11 22:24:28 +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
cd670d6012 Compiler tests 2020-05-05 12:43:42 +02:00