diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-30 17:20:22 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-30 17:21:19 -0700 |
| commit | b53516c47c0dd1f9325f9f721f561487510cca98 (patch) | |
| tree | 92961e19bc94eec3ab8b0f19357c57399c205b7d /code_obj.moon | |
| parent | 5637676bc45ce9aa3015726485f63a2a5745a45a (diff) | |
Simplified and correctified lib/object (though the codegen still need
streamlining), added a .stub member to Action trees, and switched
Source's repr to be @filename[start:stop] instead of
"filename[start:stop]"
Diffstat (limited to 'code_obj.moon')
| -rw-r--r-- | code_obj.moon | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/code_obj.moon b/code_obj.moon index 665d0f1..8dfc0a1 100644 --- a/code_obj.moon +++ b/code_obj.moon @@ -12,15 +12,15 @@ Source = immutable {"filename","start","stop"}, { if stop and start > stop+1 then error("Invalid range: #{start}, #{stop}") return filename, start, stop from_string: (str)=> - filename,start,stop = str\match("^(.-)%[(%d+):(%d+)%]$") + filename,start,stop = str\match("^@(.-)%[(%d+):(%d+)%]$") unless filename - filename,start = str\match("^(.-)%[(%d+)%]$") + filename,start = str\match("^@(.-)%[(%d+)%]$") return Source(filename or str, tonumber(start or 1), tonumber(stop)) __tostring: => if @stop - "\"#{@filename}[#{@start}:#{@stop}]\"" + "@#{@filename}[#{@start}:#{@stop}]" else - "\"#{@filename}[#{@start}]\"" + "@#{@filename}[#{@start}]" __lt: (other)=> assert(@filename == other.filename, "Cannot compare sources from different files") return if @start == other.start |
