Skip to content

Commit

Permalink
feat: support underline error in IndentIsNotMultipleOf4Error
Browse files Browse the repository at this point in the history
  • Loading branch information
rycont authored Jan 12, 2025
1 parent a45ea10 commit 2a10b92
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/error/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class CannotParseError extends YaksokError {

export class IndentIsNotMultipleOf4Error extends YaksokError {
constructor(props: {
position?: Position
tokens: Token[]
resource: {
indent: number
}
Expand Down
2 changes: 1 addition & 1 deletion core/prepare/lex/indent-validity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function assertIndentValidity(_tokens: Token[]) {
resource: {
indent: nextToken.value.length,
},
position: nextToken.position,
tokens: [nextToken],
})
}

Expand Down
4 changes: 2 additions & 2 deletions core/prepare/tokenize/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const RULES: {
shift()
}

return ' '.repeat(tabs * 4)
return '\t'.repeat(tabs)
},
},
{
Expand All @@ -106,7 +106,7 @@ export const RULES: {
throw new NotAcceptableSignal()
}

return ' '.repeat(spaces)
return '\t'.repeat(spaces / 4)
},
},
{
Expand Down
7 changes: 5 additions & 2 deletions runtest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { yaksok } from '@dalbit-yaksok/core'

await yaksok(`
이름: '홍길동'
나이: 20
약속, 잘 말하기
반복
결과: "안녕하세요"
잘 말하기 보여주기
`)

0 comments on commit 2a10b92

Please sign in to comment.