parser

package
v1.7.10 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupportedFile = errors.New("unsupported file to parse")

ErrNotSupportedFile represents an error when a file is not supported by KICS

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder is a representation of parsers that will be construct

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates a new Builder's reference

func (*Builder) Add

func (b *Builder) Add(p kindParser) *Builder

Add is a function that adds a new parser to the caller and returns it

func (*Builder) Build

func (b *Builder) Build(types, cloudProviders []string) ([]*Parser, error)

Build prepares parsers and associates a parser to its extension and returns it

type ParsedDocument added in v1.4.6

type ParsedDocument struct {
	Docs          []model.Document
	Kind          model.FileKind
	Content       string
	IgnoreLines   []int
	CountLines    int
	ResolvedFiles map[string]model.ResolvedFile
}

ParsedDocument is a struct containing data retrieved from parsing

type Parser

type Parser struct {
	Platform []string
	// contains filtered or unexported fields
}

Parser is a struct that associates a parser to its supported extensions

func (*Parser) CommentsCommands added in v1.4.1

func (c *Parser) CommentsCommands(filePath string, fileContent []byte) model.CommentsCommands

CommentsCommands gets commands on comments in the file beginning, before the code starts

func (*Parser) Parse

func (c *Parser) Parse(filePath string, fileContent []byte) (ParsedDocument, error)

Parse executes a parser on the fileContent and returns the file content as a Document, the file kind and an error, if an error has occurred

func (*Parser) SupportedExtensions

func (c *Parser) SupportedExtensions() model.Extensions

SupportedExtensions returns extensions supported by KICS

Directories

Path Synopsis
ansible
jsonfilter

Jump to

Keyboard shortcuts

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