Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ function parse_toplevel(ps::ParseState)
# a \n \n ==> (toplevel a)
# Empty files
# ==> (toplevel)
bump_trivia(ps, skip_newlines=true)
bump_trivia(ps)
break
else
parse_stmts(ps)
Expand Down Expand Up @@ -1027,7 +1027,7 @@ end
#
# flisp: parse-unary-subtype
function parse_unary_subtype(ps::ParseState)
t = peek_token(ps, skip_newlines=true)
t = peek_token(ps)
if is_type_operator(t)
k2 = peek(ps, 2)
if is_closing_token(ps, k2) || k2 in KSet"NewlineWs ="
Expand Down Expand Up @@ -1060,7 +1060,7 @@ function parse_where_chain(ps0::ParseState, mark)
ps = ParseState(ps0, where_enabled=false)
while peek(ps) == K"where"
bump(ps, TRIVIA_FLAG) # where
bump_trivia(ps, skip_newlines=true)
bump_trivia(ps)
k = peek(ps)
if k == K"{"
# x where \n {T} ==> (where x (braces T))
Expand Down Expand Up @@ -3457,7 +3457,7 @@ function parse_atom(ps::ParseState, check_identifiers=true)
if preceding_whitespace(t)
# : foo ==> (quote-: (error-t) foo)
# :\nfoo ==> (quote-: (error-t) foo)
bump_trivia(ps, TRIVIA_FLAG, skip_newlines=true,
bump_trivia(ps, TRIVIA_FLAG,
error="whitespace not allowed after `:` used for quoting")
end
# Being inside quote makes keywords into identifiers at the
Expand Down
3 changes: 3 additions & 0 deletions test/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,9 @@ parsestmt_test_specs = [
"x in'c'" => "(call-i x in (char 'c'))"
"1where'c'" => "(where 1 (char 'c'))"
":+'y'" => "(juxtapose (call-post (quote-: +) ') (call-post y '))"
# unary subtype ops and newlines
"a +\n\n<:" => "(call-i a + <:)"
"for\n\n<:" => "(for (= <: (error (error-t))) (block (error)) (error-t))"
# Empty character consumes trailing ' delimiter (ideally this could be
# tested above but we don't require the input stream to be consumed in the
# unit tests there.
Expand Down