language

package
v0.0.0-...-b50cce2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

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
	Batch
	C
	Clif
	Clojure
	CMake
	CSharp
	Dart
	Fortran
	GLSLF // OpenGL Shading Language
	Go
	Haskell
	HTML
	Java
	JavaScript
	Flex
	Lisp
	Matlab
	MySQL
	NinjaBuild
	ObjectiveC
	Perl
	Python
	R
	Ruby
	Rust
	Shader
	Shell
	SQL
	Swift
	SWIG
	TypeScript
	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 langauge.

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