Compare commits

...

1 Commits

Author SHA1 Message Date
Ulf Norell
4cd1554a2d Make 'return' a reserved (but invalid) keyword 2019-09-14 15:36:46 +02:00
2 changed files with 3 additions and 1 deletions

View File

@ -355,6 +355,7 @@ unexpected_token_error(Ts, Expect, T) ->
{con, _, X} when ExpectId -> io_lib:format(" Did you mean ~s?", [mk_lower(X)]);
{qcon, _, Xs} when ExpectCon -> io_lib:format(" Did you mean ~s?", [lists:last(Xs)]);
{qid, _, Xs} when ExpectId -> io_lib:format(" Did you mean ~s?", [lists:last(Xs)]);
{return, _} -> " [Polite reminder that Sophia is not JavaScript]";
_ -> ""
end,
mk_error(Ts, io_lib:format("Unexpected ~s.~s", [describe(T), Fix])).

View File

@ -37,7 +37,8 @@ lexer() ->
, {"[^/*]+|[/*]", skip()} ],
Keywords = ["contract", "include", "let", "switch", "type", "record", "datatype", "if", "elif", "else", "function",
"stateful", "payable", "true", "false", "mod", "public", "entrypoint", "private", "indexed", "namespace"],
"stateful", "payable", "true", "false", "mod", "public", "entrypoint", "private", "indexed", "namespace",
"return"],
KW = string:join(Keywords, "|"),
Rules =