Class: UnicodeChar
- Inherits:
-
Object
- Object
- UnicodeChar
- Defined in:
- ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb
Instance Attribute Summary collapse
-
#bidi_class ⇒ Object
Returns the value of attribute bidi_class.
-
#bidi_mirrored ⇒ Object
Returns the value of attribute bidi_mirrored.
-
#c_case_folding ⇒ Object
Returns the value of attribute c_case_folding.
-
#c_decomp_mapping ⇒ Object
Returns the value of attribute c_decomp_mapping.
-
#c_entry_index ⇒ Object
Returns the value of attribute c_entry_index.
-
#category ⇒ Object
Returns the value of attribute category.
-
#code ⇒ Object
Returns the value of attribute code.
-
#combining_class ⇒ Object
Returns the value of attribute combining_class.
-
#decomp_mapping ⇒ Object
Returns the value of attribute decomp_mapping.
-
#decomp_type ⇒ Object
Returns the value of attribute decomp_type.
-
#lowercase_mapping ⇒ Object
Returns the value of attribute lowercase_mapping.
-
#name ⇒ Object
Returns the value of attribute name.
-
#titlecase_mapping ⇒ Object
Returns the value of attribute titlecase_mapping.
-
#uppercase_mapping ⇒ Object
Returns the value of attribute uppercase_mapping.
Instance Method Summary collapse
- #c_entry(comb_indicies) ⇒ Object
- #case_folding ⇒ Object
-
#initialize(line) ⇒ UnicodeChar
constructor
A new instance of UnicodeChar.
Constructor Details
#initialize(line) ⇒ UnicodeChar
Returns a new instance of UnicodeChar.
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 164 def initialize(line) raise "Could not parse input." unless line =~ /^ ([0-9A-F]+); # code ([^;]+); # name ([A-Z]+); # general category ([0-9]+); # canonical combining class ([A-Z]+); # bidi class (<([A-Z]*)>)? # decomposition type ((\ ?[0-9A-F]+)*); # decompomposition mapping ([0-9]*); # decimal digit ([0-9]*); # digit ([^;]*); # numeric ([YN]*); # bidi mirrored ([^;]*); # unicode 1.0 name ([^;]*); # iso comment ([0-9A-F]*); # simple uppercase mapping ([0-9A-F]*); # simple lowercase mapping ([0-9A-F]*)$/ix # simple titlecase mapping @code = $1.hex @name = $2 @category = $3 @combining_class = Integer($4) @bidi_class = $5 @decomp_type = $7 @decomp_mapping = ($8=='') ? nil : $8.split.collect { |element| element.hex } @bidi_mirrored = ($13=='Y') ? true : false @uppercase_mapping = ($16=='') ? nil : $16.hex @lowercase_mapping = ($17=='') ? nil : $17.hex @titlecase_mapping = ($18=='') ? nil : $18.hex end |
Instance Attribute Details
#bidi_class ⇒ Object
Returns the value of attribute bidi_class.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def bidi_class @bidi_class end |
#bidi_mirrored ⇒ Object
Returns the value of attribute bidi_mirrored.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def bidi_mirrored @bidi_mirrored end |
#c_case_folding ⇒ Object
Returns the value of attribute c_case_folding.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def c_case_folding @c_case_folding end |
#c_decomp_mapping ⇒ Object
Returns the value of attribute c_decomp_mapping.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def c_decomp_mapping @c_decomp_mapping end |
#c_entry_index ⇒ Object
Returns the value of attribute c_entry_index.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def c_entry_index @c_entry_index end |
#category ⇒ Object
Returns the value of attribute category.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def category @category end |
#code ⇒ Object
Returns the value of attribute code.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def code @code end |
#combining_class ⇒ Object
Returns the value of attribute combining_class.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def combining_class @combining_class end |
#decomp_mapping ⇒ Object
Returns the value of attribute decomp_mapping.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def decomp_mapping @decomp_mapping end |
#decomp_type ⇒ Object
Returns the value of attribute decomp_type.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def decomp_type @decomp_type end |
#lowercase_mapping ⇒ Object
Returns the value of attribute lowercase_mapping.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def lowercase_mapping @lowercase_mapping end |
#name ⇒ Object
Returns the value of attribute name.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def name @name end |
#titlecase_mapping ⇒ Object
Returns the value of attribute titlecase_mapping.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def titlecase_mapping @titlecase_mapping end |
#uppercase_mapping ⇒ Object
Returns the value of attribute uppercase_mapping.
158 159 160 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 158 def uppercase_mapping @uppercase_mapping end |
Instance Method Details
#c_entry(comb_indicies) ⇒ Object
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 198 def c_entry(comb_indicies) " " << "{#{str2c category, 'CATEGORY'}, #{combining_class}, " << "#{str2c bidi_class, 'BIDI_CLASS'}, " << "#{str2c decomp_type, 'DECOMP_TYPE'}, " << "#{c_decomp_mapping}, " << "#{c_case_folding}, " << "#{singlecpmap uppercase_mapping }, " << "#{singlecpmap lowercase_mapping }, " << "#{singlecpmap titlecase_mapping }, " << "#{comb_indicies[code] ? comb_indicies[code]: 'UINT16_MAX'}, " << "#{bidi_mirrored}, " << "#{$exclusions.include?(code) or $excl_version.include?(code)}, " << "#{$ignorable.include?(code)}, " << "#{%W[Zl Zp Cc Cf].include?(category) and not [0x200C, 0x200D].include?(category)}, " << "#{$charwidth[code]}, 0, " << "#{$grapheme_boundclass[code]}},\n" end |
#case_folding ⇒ Object
195 196 197 |
# File 'ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb', line 195 def case_folding $case_folding[code] end |