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

AST에 소스 코드 위치 정보를 추가하기 #80

Open
Kroisse opened this issue Mar 12, 2020 · 2 comments
Open

AST에 소스 코드 위치 정보를 추가하기 #80

Kroisse opened this issue Mar 12, 2020 · 2 comments

Comments

@Kroisse
Copy link
Contributor

Kroisse commented Mar 12, 2020

parser/Lexer.js가 처리하는 토큰화 과정에서 토큰의 시작점 및 끝점의 행/열 번호를 기록하고, 파싱 단계에서 해당 정보를 활용하여 AST에 각 노드의 시작점과 끝점 위치를 보존하게 할 수 있습니다. 일괄적으로 Span 등의 자료구조를 만드는 것도 좋겠습니다.

이 정보가 있으면 컴파일 에러가 발생했을 때 에러가 발생한 위치를 사용자에게 알려줄 수 있고, JS 타겟에 소스맵을 추가하는 #19 이슈 등에서도 도움이 될 겁니다.

@Kroisse
Copy link
Contributor Author

Kroisse commented Mar 12, 2020

Jison에서 뭔가 해 주는 게 있는지 아니면 렉서 구현에서 인터페이스를 맞춰 줘야 하는지 알아봐야 할 것 같습니다.

https://zaa.ch/jison/docs/#tracking-locations

@disjukr
Copy link
Member

disjukr commented Mar 12, 2020

렉서에서 인터페이스 맞춰야 해용. 안그래도 span 때문에 렉서는 새로 짜려고요

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

No branches or pull requests

2 participants