lang

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotSupported   = errors.New("not supported")
	NotImplemented = errors.New("not implemented")
)
View Source
var (

	// TODO scala, typescript, erlang, dart, racket
	SupportedLanguages = []Generator{
		golangGen,
		pythonGen,
		cppGen,
		rustGen,
		javaGen,
		jsGen,
		phpGen,
		cGen,
		csharpGen,
		rubyGen,
		swiftGen,
		kotlinGen,
	}
)

Functions

func Generate

func Generate(q *leetcode.QuestionData) ([]string, error)

Types

type FileOutput

type FileOutput struct {
	Path    string
	Content string
}

type Generator

type Generator interface {
	Name() string
	ShortName() string
	Slug() string
	// SupportTest returns true if the language supports local test.
	SupportTest() bool
	// CheckLibrary checks if the library is installed. Return false if not installed.
	CheckLibrary() bool
	// GenerateLibrary copies necessary supporting library files to project.
	GenerateLibrary() error
	// Generate generates code files for the question.
	Generate(q *leetcode.QuestionData) ([]FileOutput, error)
}

func GetGenerator

func GetGenerator(gen string) Generator

type Modifier

type Modifier func(string, *leetcode.QuestionData) string

Jump to

Keyboard shortcuts

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