Skip to main content

Chk

Struct Chk 

Source
struct Chk<'a> {
    c: Vec<char>,
    i: usize,
    u: bool,
    v: bool,
    has_names: bool,
    total_groups: usize,
    all_names: Vec<String>,
    _p: PhantomData<&'a ()>,
}

Fields§

§c: Vec<char>§i: usize§u: bool

u または v フラグ(Unicode モード)。

§v: bool

v フラグ(unicodeSets)。

§has_names: bool

名前つきの捕捉グループが 1 つでもあるか(\k を名前参照として扱うか)。

§total_groups: usize

捕捉グループの総数。

§all_names: Vec<String>

パターン中の全グループ名(前方参照の検査用)。

§_p: PhantomData<&'a ()>

i 以外の修飾子の検査のための入れ子の深さ。

Implementations§

Source§

impl<'a> Chk<'a>

Source

fn peek(&self) -> Option<char>

Source

fn peek_at(&self, n: usize) -> Option<char>

Source

fn eat(&mut self, ch: char) -> bool

Source

fn starts(&self, s: &str) -> bool

Source

fn prescan(&mut self)

先に全体を走査して、捕捉グループの総数と名前を集める(\1 の上限・\k の解決に要る)。

Source

fn disjunction( &mut self, outer: &mut Vec<String>, depth: usize, ) -> Result<(), String>

outer: 外側ですでに宣言された名前(同じ経路に並ぶ重複の検査)。宣言した名前を足して返す。

Source

fn alternative( &mut self, outer: &mut Vec<String>, depth: usize, ) -> Result<(), String>

Source

fn term(&mut self, outer: &mut Vec<String>, depth: usize) -> Result<(), String>

Source

fn brace_quantifier(&self) -> Result<Option<usize>, String>

{n} {n,} {n,m} なら末尾の次の位置(} の後)を返す。形でなければ None。n > m は誤り。

Source

fn group(&mut self, outer: &mut Vec<String>, depth: usize) -> Result<(), String>

Source

fn group_name(&mut self) -> Result<String, String>

< の直後から > までのグループ名を読む(エスケープ可)。

Source

fn unicode_escape_body(&mut self, force_u: bool) -> Result<Option<u32>, String>

\u の後ろ。{…}(force_u か Unicode モードのとき)・4 桁・サロゲートの対。 形が合えば Some(コードポイント)、合わなければ None(位置は戻す)。

Source

fn atom_escape(&mut self) -> Result<(), String>

Source

fn legacy_octal(&mut self)

Source

fn char_or_class_escape(&mut self, in_class: bool) -> Result<(), String>

\ の次の位置から、CharacterClassEscape / CharacterEscape を読む。 クラスの中では -(Unicode モード)と b も許す。クラス文字を返す代わりに「単独の文字か」を last_single に残す(範囲の検査用)。

Source

fn escape_single(&mut self, in_class: bool) -> Result<Option<u32>, String>

読んだ escape が 1 文字を表すならそのコードポイント、クラスの略記(\d など)なら None。

Source

fn property_escape(&mut self, negated: bool) -> Result<bool, String>

\p{…} \P{…}(p の次の位置から)。ECMA-262 Table 66〜69 に従いプロパティ名・値を検証する。 返り値は文字列の性質(v フラグでだけ許される)か。

Source

fn class(&mut self) -> Result<(), String>

Source

fn class_atom(&mut self) -> Result<Option<u32>, String>

クラスの 1 要素。単独の文字ならそのコードポイント、略記なら None。

Source

fn class_set_body(&mut self) -> Result<bool, String>

v フラグのクラス本体([ と ^ の後ろから ] まで)。文字列を含みうるか。

Source

fn class_set_operand(&mut self) -> Result<(bool, Option<u32>), String>

ClassSetOperand 1 つ。返り値: (文字列を含みうるか, 単独の文字ならそのコードポイント)。

Source

fn class_set_character(&mut self) -> Result<u32, String>

Auto Trait Implementations§

§

impl<'a> Freeze for Chk<'a>

§

impl<'a> RefUnwindSafe for Chk<'a>

§

impl<'a> Send for Chk<'a>

§

impl<'a> Sync for Chk<'a>

§

impl<'a> Unpin for Chk<'a>

§

impl<'a> UnsafeUnpin for Chk<'a>

§

impl<'a> UnwindSafe for Chk<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.