From b53516c47c0dd1f9325f9f721f561487510cca98 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 30 May 2018 17:20:22 -0700 Subject: 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]" --- code_obj.moon | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'code_obj.moon') 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 -- cgit v1.2.3