mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Better error handling for incomplete syntax
This commit is contained in:
parent
c155ba7b15
commit
c79d8dc396
4 changed files with 33 additions and 5 deletions
|
@ -30,8 +30,8 @@ def parse(tokens) -> T.Tuple[ast.UI, T.Optional[MultipleErrors]]:
|
|||
gtk_directive = Group(
|
||||
ast.GtkDirective,
|
||||
Statement(
|
||||
Keyword("using").err("File must start with a \"using gtk\" directive (e.g. `using Gtk 4.0;`)"),
|
||||
Keyword("Gtk").err("File must start with a \"using gtk\" directive (e.g. `using Gtk 4.0;`)"),
|
||||
Keyword("using").err("File must start with a \"using Gtk\" directive (e.g. `using Gtk 4.0;`)"),
|
||||
Keyword("Gtk").err("File must start with a \"using Gtk\" directive (e.g. `using Gtk 4.0;`)"),
|
||||
UseNumberText("version").expected("a version number for GTK"),
|
||||
)
|
||||
)
|
||||
|
@ -298,7 +298,7 @@ def parse(tokens) -> T.Tuple[ast.UI, T.Optional[MultipleErrors]]:
|
|||
ui = Group(
|
||||
ast.UI,
|
||||
Sequence(
|
||||
gtk_directive.err("File must start with a \"using Gtk\" directive (e.g. `using Gtk 4.0;`)"),
|
||||
gtk_directive,
|
||||
ZeroOrMore(import_statement),
|
||||
Until(AnyOf(
|
||||
template,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue