Skip to content

New Lexer: Minimal amount to allow compiling - #477

Merged
Razican merged 7 commits into
boa-dev:new_lexerfrom
Lan2u:new_lexer
Jun 11, 2020
Merged

Razican merged 7 commits into
boa-dev:new_lexerfrom
Lan2u:new_lexer

Conversation

@Lan2u

@Lan2u Lan2u commented Jun 10, 2020 •

Copy link
Copy Markdown

Updated various external references, disabled a large number of tests to allow the code to compile after changes in (#432) , acts as a base so I can measure progress (by tests passing) as I start reimplementing stuff.

@Lan2u
Lan2u marked this pull request as draft June 10, 2020 23:39
@Lan2u Lan2u changed the title Minimal amount to allow compiling New Lexer: Minimal amount to allow compiling Jun 10, 2020

@Razican Razican left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! Check my comments so that we can clean up a bit more the code, and I will merge it in the branch, so that we can start implementing more stuff.

Comment thread boa/src/syntax/lexer/template.rs Resolved
Comment thread boa/src/syntax/lexer/error.rs Outdated
impl Error {
/// Creates a new syntax error.
pub(super) fn syntax<M>(err: M) -> Self
pub(crate) fn syntax<M>(err: M) -> Self

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this public at the crate level? I think we should only be creating lexer errors in the lexer.

@Lan2u Lan2u Jun 11, 2020 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, however when I was trying it I found the syntax function is currently used elsewhere (outside crate) and so this change was needed to get code compiling.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided it was easier just to make it super for now and then go back and make the change later (starting at a baseline of code which compiles / can be tested)

@Lan2u Lan2u Jun 11, 2020 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where it is used:

return Err(LexerError::new(format!(
"invalid regular expression flag {}",
char::from(c)
)))
}
};
if !flags.contains(new_flag) {
flags.insert(new_flag);
} else {
return Err(LexerError::new(format!(
"invalid regular expression flag {}",
char::from(c)
)));

I'm wondering if the token.rs file should actually be in the lexer directory rather than ast because the lexer is the one generating tokens.

Especially because the token.rs file seems to be doing an amount of lexing itself (FromStr implementations).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit f115892 shows the result of moving the token file

Comment thread boa/src/syntax/parser/tests.rs Resolved
Comment thread boa_cli/src/main.rs Resolved
Comment thread boa_wasm/src/lib.rs Resolved
@Lan2u
Lan2u marked this pull request as ready for review June 11, 2020 14:15
@Razican
Razican merged commit 688fff5 into boa-dev:new_lexer Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants