diff --git a/parser/v2/goexpression/parse.go b/parser/v2/goexpression/parse.go index 0b1aa41ea..c87b9ea75 100644 --- a/parser/v2/goexpression/parse.go +++ b/parser/v2/goexpression/parse.go @@ -140,7 +140,7 @@ func Expression(src string) (start, end int, err error) { errorHandler := func(pos token.Position, msg string) { err = fmt.Errorf("error parsing expression: %v", msg) } - s.Init(file, []byte(src), errorHandler, scanner.ScanComments) + s.Init(file, []byte(src), errorHandler, 0) // Read chains of identifiers and constants up until RBRACE, e.g.: // true @@ -176,6 +176,7 @@ loop: braceDepth-- if braceDepth < 0 { // We've hit the end of the expression. + end = int(pos)-1 break loop } end = int(pos) @@ -185,12 +186,13 @@ loop: continue case token.ILLEGAL: return 0, 0, fmt.Errorf("illegal token: %v", lit) - case token.COMMENT: - end = int(pos) + len(lit) - 1 default: end = int(pos) + len(tok.String()) - 1 } + fmt.Println("pos: ", int(pos)) } + fmt.Println("OUT") + fmt.Println(src[start:end]) return start, end, nil }