language

package
v0.0.0-...-c1ed8fc Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Overview

Package language contains methods and information about the different programming languages the comment parser supports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Language

type Language int

Language is the progamming language we're grabbing the comments from.

const (
	Unknown Language = iota
	AppleScript
	Assembly
	BLIF // Berkley Logic Interface Format
	Batch
	C
	Clif
	Clojure
	CMake
	CSharp
	Dart
	EDIF // Electronic Design Interchange Format
	Elixir
	Flex
	Fortran
	GLSLF // OpenGL Shading Language
	Go
	HTML
	Haskell
	Java
	JavaScript
	Kotlin
	LEF // Library Exchange Format
	Lisp
	Markdown
	Matlab
	MySQL
	NinjaBuild
	ObjectiveC
	Perl
	Python
	R
	Ruby
	Rust
	SDC  // Synopsis Design Constraint
	SDF  // Standard Delay Format
	SPEF // Standard Parasitics Exchange Format
	SQL
	SWIG
	Shader
	Shell
	Swift
	SystemVerilog
	TCL
	TypeScript
	Verilog
	XDC // Xilinx Design Constraint files
	Yacc
	Yaml
)

Languages we can retrieve comments from.

func ClassifyLanguage

func ClassifyLanguage(filename string) Language

ClassifyLanguage determines what language the source code was written in. It does this by looking at the file's extension.

func (Language) MultilineCommentEnd

func (lang Language) MultilineCommentEnd() string

MultilineCommentEnd returns the ending string of a multiline comment for the given language.

func (Language) MultilineCommentStart

func (lang Language) MultilineCommentStart() string

MultilineCommentStart returns the starting string of a multiline comment for the given language.

func (Language) NestedComments

func (lang Language) NestedComments() bool

NestedComments returns true if the language allows for nested multiline comments.

func (Language) QuoteCharacter

func (lang Language) QuoteCharacter(quote rune) (ok bool, escape bool)

QuoteCharacter returns 'true' if the character is considered the beginning of a string in the given language. The second return value is true if the string allows for escaping.

func (Language) SingleLineCommentStart

func (lang Language) SingleLineCommentStart() string

SingleLineCommentStart returns the starting string of a single line comment for the given language. There is no equivalent "End" method, because it's the end of line.

Jump to

Keyboard shortcuts

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