Skip to content

Commit

Permalink
[YCC] finishing lexer
Browse files Browse the repository at this point in the history
  • Loading branch information
Cr0a3 committed Nov 8, 2024
1 parent 47a109f commit 46898cb
Show file tree
Hide file tree
Showing 3 changed files with 574 additions and 8 deletions.
10 changes: 6 additions & 4 deletions tools/ycc/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ pub struct ErrorLoc {

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct YccError {
loc: ErrorLoc,
pub loc: ErrorLoc,

head: &'static str,
pub head: &'static str,

where_string: String,
pub where_string: String,
}

impl YccError {
Expand All @@ -23,7 +23,9 @@ impl YccError {
self.loc.col.to_string()
);

fab.setCodeLine(code.to_string());
if let Some(line) = code.split('\n').map(|x| x.to_owned()).collect::<Vec<String>>().get(self.loc.line as usize){
fab.setCodeLine(line.to_owned());
}

fab.addWhere(self.where_string.to_owned(), self.loc.col, self.loc.length);

Expand Down
Loading

0 comments on commit 46898cb

Please sign in to comment.