Make 'return' a reserved (but invalid) keyword
This commit is contained in:
parent
662e5e70ef
commit
4cd1554a2d
@ -355,6 +355,7 @@ unexpected_token_error(Ts, Expect, T) ->
|
|||||||
{con, _, X} when ExpectId -> io_lib:format(" Did you mean ~s?", [mk_lower(X)]);
|
{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)]);
|
{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)]);
|
{qid, _, Xs} when ExpectId -> io_lib:format(" Did you mean ~s?", [lists:last(Xs)]);
|
||||||
|
{return, _} -> " [Polite reminder that Sophia is not JavaScript]";
|
||||||
_ -> ""
|
_ -> ""
|
||||||
end,
|
end,
|
||||||
mk_error(Ts, io_lib:format("Unexpected ~s.~s", [describe(T), Fix])).
|
mk_error(Ts, io_lib:format("Unexpected ~s.~s", [describe(T), Fix])).
|
||||||
|
@ -37,7 +37,8 @@ lexer() ->
|
|||||||
, {"[^/*]+|[/*]", skip()} ],
|
, {"[^/*]+|[/*]", skip()} ],
|
||||||
|
|
||||||
Keywords = ["contract", "include", "let", "switch", "type", "record", "datatype", "if", "elif", "else", "function",
|
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, "|"),
|
KW = string:join(Keywords, "|"),
|
||||||
|
|
||||||
Rules =
|
Rules =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user