Module: GraphQL::Language::Lexer

Defined in:
lib/graphql/language/lexer.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

._graphql_lexer_char_classObject

Returns the value of attribute _graphql_lexer_char_class.


47
48
49
# File 'lib/graphql/language/lexer.rb', line 47

def _graphql_lexer_char_class
  @_graphql_lexer_char_class
end

._graphql_lexer_cond_actionsObject

Returns the value of attribute _graphql_lexer_cond_actions.


95
96
97
# File 'lib/graphql/language/lexer.rb', line 95

def _graphql_lexer_cond_actions
  @_graphql_lexer_cond_actions
end

._graphql_lexer_cond_targsObject

Returns the value of attribute _graphql_lexer_cond_targs.


87
88
89
# File 'lib/graphql/language/lexer.rb', line 87

def _graphql_lexer_cond_targs
  @_graphql_lexer_cond_targs
end

._graphql_lexer_eof_transObject

Returns the value of attribute _graphql_lexer_eof_trans.


119
120
121
# File 'lib/graphql/language/lexer.rb', line 119

def _graphql_lexer_eof_trans
  @_graphql_lexer_eof_trans
end

._graphql_lexer_from_state_actionsObject

Returns the value of attribute _graphql_lexer_from_state_actions.


111
112
113
# File 'lib/graphql/language/lexer.rb', line 111

def _graphql_lexer_from_state_actions
  @_graphql_lexer_from_state_actions
end

._graphql_lexer_index_defaultsObject

Returns the value of attribute _graphql_lexer_index_defaults.


71
72
73
# File 'lib/graphql/language/lexer.rb', line 71

def _graphql_lexer_index_defaults
  @_graphql_lexer_index_defaults
end

._graphql_lexer_index_offsetsObject

Returns the value of attribute _graphql_lexer_index_offsets.


55
56
57
# File 'lib/graphql/language/lexer.rb', line 55

def _graphql_lexer_index_offsets
  @_graphql_lexer_index_offsets
end

._graphql_lexer_indiciesObject

Returns the value of attribute _graphql_lexer_indicies.


63
64
65
# File 'lib/graphql/language/lexer.rb', line 63

def _graphql_lexer_indicies
  @_graphql_lexer_indicies
end

._graphql_lexer_nfa_offsetsObject

Returns the value of attribute _graphql_lexer_nfa_offsets.


135
136
137
# File 'lib/graphql/language/lexer.rb', line 135

def _graphql_lexer_nfa_offsets
  @_graphql_lexer_nfa_offsets
end

._graphql_lexer_nfa_pop_transObject

Returns the value of attribute _graphql_lexer_nfa_pop_trans.


151
152
153
# File 'lib/graphql/language/lexer.rb', line 151

def _graphql_lexer_nfa_pop_trans
  @_graphql_lexer_nfa_pop_trans
end

._graphql_lexer_nfa_push_actionsObject

Returns the value of attribute _graphql_lexer_nfa_push_actions.


143
144
145
# File 'lib/graphql/language/lexer.rb', line 143

def _graphql_lexer_nfa_push_actions
  @_graphql_lexer_nfa_push_actions
end

._graphql_lexer_nfa_targsObject

Returns the value of attribute _graphql_lexer_nfa_targs.


127
128
129
# File 'lib/graphql/language/lexer.rb', line 127

def _graphql_lexer_nfa_targs
  @_graphql_lexer_nfa_targs
end

._graphql_lexer_to_state_actionsObject

Returns the value of attribute _graphql_lexer_to_state_actions.


103
104
105
# File 'lib/graphql/language/lexer.rb', line 103

def _graphql_lexer_to_state_actions
  @_graphql_lexer_to_state_actions
end

._graphql_lexer_trans_cond_spacesObject

Returns the value of attribute _graphql_lexer_trans_cond_spaces.


79
80
81
# File 'lib/graphql/language/lexer.rb', line 79

def _graphql_lexer_trans_cond_spaces
  @_graphql_lexer_trans_cond_spaces
end

._graphql_lexer_trans_keysObject

Returns the value of attribute _graphql_lexer_trans_keys.


39
40
41
# File 'lib/graphql/language/lexer.rb', line 39

def _graphql_lexer_trans_keys
  @_graphql_lexer_trans_keys
end

.graphql_lexer_en_mainObject

Returns the value of attribute graphql_lexer_en_main.


179
180
181
# File 'lib/graphql/language/lexer.rb', line 179

def graphql_lexer_en_main
  @graphql_lexer_en_main
end

.graphql_lexer_en_strObject

Returns the value of attribute graphql_lexer_en_str.


174
175
176
# File 'lib/graphql/language/lexer.rb', line 174

def graphql_lexer_en_str
  @graphql_lexer_en_str
end

.graphql_lexer_errorObject

Returns the value of attribute graphql_lexer_error.


169
170
171
# File 'lib/graphql/language/lexer.rb', line 169

def graphql_lexer_error
  @graphql_lexer_error
end

.graphql_lexer_first_finalObject

Returns the value of attribute graphql_lexer_first_final.


164
165
166
# File 'lib/graphql/language/lexer.rb', line 164

def graphql_lexer_first_final
  @graphql_lexer_first_final
end

.graphql_lexer_startObject

Returns the value of attribute graphql_lexer_start.


159
160
161
# File 'lib/graphql/language/lexer.rb', line 159

def graphql_lexer_start
  @graphql_lexer_start
end

Class Method Details

.replace_escaped_characters_in_place(raw_string) ⇒ Object

Replace any escaped unicode or whitespace with the actual characters To avoid allocating more strings, this modifies the string passed into it


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/graphql/language/lexer.rb', line 12

def self.replace_escaped_characters_in_place(raw_string)
	raw_string.gsub!(ESCAPES, ESCAPES_REPLACE)
	raw_string.gsub!(UTF_8) do |_matched_str|
	codepoint_1 = ($1 || $2).to_i(16)
	codepoint_2 = $3
	
	if codepoint_2
		codepoint_2 = codepoint_2.to_i(16)
		if (codepoint_1 >= 0xD800 && codepoint_1 <= 0xDBFF) && # leading surrogate
			(codepoint_2 >= 0xDC00 && codepoint_2 <= 0xDFFF) # trailing surrogate
			# A surrogate pair
			combined = ((codepoint_1 - 0xD800) * 0x400) + (codepoint_2 - 0xDC00) + 0x10000
			[combined].pack('U'.freeze)
			else
			# Two separate code points
			[codepoint_1].pack('U'.freeze) + [codepoint_2].pack('U'.freeze)
		end
		else
		[codepoint_1].pack('U'.freeze)
	end
end
nil
end

.tokenize(query_string) ⇒ Object


6
7
8
# File 'lib/graphql/language/lexer.rb', line 6

def self.tokenize(query_string)
	run_lexer(query_string)
end