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
Simon Hausmann
1baab9823a
Another small typo fix :)
2020-06-10 12:05:44 +02:00
Olivier Goffart
0e67a0ecbc
Block comments
2020-06-08 10:40:02 +02:00
Olivier Goffart
dc276290e9
Add support for self assignment (+=, -=, ...)
2020-05-28 17:02:06 +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
250b0a2e5b
Rust macro: get the right span for the diagnostics
...
Merge the features proc_macro_span and proc_macro_diagnostics, they are the same.
2020-05-27 18:37:45 +02:00
Olivier Goffart
9e4c355fa1
Lookup of quallified id
2020-05-25 17:24:31 +02:00
Olivier Goffart
11e5ce5887
Rename the CondeStatement syntax node to BindingExpression
...
This is the right-hand-side of a binding, and it is a pure expression.
Statements will be reserved for signals
2020-05-25 14:58:26 +02:00
Olivier Goffart
1de4eb476b
Lookup of identifier is now done while resolving expressions
2020-05-25 14:37:09 +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
Simon Hausmann
5accea4cdd
Add support for qualified type names to the parser
2020-05-25 11:53:44 +02:00
Olivier Goffart
dd756ef112
Adapt the parser to parse := instead of =
2020-05-25 10:46:00 +02:00
Olivier Goffart
270c626c6c
Make the Parser a trait
...
Because the rowan::GreenNode is read-only but i want to use the parser
to generate something that can be mutated
2020-05-22 15:31:27 +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
300cd9653a
Move the expression parse funciton in their own module
2020-05-20 12:30:30 +02:00
Olivier Goffart
a4569ddca3
BangExpression allow for finding relative paths
2020-05-19 15:36:56 +02:00
Olivier Goffart
8bcd4b1115
CI: build with all features
2020-05-12 08:23:51 +02:00
Olivier Goffart
dbada7977e
Fix C++ build
2020-05-12 08:03:18 +02:00
Olivier Goffart
b9cd725f78
Allow to use proc_macro tokens
...
And report errors
2020-05-11 22:24:28 +02:00
Olivier Goffart
6cf327166e
Parser: add support for parentheses in expressions
2020-05-11 11:19:57 +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
a9690a2fa3
Add a bunch of comments
2020-05-07 14:39:54 +02:00