File tree Expand file tree Collapse file tree
test/groovy/graphql/parser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,11 +119,18 @@ TripleQuotedStringValue
119119
120120
121121// Fragments never become a token of their own: they are only used inside other lexer rules
122- fragment TripleQuotedStringPart : ( EscapedTripleQuote | SourceCharacter )+?;
122+ fragment TripleQuotedStringPart : ( EscapedTripleQuote | ExtendedSourceCharacter )+?;
123123fragment EscapedTripleQuote : ' \\" " " ';
124- fragment SourceCharacter :[\u0009\u000A\u000D\u0020 -\u {10FFFF}];
125124
126- Comment: '#' ~[\n\r\u2028\u2029 ]* -> channel(2);
125+ // this is currently not covered by the spec because we allow all unicode chars
126+ fragment ExtendedSourceCharacter :[\u0009\u000A\u000D\u0020 -\u {10FFFF}];
127+ fragment ExtendedSourceCharacterWitoutLineFeed :[\u0009\u000D\u0020 -\u {10FFFF}];
128+
129+ // this is the spec definition
130+ // fragment SourceCharacter :[\u0009\u000A\u000D\u0020 -\uFFFF ];
131+
132+
133+ Comment: '#' ExtendedSourceCharacterWitoutLineFeed* -> channel(2);
127134
128135fragment EscapedChar : '\\ ' ([" \\/bfnrt] | Unicode) ;
129136fragment Unicode : ' u' Hex Hex Hex Hex ;
Original file line number Diff line number Diff line change @@ -751,4 +751,22 @@ triple3 : """edge cases \\""" "" " \\"" \\" edge cases"""
751751 e. location. line == 3
752752 e. location. column == 20
753753 }
754+
755+ def " allow emoji in comments" () {
756+ def input = '''
757+ # Represents the 😕 emoji.
758+ {
759+ foo
760+ }
761+ '''
762+ when :
763+ Document document = Parser . parse(input)
764+ OperationDefinition operationDefinition = (document. definitions[0 ] as OperationDefinition )
765+
766+
767+ then :
768+ operationDefinition. getComments()[0 ]. content == " Represents the 😕 emoji."
769+ }
770+
771+
754772}
You can’t perform that action at this time.
0 commit comments