pub struct Language {Show 33 fields
pub name: String,
pub abi_version: u32,
pub symbol_count: u32,
pub alias_count: u32,
pub token_count: u32,
pub external_token_count: u32,
pub state_count: u32,
pub large_state_count: u32,
pub production_id_count: u32,
pub field_count: u32,
pub max_alias_sequence_length: u32,
pub keyword_capture_token: u16,
pub symbol_names: Vec<String>,
pub public_symbol_map: Vec<u16>,
pub symbol_metadata: Vec<u8>,
pub field_names: Vec<String>,
pub field_map_slices: Vec<(u16, u16)>,
pub field_map_entries: Vec<(u16, u8, bool)>,
pub alias_sequences: Vec<u16>,
pub non_terminal_alias_map: Vec<u16>,
pub primary_state_ids: Vec<u16>,
pub lex_modes: Vec<u16>,
pub reserved_set: Vec<u8>,
pub reserved_words: Vec<u16>,
pub max_reserved: u32,
pub state_start: Vec<u32>,
pub entries: Vec<u32>,
pub actions: Vec<Action>,
pub lex: LexTable,
pub keyword_lex: LexTable,
pub lex_ext: Vec<u16>,
pub ext_symbol_map: Vec<u16>,
pub ext_valid: Vec<bool>,
}Fields§
§name: String§abi_version: u32§symbol_count: u32§alias_count: u32§token_count: u32§external_token_count: u32§state_count: u32§large_state_count: u32§production_id_count: u32§field_count: u32§max_alias_sequence_length: u32§keyword_capture_token: u16§symbol_names: Vec<String>§public_symbol_map: Vec<u16>§symbol_metadata: Vec<u8>位 0 可见,位 1 具名,位 2 supertype。
field_names: Vec<String>§field_map_slices: Vec<(u16, u16)>每个 production 的字段映射切片 (index, length)。
field_map_entries: Vec<(u16, u8, bool)>(字段 id, 子节点序号, 是否继承)
alias_sequences: Vec<u16>§non_terminal_alias_map: Vec<u16>§primary_state_ids: Vec<u16>§lex_modes: Vec<u16>每个解析状态的词法状态。
reserved_set: Vec<u8>每个解析状态使用的保留字集合编号(0 表示没有)。
reserved_words: Vec<u16>保留字集合,按 max_reserved 个一行展平,行内遇到 0 结束。
max_reserved: u32§state_start: Vec<u32>§entries: Vec<u32>高 16 位符号,低 16 位值,同一状态内按符号升序。
actions: Vec<Action>§lex: LexTable§keyword_lex: LexTable§lex_ext: Vec<u16>每个解析状态的外部词法状态(0 表示没有外部记号可用)。
ext_symbol_map: Vec<u16>外部记号序号到符号的映射。
ext_valid: Vec<bool>外部词法状态的有效记号表:按 一行展平,第 0 行全假(行宽为外部记号数)。
Implementations§
Source§impl Language
impl Language
Sourcepub fn lookup(&self, state: u16, symbol: u16) -> u16
pub fn lookup(&self, state: u16, symbol: u16) -> u16
对应官方 ts_language_lookup:终结符得到动作下标,非终结符得到后继状态。
pub fn has_actions(&self, state: u16, symbol: u16) -> bool
Sourcepub fn actions_for(&self, state: u16, symbol: u16) -> &[Action]
pub fn actions_for(&self, state: u16, symbol: u16) -> &[Action]
官方 ts_language_table_entry:错误符号没有动作。
pub fn has_reduce_action(&self, state: u16, symbol: u16) -> bool
pub fn next_state(&self, state: u16, symbol: u16) -> u16
Sourcepub fn is_reserved(&self, state: u16, sym: u16) -> bool
pub fn is_reserved(&self, state: u16, sym: u16) -> bool
官方 ts_language_is_reserved_word。
Sourcepub fn ext_valid_row(&self, ext_state: u16) -> &[bool]
pub fn ext_valid_row(&self, ext_state: u16) -> &[bool]
某个外部词法状态下各外部记号是否有效。
pub fn visible(&self, sym: u16) -> bool
pub fn named(&self, sym: u16) -> bool
pub fn symbol_name(&self, sym: u16) -> &str
pub fn public_symbol(&self, sym: u16) -> u16
pub fn field_name(&self, id: u16) -> &str
pub fn alias_sequence(&self, prod: u16) -> Option<&[u16]>
pub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn from_bytes(b: &[u8]) -> Result<Language, String>
Trait Implementations§
impl Eq for Language
impl StructuralPartialEq for Language
Auto Trait Implementations§
impl Forget for Language
impl Freeze for Language
impl Move for Language
impl RefUnwindSafe for Language
impl Send for Language
impl Sync for Language
impl Unpin for Language
impl UnsafeUnpin for Language
impl UnwindSafe for Language
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more