Skip to content

Commit

Permalink
fix(Parser) handle empty string literals
Browse files Browse the repository at this point in the history
  • Loading branch information
rmosolgo committed Aug 15, 2015
1 parent b31e3e4 commit 19ed3fb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/graphql/language/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Parser < Parslet::Parser
rule(:value_input_object_pair) { space? >> name.as(:input_object_name) >> space? >> str(":") >> space? >> value.as(:input_object_value) >> separator? }
rule(:value_int) { (value_sign? >> match('\d').repeat(1)).as(:int) }
# TODO: support unicode, escaped chars (match the spec)
rule(:value_string) { str('"') >> match('[^\"]').repeat(1).as(:string) >> str('"')}
rule(:value_string) { str('"') >> match('[^\"]').repeat.as(:string) >> str('"')}
rule(:value_enum) { name.as(:enum) }
rule(:value_variable) { str("$") >> name.as(:variable) }

Expand Down
1 change: 1 addition & 0 deletions spec/graphql/language/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@

it 'gets strings' do
assert(parser.value.parse_with_debug('"my string"'))
assert(parser.value.parse_with_debug('""'))
end

it 'gets arrays' do
Expand Down

0 comments on commit 19ed3fb

Please sign in to comment.