Skip to content

Commit

Permalink
Merge pull request #4924 from rmosolgo/reject-numbers-followed-by-names
Browse files Browse the repository at this point in the history
Add an option to reject numbers followed by names
  • Loading branch information
rmosolgo committed Apr 22, 2024
2 parents 1a155ce + c920b43 commit dc62848
Show file tree
Hide file tree
Showing 11 changed files with 270 additions and 112 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ jobs:
ruby: 3.3
- gemfile: gemfiles/rails_master.gemfile
ruby: 3.3
graphql_reject_numbers_followed_by_names: 1
runs-on: ubuntu-latest
steps:
- run: echo BUNDLE_GEMFILE=${{ matrix.gemfile }} > $GITHUB_ENV
- run: echo GRAPHQL_REJECT_NUMBERS_FOLLOWED_BY_NAMES=1 > $GITHUB_ENV
if: ${{ !!matrix.graphql_reject_numbers_followed_by_names }}
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "graphql_c_parser_ext.h"

VALUE GraphQL_CParser_Lexer_tokenize_with_c_internal(VALUE self, VALUE query_string, VALUE fstring_identifiers) {
return tokenize(query_string, RTEST(fstring_identifiers));
VALUE GraphQL_CParser_Lexer_tokenize_with_c_internal(VALUE self, VALUE query_string, VALUE fstring_identifiers, VALUE reject_numbers_followed_by_names) {
return tokenize(query_string, RTEST(fstring_identifiers), RTEST(reject_numbers_followed_by_names));
}

VALUE GraphQL_CParser_Parser_c_parse(VALUE self) {
Expand All @@ -13,7 +13,7 @@ void Init_graphql_c_parser_ext() {
VALUE GraphQL = rb_define_module("GraphQL");
VALUE CParser = rb_define_module_under(GraphQL, "CParser");
VALUE Lexer = rb_define_module_under(CParser, "Lexer");
rb_define_singleton_method(Lexer, "tokenize_with_c_internal", GraphQL_CParser_Lexer_tokenize_with_c_internal, 2);
rb_define_singleton_method(Lexer, "tokenize_with_c_internal", GraphQL_CParser_Lexer_tokenize_with_c_internal, 3);
setup_static_token_variables();

VALUE Parser = rb_define_class_under(CParser, "Parser", rb_cObject);
Expand Down

0 comments on commit dc62848

Please sign in to comment.