preprocessor

package
v0.3.18 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefineDirective

type DefineDirective struct {
	Name string `parser:" @Define EOL" `
}

func (DefineDirective) Eval

func (d DefineDirective) Eval(vars PreprocVars) string

type Directive

type Directive struct {
	Ifndef  *IfndefDirective  `parser:" EOL* ( @@          "`
	Ifdef   *IfdefDirective   `parser:"   | @@        "`
	Define  *DefineDirective  `parser:"   | @@        "`
	Include *IncludeDirective `parser:"   | @@        "`
	Source  string            `parser:"   | @Source ) "`
}

func (Directive) Eval

func (d Directive) Eval(vars PreprocVars) string

type IfdefDirective

type IfdefDirective struct {
	Name       string      `parser:" @Ifdef EOL       "`
	Directives []Directive `parser:" @@* '#endif' EOL "`
}

func (IfdefDirective) Eval

func (d IfdefDirective) Eval(vars PreprocVars) string

type IfndefDirective

type IfndefDirective struct {
	Name       string      `parser:" @Ifndef EOL      "`
	Directives []Directive `parser:" @@* '#endif' EOL "`
}

func (IfndefDirective) Eval

func (d IfndefDirective) Eval(vars PreprocVars) string

type IncludeDirective

type IncludeDirective struct {
	Name string `parser:" @Include EOL" `
}

func (IncludeDirective) Eval

func (d IncludeDirective) Eval(vars PreprocVars) string

type PreprocVars

type PreprocVars map[string]struct{}

type PreprocessorHeaderFileAST

type PreprocessorHeaderFileAST struct {
	Directives []Directive `parser:" @@* "`
}

func ParsePreprocessorString

func ParsePreprocessorString(s string) (*PreprocessorHeaderFileAST, error)

func (PreprocessorHeaderFileAST) Eval

func (f PreprocessorHeaderFileAST) Eval(isCpp bool) string

Jump to

Keyboard shortcuts

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