Skip to content

Commit

Permalink
Multiline parsing in the beginning of the schema
Browse files Browse the repository at this point in the history
  • Loading branch information
vaclavbohac committed Jun 14, 2024
1 parent a87f8f7 commit ca6820d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/graphql/language/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def document
def definition
comment = nil
if token_name == :COMMENT
comment = value
comment = parse_comments
end

case token_name
Expand Down Expand Up @@ -275,7 +275,7 @@ def definition
else
loc = pos
desc = at?(:STRING) ? string_value : nil
comment = at?(:COMMENT) ? parse_comments(comment) : comment
comment = at?(:COMMENT) ? parse_comments : comment
defn_loc = pos
case token_name
when :SCHEMA
Expand Down Expand Up @@ -378,8 +378,8 @@ def parse_input_object_field_definitions
end
end

def parse_comments(initial_comment)
comments = initial_comment.nil? ? [] : [initial_comment]
def parse_comments
comments = []
while at?(:COMMENT)
comments << value
end
Expand Down

0 comments on commit ca6820d

Please sign in to comment.