JuliaLang / JuliaLang/JuliaSyntax.jl

Generalizing SourceFile - adding line/column offsets etc

Open
#190 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
293
Forks
50
PR merge metrics
No merged PRs in 30d

Description

https://github.com/JuliaDebug/Cthulhu.jl/pull/345 uses JuliaSyntax to represent source code with expression boundaries mapped to character positions within the source text. In that application, [CodeTracking](https://github.com/timholy/CodeTracking.jl) is used to extract source-text for specific methods which may be partway into a file.

Question: for "snippets" like these, should the starting line number `lineno` be added as a new field to `SourceFile`? Or do you need it to represent "a whole file"? If so, then adding it as a field seems incorrect, since of course a whole file will start at line 1. The other issue is whether functions like `source_line` should return the *offset* line or the line index; currently the two are the same. It's for reasons like these that I didn't want to add it without thinking about the consequences.

Contributor guide

No contributing guide indexed for this repository

Research direction

Read the linked Cthulhu.jl pull request first, then inspect the SourceFile abstraction and source_line behavior in JuliaSyntax. Determine whether snippets need line and column offsets and whether source_line should use offsets or indexes; done requires an agreed representation and documented semantics before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.