Skip to content
Snippets Groups Projects
Commit c462f6e6 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Improve error message for tuple type declaration

Tuples are only defined for simple types.
This means that defining tuples like

let t:(R*R);

is forbidden. This may change in future, but it does not seem a
limitations and probably leads to simpler syntax.

Now, when the used type is not simple, it is clearly indicated.
parent bf1f8424
No related branches found
No related tags found
1 merge request!37Feature/language
...@@ -77,7 +77,9 @@ struct basic_type : sor< scalar_type, string_type >{}; ...@@ -77,7 +77,9 @@ struct basic_type : sor< scalar_type, string_type >{};
struct type_name_id; struct type_name_id;
struct simple_type_specifier : sor< vector_type, basic_type, type_name_id >{}; struct simple_type_specifier : sor< vector_type, basic_type, type_name_id >{};
struct tuple_type_specifier : seq<open_parent, simple_type_specifier, ignored, close_parent>{}; struct tuple_type_specifier : sor<try_catch< open_parent, simple_type_specifier, ignored, close_parent >,
// non matching braces management
if_must< at< open_parent >, raise< simple_type_specifier >, until< eof > > >{};
struct TYPE_SPECIFIER : seq< sor<simple_type_specifier, tuple_type_specifier>, ignored >{}; struct TYPE_SPECIFIER : seq< sor<simple_type_specifier, tuple_type_specifier>, ignored >{};
...@@ -385,6 +387,9 @@ inline const std::string errors<language::slashstar>::error_message = "block com ...@@ -385,6 +387,9 @@ inline const std::string errors<language::slashstar>::error_message = "block com
template <> template <>
inline const std::string errors<language::open_brace>::error_message = "open brace was never closed, missing '}'"; inline const std::string errors<language::open_brace>::error_message = "open brace was never closed, missing '}'";
template <>
inline const std::string errors<language::simple_type_specifier>::error_message = "expecting simple type specifier";
// clang-format on // clang-format on
} // namespace language } // namespace language
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment