feat(checker): examples() and spec_files() carry the specification's files
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
A consumer of the checker crate needs no path into this repository. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
This commit is contained in:
1 parent
fc4430c685
commit
73dd967b1a
1983 files changed
+10465
No files matched your search
@@ -0,0 +1,2 @@
|
||||
const EMPTY_UINT8=new Uint8Array();class RoaringBitmap{constructor(u8array,startingOffset){const start=startingOffset?startingOffset:0;let i=start;this.keysAndCardinalities=EMPTY_UINT8;this.containers=[];this.consumed_len_bytes=0;if(u8array===null||u8array.length===i||u8array[i]===0){return this;}else if(u8array[i]>0xf0){const lspecial=u8array[i]&0x0f;this.keysAndCardinalities=new Uint8Array(lspecial*4);let pspecial=i+1;let key=u8array[pspecial+2]|(u8array[pspecial+3]<<8);let value=u8array[pspecial]|(u8array[pspecial+1]<<8);let entry=(key<<16)|value;let container;container=new RoaringBitmapArray(1,new Uint8Array(4));container.array[0]=value&0xFF;container.array[1]=(value>>8)&0xFF;this.containers.push(container);this.keysAndCardinalities[0]=key;this.keysAndCardinalities[1]=key>>8;pspecial+=4;for(let ispecial=1;ispecial<lspecial;ispecial+=1){entry+=u8array[pspecial]|(u8array[pspecial+1]<<8);value=entry&0xffff;key=entry>>16;container=this.addToArrayAt(key);const cardinalityOld=container.cardinality;container.array[cardinalityOld*2]=value&0xFF;container.array[(cardinalityOld*2)+1]=(value>>8)&0xFF;container.cardinality=cardinalityOld+1;pspecial+=2;}this.consumed_len_bytes=pspecial-i;return this;}else if(u8array[i]>0xe0){const run_count_m1=(u8array[i]&0x0f);const run_count=run_count_m1+1;this.keysAndCardinalities=new Uint8Array(run_count*4);let pspecial=i+1;let pnspecial=pspecial+(run_count*4);let previous_key=null;let previous_container=null;for(let j=0;j<run_count;j+=1){const key=u8array[pspecial+2]|(u8array[pspecial+3]<<8);const value=u8array[pspecial]|(u8array[pspecial+1]<<8);const run_length_m1=j%2===0?(u8array[pnspecial]>>4):(u8array[pnspecial]&0x0f);if(j%2!==0){pnspecial+=1;}pspecial+=4;if(key===previous_key&&previous_container!==null){const new_container_array=new Uint8Array((previous_container.runcount+1)*4,);new_container_array.set(previous_container.array);new_container_array[previous_container.runcount*4]=value&0xFF;new_container_array[(previous_container.runcount*4)+1]=(value>>8)&0xFF;new_container_array[(previous_container.runcount*4)+2]=run_length_m1;previous_container.array=new_container_array;previous_container.runcount+=1;let cardinalitym1=this.keysAndCardinalities[(this.containers.length*4)-2]|(this.keysAndCardinalities[(this.containers.length*4)-1]<<8);cardinalitym1+=run_length_m1+1;this.keysAndCardinalities[(this.containers.length*4)-2]=cardinalitym1&0xFF;this.keysAndCardinalities[(this.containers.length*4)-1]=(cardinalitym1>>8)&0xFF;}else{previous_key=key;previous_container=new RoaringBitmapRun(1,Uint8Array.of(value&0xFF,(value>>8)&0xFF,run_length_m1,0,));this.containers.push(previous_container);this.keysAndCardinalities[(this.containers.length*4)-4]=key&0xFF;this.keysAndCardinalities[(this.containers.length*4)-3]=(key>>8)&0xFF;this.keysAndCardinalities[(this.containers.length*4)-2]=run_length_m1;}}if(run_count%2!==0){pnspecial+=1;}this.consumed_len_bytes=pnspecial-i;return this;}else if(u8array[i]>0xd0){const lspecial=u8array[i]&0x0f;this.keysAndCardinalities=new Uint8Array(lspecial*4);let pspecial=i+1;let key=u8array[pspecial+2]|(u8array[pspecial+3]<<8);let value=u8array[pspecial]|(u8array[pspecial+1]<<8);let entry=(key<<16)|value;let container;container=new RoaringBitmapArray(1,new Uint8Array(4));container.array[0]=value&0xFF;container.array[1]=(value>>8)&0xFF;this.containers.push(container);this.keysAndCardinalities[0]=key;this.keysAndCardinalities[1]=key>>8;pspecial+=4;for(let ispecial=1;ispecial<lspecial;ispecial+=1){entry+=u8array[pspecial];value=entry&0xffff;key=entry>>16;container=this.addToArrayAt(key);const cardinalityOld=container.cardinality;container.array[cardinalityOld*2]=value&0xFF;container.array[(cardinalityOld*2)+1]=(value>>8)&0xFF;container.cardinality=cardinalityOld+1;pspecial+=1;}this.consumed_len_bytes=pspecial-i;return this;}else if(u8array[i]>0x80){const lspecial=u8array[i]&0x3f;const lspecialm1=lspecial-1;this.keysAndCardinalities=new Uint8Array(4);i+=1;const key=u8array[i+2]|(u8array[i+3]<<8);const value=u8array[i]|(u8array[i+1]<<8);const container=new RoaringBitmapRun(1,new Uint8Array(4));container.array[0]=value&0xFF;container.array[1]=(value>>8)&0xFF;container.array[2]=lspecialm1&0xFF;container.array[3]=lspecialm1>>8;this.containers.push(container);this.keysAndCardinalities[0]=key&0xFF;this.keysAndCardinalities[1]=(key>>8)&0xFF;this.keysAndCardinalities[2]=lspecialm1&0xFF;this.keysAndCardinalities[3]=lspecialm1>>8;this.consumed_len_bytes=5;return this;}else if(u8array[i]<0x3a){const lspecial=u8array[i];this.keysAndCardinalities=new Uint8Array(lspecial*4);let pspecial=i+1;for(let ispecial=0;ispecial<lspecial;ispecial+=1){const key=u8array[pspecial+2]|(u8array[pspecial+3]<<8);const value=u8array[pspecial]|(u8array[pspecial+1]<<8);const container=this.addToArrayAt(key);const cardinalityOld=container.cardinality;container.array[cardinalityOld*2]=value&0xFF;container.array[(cardinalityOld*2)+1]=(value>>8)&0xFF;container.cardinality=cardinalityOld+1;pspecial+=4;}thiLine truncated
|
||||
${this.tree.branches.nodeids} ${this.tree.branches.getKeys()}`);}node=registry.searchTreeLoadByNodeID(newnode);this.tree.branches.subtrees[i]=node;const mhpI=this.tree.might_have_prefix_branches.getIndex(k);if(mhpI!==-1){this.tree.might_have_prefix_branches.subtrees[mhpI]=node;}}nodes.push([k,node.then(node=>{return node.trie(this.dataColumn,this.searchPattern);})]);i+=1;}return nodes;}else{const codePoint=data[this.offset];const trie=new PrefixTrie(this.tree,this.offset+1,this.dataColumn,this.searchPattern,);return[[codePoint,Promise.resolve(trie)]];}}keysExcludeSuffixOnly(){const data=this.tree.data;if(this.offset===data.length){return this.tree.might_have_prefix_branches.getKeys();}else{return Uint8Array.of(data[this.offset]);}}childrenExcludeSuffixOnly(){const data=this.tree.data;if(this.offset===data.length){const nodes=[];let i=0;for(const[k,v]of this.tree.might_have_prefix_branches.entries()){let node;if(v){node=v;}else{const newnode=this.tree.might_have_prefix_branches.getNodeID(i);if(!newnode){throw new Error(`malformed tree; no node for key ${k}`);}node=registry.searchTreeLoadByNodeID(newnode);this.tree.might_have_prefix_branches.subtrees[i]=node;this.tree.branches.subtrees[this.tree.branches.getIndex(k)]=node;}nodes.push([k,node.then(node=>{return node.trie(this.dataColumn,this.searchPattern);})]);i+=1;}return nodes;}else{const codePoint=data[this.offset];const trie=new PrefixTrie(this.tree,this.offset+1,this.dataColumn,this.searchPattern,);return[[codePoint,Promise.resolve(trie)]];}}child(byte){if(this.offset===this.tree.data.length){const i=this.tree.branches.getIndex(byte);if(i!==-1){let branch=this.tree.branches.subtrees[i];if(branch===null){const newnode=this.tree.branches.getNodeID(i);if(!newnode){throw new Error(`malformed tree; no node for key ${byte}`);}branch=registry.searchTreeLoadByNodeID(newnode);this.tree.branches.subtrees[i]=branch;const mhpI=this.tree.might_have_prefix_branches.getIndex(byte);if(mhpI!==-1){this.tree.might_have_prefix_branches.subtrees[mhpI]=branch;}}return branch.then(branch=>branch.trie(this.dataColumn,this.searchPattern));}}else if(this.tree.data[this.offset]===byte){return Promise.resolve(new PrefixTrie(this.tree,this.offset+1,this.dataColumn,this.searchPattern,));}return null;}}class SuffixSearchTree{constructor(branches,dataLen,leaves_suffix,){this.branches=branches;this.dataLen=dataLen;this.leaves_suffix=leaves_suffix;}trie(dataColumn,searchPattern){return new SuffixTrie(this,0,dataColumn,searchPattern);}async search(name,dataColumn){if(typeof name==="string"){const utf8encoder=new TextEncoder();name=utf8encoder.encode(name);}const searchPattern=new Uint8ArraySearchPattern(name);let trie=this.trie(dataColumn,searchPattern);for(const datum of name){const newTrie=trie.child(datum);if(newTrie){trie=await newTrie;}else{return null;}}return trie;}async*searchLev(_name,_dataColumn){}getCurrentLeaves(){return this.leaves_suffix;}}class SuffixTrie{constructor(tree,offset,dataColumn,searchPattern){this.tree=tree;this.offset=offset;this.dataColumn=dataColumn;this.searchPattern=searchPattern;}matches(){return EMPTY_BITMAP;}async*substringMatches(){let layer=[Promise.resolve(this.tree)];while(layer.length){const current_layer=layer;layer=[];for await(const tree of current_layer){let rejected=null;let leaves=tree.getCurrentLeaves();for(const leaf of leaves.entries()){const haystack=await this.dataColumn.at(leaf);if(haystack===undefined||!this.searchPattern.matches(haystack)){if(!rejected){rejected=[];}rejected.push(leaf);}}if(rejected){if(leaves.cardinality()!==rejected.length){for(const rej of rejected){leaves=leaves.remove(rej);}yield leaves;}}else{yield leaves;}}const subnodes=new HashTable();for await(const nodeEncoded of current_layer){const node=nodeEncoded instanceof InlineNeighborsTree?nodeEncoded.decode():nodeEncoded;const branches=node.branches;const l=branches.subtrees.length;for(let i=0;i<l;++i){const subtree=branches.subtrees[i];if(subtree){layer.push(subtree);}else if(subtree===null){const newnode=branches.getNodeID(i);if(!newnode){throw new Error(`malformed tree; no node for index ${i}`);}else{let subnode_list=subnodes.get(newnode);if(!subnode_list){subnode_list=[[i,node]];subnodes.set(newnode,subnode_list);}else{subnode_list.push([i,node]);}}}else{throw new Error(`malformed tree; index ${i} does not exist`);}}}for(const[newnode,subnode_list]of subnodes.entries()){const res=registry.searchTreeLoadByNodeID(newnode);for(const[i,node]of subnode_list){const branches=node.branches;branches.subtrees[i]=res;}layer.push(res);}}}async*prefixMatches(){}keysExcludeSuffixOnly(){return EMPTY_UINT8;}childrenExcludeSuffixOnly(){return[];}child(byte){if(this.offset===this.tree.dataLen){const i=this.tree.branches.getIndex(byte);if(i!==-1){let branch=this.tree.branches.subtrees[i];if(branch===null){const newnode=this.tree.branches.getNodeID(i);if(!newnode){throw new Error(`malformed tree; no node for key ${byte}`);}branch=registry.searchTree
Line truncated
|
||||
Reference in new issue
Block a user