lexer_kit 0.6.1-aarch64-linux → 0.7.0-aarch64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -3
  3. data/lib/lexer_kit/builder/compiler.rb +50 -15
  4. data/lib/lexer_kit/builder/conflict_detector.rb +18 -20
  5. data/lib/lexer_kit/builder/validator.rb +45 -0
  6. data/lib/lexer_kit/builder.rb +34 -7
  7. data/lib/lexer_kit/cli/commands.rb +17 -7
  8. data/lib/lexer_kit/core/source.rb +3 -2
  9. data/lib/lexer_kit/debug/disassembler.rb +0 -2
  10. data/lib/lexer_kit/dfa/dfa_builder.rb +1 -1
  11. data/lib/lexer_kit/dfa/dfa_minimizer.rb +2 -2
  12. data/lib/lexer_kit/dfa/regex_ast.rb +4 -0
  13. data/lib/lexer_kit/dfa/regex_parser.rb +41 -8
  14. data/lib/lexer_kit/errors.rb +2 -2
  15. data/lib/lexer_kit/format/lkb1.rb +3 -3
  16. data/lib/lexer_kit/format/lkt1.rb +3 -1
  17. data/lib/lexer_kit/format.rb +4 -4
  18. data/lib/lexer_kit/ir/compiled_program.rb +39 -26
  19. data/lib/lexer_kit/ir/constant_pool.rb +33 -11
  20. data/lib/lexer_kit/ir/dfa_table.rb +9 -19
  21. data/lib/lexer_kit/ir/instruction.rb +3 -0
  22. data/lib/lexer_kit/ir/jump_table.rb +3 -13
  23. data/lib/lexer_kit/ir/keyword_table.rb +0 -9
  24. data/lib/lexer_kit/ir/limits.rb +48 -0
  25. data/lib/lexer_kit/ir/serializer.rb +69 -30
  26. data/lib/lexer_kit/ir.rb +1 -0
  27. data/lib/lexer_kit/version.rb +1 -1
  28. data/lib/lexer_kit.rb +15 -2
  29. data/lib/lexer_kit_rust/3.3/lexer_kit_rust.so +0 -0
  30. data/lib/lexer_kit_rust/3.4/lexer_kit_rust.so +0 -0
  31. data/lib/lexer_kit_rust/4.0/lexer_kit_rust.so +0 -0
  32. data/vendor/nupur/LICENSE +176 -0
  33. data/vendor/nupur/NOTICE +64 -0
  34. data/vendor/nupur/README.ja.md +150 -0
  35. data/vendor/nupur/README.md +257 -0
  36. data/vendor/nupur.sha256 +68 -0
  37. metadata +9 -2
@@ -1,12 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "json"
4
+
3
5
  module LexerKit
4
6
  module IR
5
7
  # Serializer handles binary encoding/decoding of CompiledProgram.
6
8
  # Extracted from CompiledProgram to separate serialization concerns.
7
9
  class Serializer
8
10
  MAGIC = "LKT1"
9
- FORMAT_VERSION = 3 # v3: added token_meta
11
+ # v3: added token_meta
12
+ # v4: constant lengths are u32 (v3 wrote u16 and truncated longer constants)
13
+ FORMAT_VERSION = 4
14
+ # Versions decode reads. Version 3 is read so that artifacts made by lexer_kit 0.6
15
+ # and earlier keep working; encode writes FORMAT_VERSION only.
16
+ READABLE_FORMAT_VERSIONS = [3, 4].freeze
10
17
 
11
18
  # Encode a CompiledProgram to binary format.
12
19
  # @param program [CompiledProgram]
@@ -18,8 +25,14 @@ module LexerKit
18
25
  # Decode binary data to a CompiledProgram.
19
26
  # @param bytes [String] binary data
20
27
  # @return [CompiledProgram]
28
+ # @raise [InvalidBinaryError] if the binary is malformed
21
29
  def self.from_binary(bytes)
22
30
  new.decode(bytes)
31
+ rescue InvalidBinaryError
32
+ raise
33
+ rescue ArgumentError, TypeError, NoMethodError, RangeError, IndexError, EncodingError, JSON::ParserError => e
34
+ # The table decoders read untrusted bytes: whatever a malformed binary breaks becomes one error
35
+ raise InvalidBinaryError, "invalid program binary: #{e.message}"
23
36
  end
24
37
 
25
38
  # Encode CompiledProgram to binary.
@@ -35,44 +48,45 @@ module LexerKit
35
48
  parts << [FORMAT_VERSION].pack("S>")
36
49
 
37
50
  # User version (u32)
38
- parts << [program.version].pack("L>")
51
+ parts << [Limits.check!(program.version, Limits::U32_MAX, "user version")].pack("L>")
39
52
 
40
53
  # Token names
41
- encode_string_array(parts, program.token_names)
54
+ encode_string_array(parts, program.token_names, "token name")
42
55
 
43
56
  # Mode names
44
- encode_string_array(parts, program.mode_names)
57
+ encode_string_array(parts, program.mode_names, "mode name")
45
58
 
46
- # Modes (name → offset mapping)
59
+ # Modes (name → offset), in mode ID order: PUSH_MODE operands index this list
47
60
  modes = program.mode_offsets
48
- parts << [modes.size].pack("S>")
61
+ check_mode_order!(program.mode_names, modes.keys)
62
+ parts << [Limits.check!(modes.size, Limits::U16_MAX, "number of modes")].pack("S>")
49
63
  modes.each do |name, offset|
50
- name_bytes = name.to_s.b
64
+ name_bytes = Limits.u16_string!(name, "a mode name")
51
65
  parts << [name_bytes.bytesize].pack("S>")
52
66
  parts << name_bytes
53
- parts << [offset].pack("L>")
67
+ parts << [Limits.check!(offset, Limits::U32_MAX, "offset of mode #{name}")].pack("L>")
54
68
  end
55
69
 
56
70
  # Constant pool
57
71
  pool_binary = program.constant_pool.to_binary
58
- parts << [pool_binary.bytesize].pack("L>")
72
+ parts << [Limits.check!(pool_binary.bytesize, Limits::U32_MAX, "size of the constant pool")].pack("L>")
59
73
  parts << pool_binary
60
74
 
61
75
  # DFA tables
62
- encode_table_array(parts, program.dfa_tables)
76
+ encode_table_array(parts, program.dfa_tables, "DFA table")
63
77
 
64
78
  # Jump tables
65
- encode_table_array(parts, program.jump_tables)
79
+ encode_table_array(parts, program.jump_tables, "jump table")
66
80
 
67
81
  # Keyword tables
68
- encode_table_array(parts, program.keyword_tables)
82
+ encode_table_array(parts, program.keyword_tables, "keyword table")
69
83
 
70
84
  # Token metadata
71
85
  encode_token_meta(parts, program.token_meta)
72
86
 
73
87
  # Instructions
74
88
  instructions = program.instructions
75
- parts << [instructions.size].pack("L>")
89
+ parts << [Limits.check!(instructions.size, Limits::U32_MAX, "number of instructions")].pack("L>")
76
90
  instructions.each do |instr|
77
91
  parts << instr.to_binary
78
92
  end
@@ -93,7 +107,9 @@ module LexerKit
93
107
 
94
108
  # Format version
95
109
  format_version = read_uint16
96
- raise ArgumentError, "unsupported format version: #{format_version}" unless format_version == FORMAT_VERSION
110
+ unless READABLE_FORMAT_VERSIONS.include?(format_version)
111
+ raise ArgumentError, "unsupported format version: #{format_version}"
112
+ end
97
113
 
98
114
  # User version
99
115
  version = read_uint32
@@ -108,14 +124,18 @@ module LexerKit
108
124
  mode_count = read_uint16
109
125
  modes = {}
110
126
  mode_count.times do
111
- name = read_length_prefixed_string.to_sym
127
+ name = read_symbol
112
128
  offset = read_uint32
113
129
  modes[name] = offset
114
130
  end
115
131
 
132
+ check_mode_order!(mode_names, modes.keys)
133
+
116
134
  # Constant pool
117
135
  pool_len = read_uint32
118
- constant_pool, = ConstantPool.from_binary(read_bytes(pool_len))
136
+ pool_bytes = read_bytes(pool_len)
137
+ constant_pool, consumed = ConstantPool.from_binary(pool_bytes, format_version: format_version)
138
+ raise ArgumentError, "trailing bytes after the constant pool" unless consumed == pool_bytes.bytesize
119
139
 
120
140
  # DFA tables
121
141
  dfa_tables = decode_table_array(DFATable)
@@ -127,7 +147,7 @@ module LexerKit
127
147
  keyword_tables = decode_table_array(KeywordTable)
128
148
 
129
149
  # Token metadata
130
- token_meta = format_version >= 3 ? decode_token_meta : {}
150
+ token_meta = decode_token_meta
131
151
 
132
152
  # Instructions
133
153
  instr_count = read_uint32
@@ -135,6 +155,7 @@ module LexerKit
135
155
  instr_count.times do
136
156
  instructions << Instruction.from_binary(read_bytes(4))
137
157
  end
158
+ raise ArgumentError, "trailing bytes after the program" unless @pos == @bytes.bytesize
138
159
 
139
160
  CompiledProgram.new(
140
161
  instructions: instructions,
@@ -152,32 +173,51 @@ module LexerKit
152
173
 
153
174
  private
154
175
 
176
+ # The mode list (name → offset) must be in mode ID order, the order of mode_names:
177
+ # PUSH_MODE operands are mode IDs, and the VM finds a mode's offset by its position in
178
+ # the mode list. A program whose two lists disagree would enter the wrong mode, so it is
179
+ # rejected rather than reordered.
180
+ def check_mode_order!(mode_names, mode_list_names)
181
+ return if mode_names.map(&:to_sym) == mode_list_names.map(&:to_sym)
182
+
183
+ raise ArgumentError,
184
+ "mode list #{mode_list_names.inspect} is not in mode ID order #{mode_names.inspect}"
185
+ end
186
+
155
187
  # Encode an array of symbol names as length-prefixed strings.
156
- def encode_string_array(parts, names)
157
- parts << [names.size].pack("S>")
188
+ def encode_string_array(parts, names, what)
189
+ parts << [Limits.check!(names.size, Limits::U16_MAX, "number of #{what}s")].pack("S>")
158
190
  names.each do |name|
159
- name_bytes = name.to_s.b
191
+ name_bytes = Limits.u16_string!(name, "a #{what}")
160
192
  parts << [name_bytes.bytesize].pack("S>")
161
193
  parts << name_bytes
162
194
  end
163
195
  end
164
196
 
165
197
  # Encode an array of tables (DFA, Jump, Keyword).
166
- def encode_table_array(parts, tables)
167
- parts << [tables.size].pack("S>")
198
+ def encode_table_array(parts, tables, what)
199
+ parts << [Limits.check!(tables.size, Limits::U16_MAX, "number of #{what}s")].pack("S>")
168
200
  tables.each do |table|
169
201
  table_binary = table.to_binary
170
- parts << [table_binary.bytesize].pack("L>")
202
+ parts << [Limits.check!(table_binary.bytesize, Limits::U32_MAX, "size of a #{what}")].pack("L>")
171
203
  parts << table_binary
172
204
  end
173
205
  end
174
206
 
207
+ # Decode a name, written as its UTF-8 bytes.
208
+ def read_symbol
209
+ name = read_length_prefixed_string.force_encoding(Encoding::UTF_8)
210
+ raise ArgumentError, "name is not valid UTF-8: #{name.b.inspect}" unless name.valid_encoding?
211
+
212
+ name.to_sym
213
+ end
214
+
175
215
  # Decode an array of symbols.
176
216
  def decode_symbol_array
177
217
  count = read_uint16
178
218
  symbols = []
179
219
  count.times do
180
- symbols << read_length_prefixed_string.to_sym
220
+ symbols << read_symbol
181
221
  end
182
222
  symbols
183
223
  end
@@ -197,6 +237,8 @@ module LexerKit
197
237
  # Read raw bytes.
198
238
  def read_bytes(len)
199
239
  data = @bytes.byteslice(@pos, len)
240
+ raise ArgumentError, "program binary is truncated at byte #{@pos}" if data.nil? || data.bytesize != len
241
+
200
242
  @pos += len
201
243
  data
202
244
  end
@@ -220,19 +262,16 @@ module LexerKit
220
262
  # Encode token metadata hash.
221
263
  # Format: [count: u16] [token_id: u16, json_len: u16, json: bytes]×n
222
264
  def encode_token_meta(parts, token_meta)
223
- require "json"
224
- parts << [token_meta.size].pack("S>")
265
+ parts << [Limits.check!(token_meta.size, Limits::U16_MAX, "number of token metadata entries")].pack("S>")
225
266
  token_meta.each do |token_id, meta|
226
- json = JSON.generate(meta)
227
- json_bytes = json.b
228
- parts << [token_id, json_bytes.bytesize].pack("S>S>")
267
+ json_bytes = Limits.u16_string!(JSON.generate(meta), "token metadata")
268
+ parts << [Limits.check!(token_id, Limits::U16_MAX, "token ID of token metadata"), json_bytes.bytesize].pack("S>S>")
229
269
  parts << json_bytes
230
270
  end
231
271
  end
232
272
 
233
273
  # Decode token metadata hash.
234
274
  def decode_token_meta
235
- require "json"
236
275
  count = read_uint16
237
276
  token_meta = {}
238
277
  count.times do
data/lib/lexer_kit/ir.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "ir/limits"
3
4
  require_relative "ir/opcode"
4
5
  require_relative "ir/instruction"
5
6
  require_relative "ir/dfa_table"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LexerKit
4
- VERSION = "0.6.1"
4
+ VERSION = "0.7.0"
5
5
  end
data/lib/lexer_kit.rb CHANGED
@@ -12,20 +12,25 @@ require_relative "lexer_kit/format"
12
12
  require_relative "lexer_kit/trie"
13
13
 
14
14
  # Try to load Rust extension
15
+ lexer_kit_load_errors = []
15
16
  begin
16
17
  begin
17
18
  # Precompiled gems ship one binary per Ruby minor version
18
19
  require "lexer_kit_rust/#{RUBY_VERSION[/\d+\.\d+/]}/lexer_kit_rust"
19
- rescue LoadError
20
+ rescue LoadError => e
21
+ lexer_kit_load_errors << e.message
20
22
  require "lexer_kit_rust/lexer_kit_rust"
21
23
  end
22
24
  LEXER_KIT_NATIVE = true
23
25
 
24
26
  # Runner wraps LexStream (defined in Rust) with high-level methods
25
27
  require_relative "lexer_kit/runner"
26
- rescue LoadError
28
+ rescue LoadError => e
29
+ lexer_kit_load_errors << e.message
27
30
  LEXER_KIT_NATIVE = false
28
31
  end
32
+ # Why the extension did not load, for NativeExtensionError
33
+ LEXER_KIT_NATIVE_LOAD_ERROR = (lexer_kit_load_errors.join("; ") unless LEXER_KIT_NATIVE)
29
34
 
30
35
  module LexerKit
31
36
  # Reserved token IDs
@@ -99,6 +104,14 @@ module LexerKit
99
104
  LEXER_KIT_NATIVE
100
105
  end
101
106
 
107
+ # @raise [NativeExtensionError] with the reason the extension did not load
108
+ # @api private
109
+ def self.require_native!
110
+ return if LEXER_KIT_NATIVE
111
+
112
+ raise NativeExtensionError, "Rust extension not loaded: #{LEXER_KIT_NATIVE_LOAD_ERROR}"
113
+ end
114
+
102
115
  # Build a lexer from DSL
103
116
  # @yield [Builder] DSL block
104
117
  # @return [Builder] configured builder
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing the Work or
166
+ Derivative Works thereof, You may choose to offer, and charge a
167
+ fee for, acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,64 @@
1
+ Makiri
2
+ Copyright 2026 Makiri contributors
3
+
4
+ This product includes software developed by:
5
+
6
+ * Lexbor (vendored as a git submodule under vendor/lexbor)
7
+ Copyright (C) Alexander Borisov
8
+ Licensed under the Apache License, Version 2.0
9
+ https://lexbor.com / https://github.com/lexbor/lexbor
10
+
11
+ The HTML tokenizer and tree builder under ext/makiri/rust/src/html/ and the
12
+ CSS syntax, selector and stylesheet parser under
13
+ ext/makiri/rust/src/selectors/ are Rust ports of Lexbor's, as are the HTML
14
+ CSS matcher under ext/makiri/rust/src/css_match/ and the tag and
15
+ attribute tables generated from Lexbor's. The extension links no Lexbor
16
+ code; Lexbor's LICENSE and NOTICE are kept under vendor/lexbor/ in the gem.
17
+
18
+ * encoding_rs (linked into the native extension)
19
+ Copyright Mozilla Foundation
20
+ Licensed under the Apache License, Version 2.0 (at the licensee's option,
21
+ also the MIT license)
22
+ https://github.com/hsivonen/encoding_rs
23
+
24
+ encoding_rs includes data derived from the data files supplied with the
25
+ WHATWG Encoding Standard, under this license:
26
+
27
+ Copyright © WHATWG (Apple, Google, Mozilla, Microsoft).
28
+
29
+ Redistribution and use in source and binary forms, with or without
30
+ modification, are permitted provided that the following conditions are
31
+ met:
32
+
33
+ 1. Redistributions of source code must retain the above copyright
34
+ notice, this list of conditions and the following disclaimer.
35
+
36
+ 2. Redistributions in binary form must reproduce the above copyright
37
+ notice, this list of conditions and the following disclaimer in the
38
+ documentation and/or other materials provided with the distribution.
39
+
40
+ 3. Neither the name of the copyright holder nor the names of its
41
+ contributors may be used to endorse or promote products derived from
42
+ this software without specific prior written permission.
43
+
44
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
45
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
46
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
47
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
48
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
49
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
50
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
51
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
52
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
53
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
54
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55
+
56
+ * chardetng (linked into the native extension)
57
+ Copyright Mozilla Foundation
58
+ Licensed under the Apache License, Version 2.0 (at the licensee's option,
59
+ also the MIT license)
60
+ https://github.com/hsivonen/chardetng
61
+
62
+ The XPath 1.0 engine under ext/makiri/rust/src/xpath/ is an original
63
+ implementation written for this project. No code is derived from libxml2 or
64
+ libxslt.