diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-22 13:59:08 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-22 13:59:08 -0700 |
| commit | dfd39f0b14794b360fd6c961c65ab45d229e00b1 (patch) | |
| tree | 51f0c30ef3a32c969c63321da8164436a3ba8b31 /lib/os.nom | |
| parent | 01d5f810ed7fd6e9b261b1fe793f8666970b2068 (diff) | |
Shifting further towards having inline tests. Also added a helper
function for directly extracting source lines from a Source or AST.
Diffstat (limited to 'lib/os.nom')
| -rw-r--r-- | lib/os.nom | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -45,3 +45,11 @@ action [..] action [line number of %pos in %str] (=lua "Files.get_line_number(\%str, \%pos)") action [line %line_num in %str] (=lua "Files.get_line(\%str, \%line_num)") +action [source lines of %tree]: + %source = (%tree.source if (%tree is syntax tree) else %tree) + %file = (read file %source.filename) + return (..) + (..) + (line % in %file) for % in (line number of %source.start in %file) to (..) + line number of %source.stop in %file + ..joined with "\n" |
