Files
minimax/rust/rhai-codemirror/src/codemirror.rs

65 lines
1.7 KiB
Rust

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>;
}