parser

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCmdFromString

func ParseCmdFromString(input string) (string, error)

The input string is like: execute command: docker stop xyz, this func just parse the command from the string

Types

type CodeParser

type CodeParser interface {
	ParseCode(text string) (SourceFileDict, error)
}

type GoCodeParser

type GoCodeParser struct {
}

func NewGoCodeParser

func NewGoCodeParser() *GoCodeParser

func (*GoCodeParser) ParseCode

func (g *GoCodeParser) ParseCode(text string) ([]SourceFile, error)

ParseCode function Parse the code from markdown blocks and return a SourceFileDict

type SourceFile

type SourceFile struct {
	FileName     string
	FileContent  string
	MatchContent string
}

func (*SourceFile) ParseFileContent

func (s *SourceFile) ParseFileContent()

func (*SourceFile) ParseFileName

func (s *SourceFile) ParseFileName()

Parse filename and code from the match content

type SourceFileDict

type SourceFileDict struct {
	SourceFiles map[string]SourceFile
}

func NewSourceFileDict

func NewSourceFileDict() *SourceFileDict

func (*SourceFileDict) AddSourceFile

func (s *SourceFileDict) AddSourceFile(fileName string, fileContent string)

func (*SourceFileDict) GetSourceFile

func (s *SourceFileDict) GetSourceFile(fileName string) (SourceFile, error)

func (*SourceFileDict) PrintSourceFiles

func (s *SourceFileDict) PrintSourceFiles()

PrintSourceFiles function prints the source files in the SourceFileDict

Jump to

Keyboard shortcuts

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