Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add public keyword #320

Merged
merged 17 commits into from
Jul 30, 2023
13 changes: 12 additions & 1 deletion src/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,11 @@ end
#
# flisp: parse-eq
function parse_eq(ps::ParseState)
parse_assignment(ps, parse_comma)
if peek(ps) == K"export"
parse_comma(ps)
else
parse_assignment(ps, parse_comma)
end
LilithHafner marked this conversation as resolved.
Show resolved Hide resolved
end

# parse_eq_star is used where commas are special, for example in an argument list
Expand Down Expand Up @@ -1978,6 +1982,13 @@ function parse_resword(ps::ParseState)
# export \n a ==> (export a)
# export \$a, \$(a*b) ==> (export (\$ a) (\$ (parens (call-i a * b))))
bump(ps, TRIVIA_FLAG)

# export scoped=true a, b ==> (export (= scoped true) b)
while peek(ps, 1) == K"Identifier" &&
peek(ps, 2) == K"="
parse_assignment(ps, x->parse_atsym(x, false))
LilithHafner marked this conversation as resolved.
Show resolved Hide resolved
end

parse_comma_separated(ps, x->parse_atsym(x, false))
emit(ps, mark, K"export")
elseif word in KSet"import using"
Expand Down