Add Rust: minimax, runner, and codelens highlighter

This commit is contained in:
2025-11-01 17:17:13 -07:00
committed by Mark
parent 3494003683
commit 19f523d0ed
24 changed files with 3420 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
use js_sys::{Array, JsString, RegExp};
use wasm_bindgen::prelude::*;
#[wasm_bindgen(module = "codemirror")]
extern "C" {
pub type StringStream;
#[wasm_bindgen(method)]
#[must_use]
pub fn eol(this: &StringStream) -> bool;
#[wasm_bindgen(method)]
#[must_use]
pub fn sol(this: &StringStream) -> bool;
#[wasm_bindgen(method)]
#[must_use]
pub fn peek(this: &StringStream) -> JsString;
#[wasm_bindgen(method)]
pub fn next(this: &StringStream) -> JsString;
#[wasm_bindgen(method, js_name = eat)]
pub fn eat_regexp(this: &StringStream, m: &RegExp) -> bool;
#[wasm_bindgen(method, js_name = eatWhile)]
pub fn eat_while_regexp(this: &StringStream, m: &RegExp) -> bool;
#[wasm_bindgen(method, js_name = eatSpace)]
pub fn eat_space(this: &StringStream) -> bool;
#[wasm_bindgen(method, js_name = skipToEnd)]
pub fn skip_to_end(this: &StringStream);
#[wasm_bindgen(method, js_name = skipTo)]
pub fn skip_to(this: &StringStream, str: &str) -> bool;
#[wasm_bindgen(method, js_name = match)]
#[must_use]
pub fn match_str(this: &StringStream, pattern: &str, consume: bool, case_fold: bool) -> bool;
#[wasm_bindgen(method, js_name = match)]
#[must_use]
pub fn match_regexp(this: &StringStream, pattern: &RegExp, consume: bool) -> Array;
#[wasm_bindgen(method, js_name = backUp)]
pub fn back_up(this: &StringStream, n: u32);
#[wasm_bindgen(method)]
#[must_use]
pub fn column(this: &StringStream) -> u32;
#[wasm_bindgen(method)]
#[must_use]
pub fn indentation(this: &StringStream) -> u32;
#[wasm_bindgen(method)]
#[must_use]
pub fn current(this: &StringStream) -> String;
#[wasm_bindgen(method, js_name = lookAhead)]
#[must_use]
pub fn look_ahead(this: &StringStream, n: u32) -> Option<String>;
}