Add word-level parsing
This commit is contained in:
parent
0d66b1ee7c
commit
198bc12507
34 changed files with 743 additions and 446 deletions
26
src/syntax/content/parser/token/linebreak.rs
Normal file
26
src/syntax/content/parser/token/linebreak.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
use std::fmt::Display;
|
||||
use crate::{
|
||||
syntax::content::{Parseable, parser::lexeme::Lexeme},
|
||||
};
|
||||
|
||||
pub struct LineBreak {}
|
||||
|
||||
impl Parseable for LineBreak {
|
||||
fn probe(lexeme: &Lexeme) -> bool {
|
||||
lexeme.to_raw() == "\n"
|
||||
}
|
||||
|
||||
fn lex(_lexeme: &Lexeme) -> LineBreak {
|
||||
LineBreak {}
|
||||
}
|
||||
|
||||
fn render(&self) -> String {
|
||||
"\n".to_owned()
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for LineBreak {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(f, "Line Break")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue