Skip to content

Commit

Permalink
core!: 1) publish parser Api; 2) implementes ForInElse statement; 3) …
Browse files Browse the repository at this point in the history
…other changes
  • Loading branch information
moisespsena committed Nov 10, 2023
1 parent 4b5adc8 commit 7dab523
Show file tree
Hide file tree
Showing 37 changed files with 3,821 additions and 2,623 deletions.
7 changes: 4 additions & 3 deletions bytecode.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"strings"

"github.com/gad-lang/gad/parser"
"github.com/gad-lang/gad/parser/source"
)

// Bytecode holds the compiled functions and constants.
Expand Down Expand Up @@ -216,16 +217,16 @@ func (o *CompiledFunction) Equal(right Object) bool {
}

// SourcePos returns the source position of the instruction at ip.
func (o *CompiledFunction) SourcePos(ip int) parser.Pos {
func (o *CompiledFunction) SourcePos(ip int) source.Pos {
begin:
if ip >= 0 {
if p, ok := o.SourceMap[ip]; ok {
return parser.Pos(p)
return source.Pos(p)
}
ip--
goto begin
}
return parser.NoPos
return source.NoPos
}

// Fprint writes constants and instructions to given Writer in a human readable form.
Expand Down
Loading

0 comments on commit 7dab523

Please sign in to comment.