Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

기타 개선 #24

Merged
merged 4 commits into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/psl/src/codegen/impls/expressions/if.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
ast::IfExpression,
codegen::{
construct::{Scope, Type},
construct::Type,
context::CodegenContext,
pass::{NameResolutionContext, NameResolutionPass},
visitor::CodegenNode,
Expand Down
2 changes: 1 addition & 1 deletion crates/psl/src/codegen/impls/statements/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
match self {
Statement::Declaration(node) => ctx.visit(node),
Statement::Write(node) => ctx.visit(node),
Statement::Expression(node) => ctx.visit(node),
Statement::Expression(node) => format!("{};", ctx.visit(node)),
}

Check warning on line 17 in crates/psl/src/codegen/impls/statements/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/psl/src/codegen/impls/statements/mod.rs#L16-L17

Added lines #L16 - L17 were not covered by tests
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/psl/src/codegen/pass/name_resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub trait NameResolutionPass {

impl<T: NameResolutionPass> NameResolutionPass for Box<T> {
fn resolve(&self, ctx: &mut NameResolutionContext) {
T::resolve(&self, ctx)
T::resolve(self, ctx)
}
}

Expand Down
15 changes: 9 additions & 6 deletions crates/psl/src/syntax/fragments/separator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ use crate::ast::TokenKind;

pub fn parse_separator(s: &mut Located<&str>) -> PResult<()> {
alt((
repeat::<_, _, (), _, _>(
1..,
(
opt(TokenKind::WhitespaceHorizontal),
TokenKind::WhitespaceVertical,
(
repeat::<_, _, (), _, _>(
1..,
(
opt(TokenKind::WhitespaceHorizontal),
TokenKind::WhitespaceVertical,
),
),
opt(TokenKind::WhitespaceHorizontal),
)
.void(),
.void(),
TokenKind::Eof.void(),
))
.parse_next(s)
Expand Down
4 changes: 2 additions & 2 deletions crates/psl/src/syntax/statements/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod write;

use winnow::{
combinator::{alt, terminated},
combinator::{alt, opt, terminated},
Located, PResult, Parser,
};

Expand All @@ -18,7 +18,7 @@
alt((
parse_declaration.map(Statement::Declaration),
parse_write.map(Statement::Write),
terminated(parse_expression, parse_separator).map(Statement::Expression),
terminated(parse_expression, opt(parse_separator)).map(Statement::Expression),

Check warning on line 21 in crates/psl/src/syntax/statements/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/psl/src/syntax/statements/mod.rs#L21

Added line #L21 was not covered by tests
))
.parse_next(s)
}
Loading