-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report parser error for invalid file
- Loading branch information
Showing
11 changed files
with
80 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::ast_signature::DefSignatureNode; | ||
use crate::{ast_signature::DefSignatureNode, code_location::HPos}; | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
pub enum ParserError { | ||
CannotReadFile, | ||
NotAHackFile, | ||
SyntaxError { message: String, pos: HPos }, | ||
} | ||
|
||
#[derive(Clone, Serialize, Deserialize, Debug, Default)] | ||
pub struct FileInfo { | ||
pub ast_nodes: Vec<DefSignatureNode>, | ||
pub closure_refs: Vec<u32>, | ||
pub valid_file: bool, | ||
pub parser_error: Option<ParserError>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
ERROR: InvalidHackFile - input.hack:1:1 - Invalid Hack file | ||
ERROR: InvalidHackFile - input.hack:7:0 - A name is expected here. | ||
ERROR: NonExistentFunction - main.hack:3:5 - Function foo is not defined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
ERROR: InvalidHackFile - input.hack:1:1 - Invalid Hack file | ||
ERROR: InvalidHackFile - input.hack:7:0 - A name is expected here. | ||
ERROR: NonExistentFunction - main.hack:4:5 - Function foo is not defined |