Top Level Namespace
Defined Under Namespace
Modules: TreeSitter
Classes: UnicodeChar
Constant Summary
collapse
- SITEARCH =
RbConfig::CONFIG['sitearch']
- LIBDIR =
RbConfig::CONFIG['libdir']
- INCLUDEDIR =
RbConfig::CONFIG['includedir']
- DLEXT =
RbConfig::CONFIG['DLEXT']
- ROOT =
File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
- THIS_DIR =
File.dirname(__FILE__)
- OUT_DIR =
File.join(THIS_DIR, 'out')
- TREE_SITTER_DIR =
File.expand_path(File.join(File.dirname(__FILE__), 'tree-sitter'))
- TREE_SITTER_INCLUDE_DIR =
File.join(TREE_SITTER_DIR, 'include')
- TREE_SITTER_SRC_DIR =
File.join(TREE_SITTER_DIR, 'src')
- BUNDLE_PATH =
File.join(ROOT, 'lib', 'tree-sitter', "treesitter.#{DLEXT}")
[INCLUDEDIR, TREE_SITTER_INCLUDE_DIR]
- LIB_DIRS =
[LIBDIR, OUT_DIR]
Instance Method Summary
collapse
Instance Method Details
#cpary2c(array) ⇒ Object
138
139
140
141
142
143
144
145
146
147
148
149
|
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 138
def cpary2c(array)
return "UINT16_MAX" if array.nil? || array.length == 0
lencode = array.length - 1 array = cpary2utf16encoded(array)
if lencode >= 7 array = [lencode] + array
lencode = 7
end
idx = pushary(array)
raise "Array index out of bound" if idx > 0x1FFF
return "#{idx | (lencode << 13)}"
end
|
#cpary2utf16encoded(array) ⇒ Object
127
128
129
130
131
132
133
134
135
136
137
|
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 127
def cpary2utf16encoded(array)
return array.flat_map { |cp|
if (cp <= 0xFFFF)
raise "utf-16 code: #{cp}" if cp & 0b1111100000000000 == 0b1101100000000000
cp
else
temp = cp - 0x10000
[(temp >> 10) | 0b1101100000000000, (temp & 0b0000001111111111) | 0b1101110000000000]
end
}
end
|
#pushary(array) ⇒ Object
118
119
120
121
122
123
124
125
126
|
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 118
def pushary(array)
idx = $int_array_indicies[array]
unless idx
$int_array_indicies[array] = $int_array.length
idx = $int_array.length
array.each { |entry| $int_array << entry }
end
return idx
end
|
#singlecpmap(cp) ⇒ Object
150
151
152
153
154
155
|
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 150
def singlecpmap(cp)
return "UINT16_MAX" if cp == nil
idx = pushary(cpary2utf16encoded([cp]))
raise "Array index out of bound" if idx > 0xFFFF
return "#{idx}"
end
|
#str2c(string, prefix) ⇒ Object
114
115
116
117
|
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 114
def str2c(string, prefix)
return "0" if string.nil?
return "UTF8PROC_#{prefix}_#{string.upcase}"
end
|