comment

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtensionsForLanguages

func ExtensionsForLanguages(langs []string) []string

ExtensionsForLanguages 는 주어진 언어 이름들의 파일 확장자 합집합을 반환합니다. 알 수 없는 언어 이름은 무시됩니다.

Types

type CStyleParser

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

CStyleParser 는 C 스타일 언어(TypeScript, JavaScript, Java, Kotlin, C, C++, C#, Swift, Rust 등)에서 주석과 문자열 리터럴을 추출하는 상태 기계 기반 파서.

func NewCStyleParser

func NewCStyleParser(extensions []string, hasTemplate bool) *CStyleParser

NewCStyleParser 는 주어진 확장자를 처리하는 파서를 생성합니다. JS/TS 의 백틱 템플릿 리터럴 처리를 위해 hasTemplate=true 로 설정하세요.

func (*CStyleParser) ParseFile

func (p *CStyleParser) ParseFile(content string) ([]Comment, error)

func (*CStyleParser) SupportedExtensions

func (p *CStyleParser) SupportedExtensions() []string

type Comment

type Comment struct {
	Text    string
	Line    int
	EndLine int
	IsBlock bool
	Kind    Kind // KindComment 또는 KindString
}

Comment 는 소스 코드에서 추출된 주석 또는 문자열 리터럴을 나타냄

type DockerfileParser added in v1.1.0

type DockerfileParser struct{}

DockerfileParser 는 Dockerfile에서 # 줄 주석을 추출. Dockerfile 은 문자열 리터럴 개념이 없으므로 주석만 파싱.

func (*DockerfileParser) ParseFile added in v1.1.0

func (p *DockerfileParser) ParseFile(content string) ([]Comment, error)

func (*DockerfileParser) SupportedExtensions added in v1.1.0

func (p *DockerfileParser) SupportedExtensions() []string

type GoParser

type GoParser struct{}

GoParser 는 공식 go/parser AST를 사용하여 Go 소스 코드에서 주석과 문자열 리터럴을 추출.

func (*GoParser) ParseFile

func (p *GoParser) ParseFile(content string) ([]Comment, error)

func (*GoParser) SupportedExtensions

func (p *GoParser) SupportedExtensions() []string

type HTMLParser added in v1.2.0

type HTMLParser struct{}

HTMLParser 는 HTML/SVG 파일에서 <!-- --> 블록 주석을 추출.

func (*HTMLParser) ParseFile added in v1.2.0

func (p *HTMLParser) ParseFile(content string) ([]Comment, error)

func (*HTMLParser) SupportedExtensions added in v1.2.0

func (p *HTMLParser) SupportedExtensions() []string

type HashStyleParser added in v1.2.0

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

HashStyleParser 는 # 줄 주석을 사용하는 언어(Ruby, Shell 등)에서 주석을 추출. Ruby 는 =begin/=end 멀티라인 블록 주석도 지원.

func NewHashStyleParser added in v1.2.0

func NewHashStyleParser(exts []string, rubyBlocks bool) *HashStyleParser

NewHashStyleParser 는 주어진 확장자를 처리하는 파서를 생성합니다. rubyBlocks=true 이면 =begin/=end 블록 주석을 처리합니다.

func (*HashStyleParser) ParseFile added in v1.2.0

func (p *HashStyleParser) ParseFile(content string) ([]Comment, error)

func (*HashStyleParser) SupportedExtensions added in v1.2.0

func (p *HashStyleParser) SupportedExtensions() []string

type Kind

type Kind uint8

Kind 은 추출된 항목의 종류를 나타냄

const (
	KindComment Kind = iota // 주석
	KindString              // 문자열 리터럴
	KindImport              // import/include 경로 — 언어 검사에서 항상 제외
)

type MarkdownParser added in v1.1.0

type MarkdownParser struct{}

MarkdownParser 는 Markdown 파일에서 텍스트 내용을 추출. 펜스드 코드 블록(```/~~~)과 인라인 코드(`...`)는 건너뜀. 각 비어 있지 않은 텍스트 줄을 KindComment 로 추출.

func (*MarkdownParser) ParseFile added in v1.1.0

func (p *MarkdownParser) ParseFile(content string) ([]Comment, error)

func (*MarkdownParser) SupportedExtensions added in v1.1.0

func (p *MarkdownParser) SupportedExtensions() []string

type Parser

type Parser interface {
	ParseFile(content string) ([]Comment, error)
	SupportedExtensions() []string
}

Parser 는 소스 코드에서 주석을 추출하는 인터페이스

func GetParser

func GetParser(path string) Parser

GetParser 는 path 에 맞는 Parser 를 반환합니다. 지원하지 않는 확장자면 nil 을 반환합니다.

type PythonParser

type PythonParser struct{}

PythonParser 는 Python 소스 코드에서 # 줄 주석과 문자열 리터럴을 추출. 단일/이중 따옴표 문자열과 삼중 따옴표 문자열(docstring 포함)을 모두 처리.

func (*PythonParser) ParseFile

func (p *PythonParser) ParseFile(content string) ([]Comment, error)

func (*PythonParser) SupportedExtensions

func (p *PythonParser) SupportedExtensions() []string

Jump to

Keyboard shortcuts

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