From 24271dc52f17bd5187c28d7dfa75b0106c646fdb Mon Sep 17 00:00:00 2001 From: Andrew Bennett Date: Wed, 14 Feb 2024 10:08:59 -0600 Subject: [PATCH] Remove ambiguous LineTerminator generation from `proper_argo_graphql_language` --- README.md | 2 +- apps/argo_test/src/proper_argo_graphql_language.erl | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 20689c5..301a4d7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # `argo` -[![Build Status](https://github.com/WhatsApp/erlang-argo/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/WhatsApp/argo/actions) [![Hex.pm](https://img.shields.io/hexpm/v/argo_graphql.svg)](https://hex.pm/packages/argo_graphql) +[![Build Status](https://github.com/WhatsApp/erlang-argo/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/WhatsApp/erlang-argo/actions) [![Hex.pm](https://img.shields.io/hexpm/v/argo_graphql.svg)](https://hex.pm/packages/argo_graphql) `argo` for GraphQL. diff --git a/apps/argo_test/src/proper_argo_graphql_language.erl b/apps/argo_test/src/proper_argo_graphql_language.erl index c491515..f8419ff 100644 --- a/apps/argo_test/src/proper_argo_graphql_language.erl +++ b/apps/argo_test/src/proper_argo_graphql_language.erl @@ -190,7 +190,17 @@ strip_whitespace_right([]) -> -spec block_string_character() -> proper_types:type(). block_string_character() -> - unicode_codepoint_upto(4). + % LineTerminator in the scanner can produce mismatched descriptions that visually look identical + % after scanning, parsing, and outputting the block string characters again. + % + % The problematic characters are + % + % 1. \x{000D} (\r) + % 2. \x{2028} (Unicode Line Separator) + % 3. \x{2029} (Unicode Paragraph Separator) + % + % To simplify things, the only LineTerminator we allow is \x{000A} (or \n). + ?SUCHTHAT(C, unicode_codepoint_upto(4), (C =/= 16#000D andalso C =/= 16#2028 andalso C =/= 16#2029)). -spec block_string_value() -> proper_types:type(). block_string_value() ->