asm

package
v0.19.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package asm provides a simple parser for Go assembly files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Idents []Ident
}

A file represents a parsed file of Go assembly language.

func Parse

func Parse(content []byte) *File

Parse extracts identifiers from Go assembly files. Since it is a best-effort parser, it never returns an error.

type Ident

type Ident struct {
	Name   string // symbol name (after correcting [·∕]); Name[0]='.' => current package
	Offset int    // zero-based byte offset
	Kind   Kind
}

Ident represents an identifier in an assembly file.

func (Ident) End

func (id Ident) End() int

End returns the identifier's end offset.

type Kind

type Kind uint8

Kind describes the nature of an identifier in an assembly file.

const (
	Invalid Kind = iota // reserved zero value; not used by Ident
	Ref                 // arbitrary reference to symbol or control label
	Text                // definition of TEXT (function) symbol
	Global              // definition of GLOBL (var) symbol
	Data                // initialization of GLOBL (var) symbol; effectively a reference
	Label               // definition of control label
)

func (Kind) String

func (k Kind) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL