INNER CODE UNIT · Go

cgCaptureAssignments

cc1a2b/JShunter · internal/jshunter/chunkgraph.go:290

func cgCaptureAssignments(body []byte, prop string) []cgCapture {
	var out []cgCapture
	lx := NewLexer(body)
	var p1, p2 Token
	var n int
	for {
		t := lx.Next()
		if t.Kind == TokEOF {
			return out
		}
		if t.Kind == TokWhitespace {
			continue
		}
		if t.Kind == TokPunct && string(body[t.Start:t.End]) == "=" &&
			p1.Kind == TokIdent && string(body[p1.ValStart:p1.ValEnd]) == prop &&
			p2.Kind == TokPunct && string(body[p2.Start:p2.End]) == "." {
			if cap, ok := cgCaptureRHS(lx, body); ok {
				out = append(out, cap)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…