parser

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFile

func ParseFile(fset *token.FileSet, srcFile, interFile string, conf *Config) (f *ast.File, err error)

ParseFile parses a C/C++ source file and returns the corresponding AST. Allow fset to be nil, in which case a new FileSet will be created.

func ParseIntermediateFile

func ParseIntermediateFile(fset *token.FileSet, filename string, mode Mode) (f *ast.File, err error)

ParseIntermediateFile parses an intermediate file (*.i) and returns the corresponding AST. Allow fset to be nil, in which case a new FileSet will be created.

Types

type Config

type Config struct {
	Compiler    string // default: clang++
	PPFlag      string // default: -E
	BaseDir     string // base of include searching directory, should be absolute path
	IncludeDirs []string
	Defines     []string
	Flags       []string

	Mode Mode // parsing mode
}

Config represents the configuration for parsing C/C++ source files.

type Mode

type Mode int

Mode represents the parsing mode.

const (
	ParseC           Mode = 1 << iota // default parser with C++
	ParseAllComments                  // clang -fparse-all-comments
)

Jump to

Keyboard shortcuts

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