Struct parol::generators::scanner_config::ScannerConfig
source · pub struct ScannerConfig {
pub scanner_name: String,
pub scanner_state: usize,
pub line_comments: Vec<String>,
pub block_comments: Vec<(String, String)>,
pub auto_newline: bool,
pub auto_ws: bool,
}
Expand description
Configuration information for a scanner. Contains features like to optionally switch automatic handling off and newlines off.
Fields§
§scanner_name: String
The name of the scanner state taken from the grammar description
scanner_state: usize
Index of the scanner, aka scanner state
line_comments: Vec<String>
Strings with the characters that starts line comments
block_comments: Vec<(String, String)>
(String, String) tuples with the characters that start and end a block comments, respectively.
auto_newline: bool
If true the lexer handles (and skips) newlines. If false the user has to handle newlines on its own.
auto_ws: bool
If true the lexer handles (and skips) whitespace. If false the user has to handle whitespace on its own.
Implementations§
source§impl ScannerConfig
impl ScannerConfig
sourcepub fn with_line_comments(self, line_comments: Vec<String>) -> Self
pub fn with_line_comments(self, line_comments: Vec<String>) -> Self
Adds line comments to self
sourcepub fn with_block_comments(self, block_comments: Vec<(String, String)>) -> Self
pub fn with_block_comments(self, block_comments: Vec<(String, String)>) -> Self
Adds block comments to self
sourcepub fn with_auto_newline(self, auto_newline: bool) -> Self
pub fn with_auto_newline(self, auto_newline: bool) -> Self
Sets auto newline behavior
sourcepub fn with_auto_ws(self, auto_ws: bool) -> Self
pub fn with_auto_ws(self, auto_ws: bool) -> Self
Sets auto whitespace behavior
sourcepub fn generate_build_information(
&self,
cfg: &Cfg
) -> (Vec<String>, Vec<TerminalIndex>, String)
pub fn generate_build_information( &self, cfg: &Cfg ) -> (Vec<String>, Vec<TerminalIndex>, String)
Generates the data needed by the lexer generator. The tuple contains of the specific internal tokens of the scanner (ws, comments etc.) and the indices of the terminals that are valid in this scanner.
Trait Implementations§
source§impl Clone for ScannerConfig
impl Clone for ScannerConfig
source§fn clone(&self) -> ScannerConfig
fn clone(&self) -> ScannerConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ScannerConfig
impl Debug for ScannerConfig
source§impl Default for ScannerConfig
impl Default for ScannerConfig
source§impl Display for ScannerConfig
impl Display for ScannerConfig
source§impl Ord for ScannerConfig
impl Ord for ScannerConfig
source§fn cmp(&self, other: &ScannerConfig) -> Ordering
fn cmp(&self, other: &ScannerConfig) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for ScannerConfig
impl PartialEq for ScannerConfig
source§fn eq(&self, other: &ScannerConfig) -> bool
fn eq(&self, other: &ScannerConfig) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for ScannerConfig
impl PartialOrd for ScannerConfig
source§fn partial_cmp(&self, other: &ScannerConfig) -> Option<Ordering>
fn partial_cmp(&self, other: &ScannerConfig) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for ScannerConfig
impl StructuralPartialEq for ScannerConfig
Auto Trait Implementations§
impl Freeze for ScannerConfig
impl RefUnwindSafe for ScannerConfig
impl Send for ScannerConfig
impl Sync for ScannerConfig
impl Unpin for ScannerConfig
impl UnwindSafe for ScannerConfig
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
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.