Commit graph

35 commits

Author SHA1 Message Date
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