MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / Parse

Function Parse

utils/vscode/src/parser/parser.go:733–757  ·  view source on GitHub ↗

Parse parses the SPIR-V assembly string source, returning the parse results.

(source string)

Source from the content-addressed store, hash-verified

731
732// Parse parses the SPIR-V assembly string source, returning the parse results.
733func Parse(source string) (Results, error) {
734 toks, diags, err := lex(source)
735 if err != nil {
736 return Results{}, err
737 }
738 lines := strings.SplitAfter(source, "\n")
739 p := parser{
740 lines: lines,
741 toks: toks,
742 idents: map[string]*Identifier{},
743 mappings: map[*Token]interface{}{},
744 extInstImports: map[string]schema.OpcodeMap{},
745 }
746 if err := p.parse(); err != nil {
747 return Results{}, err
748 }
749 diags = append(diags, p.diags...)
750 return Results{
751 Lines: lines,
752 Tokens: toks,
753 Diagnostics: p.diags,
754 Identifiers: p.idents,
755 Mappings: p.mappings,
756 }, nil
757}
758
759// IsResult returns true if k is used to store the result of an instruction.
760func IsResult(k *schema.OperandKind) bool {

Callers

nothing calls this directly

Calls 2

parseMethod · 0.95
lexFunction · 0.85

Tested by

no test coverage detected