搭建框架

pull/25/merge
Minho 2017-04-21 18:20:35 +08:00
parent d58087f723
commit 67486f0866
727 changed files with 831224 additions and 37 deletions

100
Godeps/Godeps.json generated
View File

@ -3,6 +3,10 @@
"GoVersion": "go1.8",
"GodepVersion": "v79",
"Deps": [
{
"ImportPath": "github.com/adamzy/cedar-go",
"Rev": "d348c21f72432c2b6d5f05f68759fde94f64b227"
},
{
"ImportPath": "github.com/astaxie/beego",
"Comment": "v1.8.0",
@ -28,6 +32,11 @@
"Comment": "v1.8.0",
"Rev": "323a1c4214101331a4b71922c23d19b7409ac71f"
},
{
"ImportPath": "github.com/astaxie/beego/orm",
"Comment": "v1.8.0",
"Rev": "323a1c4214101331a4b71922c23d19b7409ac71f"
},
{
"ImportPath": "github.com/astaxie/beego/session",
"Comment": "v1.8.0",
@ -42,6 +51,97 @@
"ImportPath": "github.com/astaxie/beego/utils",
"Comment": "v1.8.0",
"Rev": "323a1c4214101331a4b71922c23d19b7409ac71f"
},
{
"ImportPath": "github.com/boltdb/bolt",
"Comment": "v1.3.0-58-ge9cf4fa",
"Rev": "e9cf4fae01b5a8ff89d0ec6b32f0d9c9f79aefdd"
},
{
"ImportPath": "github.com/cznic/fileutil",
"Rev": "90cf820aafe8f7df39416fdbb932029ff99bd1ab"
},
{
"ImportPath": "github.com/cznic/internal/buffer",
"Comment": "1.0.0-1-ge5e1c3e",
"Rev": "e5e1c3e9165d0a72507c2bbb0ffac1c02b8d3f7c"
},
{
"ImportPath": "github.com/cznic/internal/file",
"Comment": "1.0.0-1-ge5e1c3e",
"Rev": "e5e1c3e9165d0a72507c2bbb0ffac1c02b8d3f7c"
},
{
"ImportPath": "github.com/cznic/internal/slice",
"Comment": "1.0.0-1-ge5e1c3e",
"Rev": "e5e1c3e9165d0a72507c2bbb0ffac1c02b8d3f7c"
},
{
"ImportPath": "github.com/cznic/kv",
"Rev": "c5de474a2ccdaed5ba5ff8b5d2d213dbf48a8b5e"
},
{
"ImportPath": "github.com/cznic/lldb",
"Comment": "v1.1.0",
"Rev": "bea8611dd5c407f3c5eab9f9c68e887a27dc6f0e"
},
{
"ImportPath": "github.com/cznic/mathutil",
"Rev": "1447ad269d64ca91aa8d7079baa40b6fc8b965e7"
},
{
"ImportPath": "github.com/cznic/sortutil",
"Rev": "4c7342852e65c2088c981288f2c5610d10b9f7f4"
},
{
"ImportPath": "github.com/cznic/zappy",
"Rev": "2533cb5b45cc6c07421468ce262899ddc9d53fb7"
},
{
"ImportPath": "github.com/edsrzf/mmap-go",
"Rev": "0bce6a6887123b67a60366d2c9fe2dfb74289d2e"
},
{
"ImportPath": "github.com/go-sql-driver/mysql",
"Comment": "v1.2-191-g1421caf",
"Rev": "1421caf44f6464fd2ee8de694c7508ee13f92964"
},
{
"ImportPath": "github.com/huichen/murmur",
"Rev": "e0489551cf5116e27d7cc69d97a53cdbdd028acf"
},
{
"ImportPath": "github.com/huichen/sego",
"Rev": "d06fe1b3abe3877ab593b57e5e43daf6c4c25add"
},
{
"ImportPath": "github.com/huichen/wukong/core",
"Comment": "v0.1-94-gd014a1f",
"Rev": "d014a1f19dae3664677c11bd25549cfc820cd890"
},
{
"ImportPath": "github.com/huichen/wukong/engine",
"Comment": "v0.1-94-gd014a1f",
"Rev": "d014a1f19dae3664677c11bd25549cfc820cd890"
},
{
"ImportPath": "github.com/huichen/wukong/storage",
"Comment": "v0.1-94-gd014a1f",
"Rev": "d014a1f19dae3664677c11bd25549cfc820cd890"
},
{
"ImportPath": "github.com/huichen/wukong/types",
"Comment": "v0.1-94-gd014a1f",
"Rev": "d014a1f19dae3664677c11bd25549cfc820cd890"
},
{
"ImportPath": "github.com/huichen/wukong/utils",
"Comment": "v0.1-94-gd014a1f",
"Rev": "d014a1f19dae3664677c11bd25549cfc820cd890"
},
{
"ImportPath": "golang.org/x/sys/unix",
"Rev": "a408501be4d17ee978c04a618e7a1b22af058c0e"
}
]
}

View File

@ -0,0 +1,90 @@
package commands
import (
"fmt"
"net/url"
"time"
"github.com/lifei6671/godoc/models"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"github.com/astaxie/beego/logs"
"os"
)
// RegisterDataBase 注册数据库
func RegisterDataBase() {
host := beego.AppConfig.String("db_host")
database := beego.AppConfig.String("db_database")
username := beego.AppConfig.String("db_username")
password := beego.AppConfig.String("db_password")
timezone := beego.AppConfig.String("timezone")
port := beego.AppConfig.String("db_port")
dataSource := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8&parseTime=true&loc=%s",username,password,host,port,database,url.QueryEscape(timezone))
orm.RegisterDataBase("default", "mysql", dataSource)
orm.DefaultTimeLoc, _ = time.LoadLocation(timezone)
}
// RegisterModel 注册Model
func RegisterModel() {
orm.RegisterModelWithPrefix("md_",
new(models.Member),
new(models.Book),
new(models.Relationship),
new(models.Comment),
new(models.Option),
new(models.Document),
)
}
func Initialization() {
options := []models.Option {
{ OptionName: "ENABLED_CAPTCHA", OptionValue: "false", OptionTitle:"是否启用验证码"},
{ OptionName: "ENABLED_REGISTER",OptionValue:"false",OptionTitle:"是否启用注册"},
{ OptionName: "ENABLE_ANONYMOUS" , OptionValue:"false", OptionTitle:"启用匿名访问"},
{ OptionName: "SITE_NAME", OptionValue:"MinDoc", OptionTitle: "站点名称"},
}
models.NewOption().InsertMulti(options...)
member := models.NewMember()
member.Account = "admin"
member.Avatar = "/static/images/headimgurl.jpg"
member.Password = "123456"
member.Role = 0
member.Add()
}
// RegisterLogger 注册日志
func RegisterLogger() {
logs.SetLogger("console")
logs.SetLogger("file",`{"filename":"logs/log.log"}`)
logs.EnableFuncCallDepth(true)
logs.Async()
}
// RunCommand 注册orm命令行工具
func RegisterCommand() {
if _,err := os.Stat("install.lock"); os.IsNotExist(err){
orm.RunSyncdb("default",true,false)
Initialization()
f,_ := os.Create("install.lock")
defer f.Close()
}
}
func RegisterFunction() {
beego.AddFuncMap("config",models.GetOptionValue)
}

View File

@ -14,7 +14,7 @@ timezone = Asia/Shanghai
#数据库配置
db_host=192.168.3.104
db_port=3306
db_database=webhook_db
db_database=mindoc_db
db_username=root
db_password=123456

16
conf/enumerate.go 100644
View File

@ -0,0 +1,16 @@
// package conf 为配置相关.
package conf
import "github.com/astaxie/beego"
// 登录用户的Session名
const LoginSessionName = "LoginSessionName"
// app_key
func GetAppKey() (string) {
return beego.AppConfig.DefaultString("app_key","go-git-webhook")
}
func GetDatabasePrefix() string {
return beego.AppConfig.DefaultString("db_prefix","md_")
}

View File

@ -0,0 +1,79 @@
package controllers
import (
"fmt"
"time"
"github.com/lifei6671/godoc/conf"
"github.com/lifei6671/godoc/models"
"github.com/lifei6671/godoc/utils"
"github.com/astaxie/beego"
)
// AccountController 用户登录与注册.
type AccountController struct {
BaseController
}
// Login 用户登录.
func (c *AccountController) Login() {
c.Prepare()
var remember struct { MemberId int ; Account string; Time time.Time}
//如果Cookie中存在登录信息
if cookie,ok := c.GetSecureCookie(conf.GetAppKey(),"login");ok{
if err := utils.Decode(cookie,&remember); err == nil {
member := models.NewMember()
member.MemberId = remember.MemberId
if err := models.NewMember().Find(remember.MemberId); err == nil {
c.SetMember(*member)
c.Redirect(beego.URLFor("HomeController.Index"), 302)
c.StopRun()
}
}
}
if c.Ctx.Input.IsPost() {
account := c.GetString("inputAccount")
password := c.GetString("inputPassword")
member,err := models.NewMember().Login(account,password)
//如果没有数据
if err == nil {
c.SetMember(*member)
c.JsonResult(0,"ok")
c.StopRun()
}else{
fmt.Println(err)
c.JsonResult(500,"账号或密码错误",nil)
}
return
}else{
c.Layout = ""
c.TplName = "account/login.tpl"
}
}
func (p *AccountController) Register() {
p.TplName = "account/register.tpl"
}
func (p *AccountController) FindPassword() {
p.TplName = "account/find_password.tpl"
}
// Logout 退出登录.
func (c *AccountController) Logout(){
c.SetMember(models.Member{});
c.Redirect(beego.URLFor("AccountController.Login"),302)
}

View File

@ -1,7 +1,85 @@
package controllers
import "github.com/astaxie/beego"
import (
"bytes"
"github.com/lifei6671/godoc/models"
"github.com/lifei6671/godoc/conf"
"github.com/astaxie/beego"
)
type BaseController struct {
beego.Controller
Member *models.Member
}
// Prepare 预处理.
func (c *BaseController) Prepare (){
c.Data["SiteName"] = "MinDoc"
c.Data["Member"] = models.Member{}
if member,ok := c.GetSession(conf.LoginSessionName).(models.Member); ok && member.MemberId > 0{
c.Member = &member
c.Data["Member"] = c.Member
}else{
c.Member = models.NewMember()
c.Member.Find(1)
c.Data["Member"] = *c.Member
}
c.Data["BaseUrl"] = c.Ctx.Input.Scheme() + "://" + c.Ctx.Request.Host
if options,err := models.NewOption().All();err == nil {
for _,item := range options {
c.Data[item.OptionName] = item.OptionValue
}
}
}
// SetMember 获取或设置当前登录用户信息,如果 MemberId 小于 0 则标识删除 Session
func (c *BaseController) SetMember(member models.Member) {
if member.MemberId <= 0 {
c.DelSession(conf.LoginSessionName)
c.DelSession("uid")
c.DestroySession()
} else {
c.SetSession(conf.LoginSessionName, member)
c.SetSession("uid", member.MemberId)
}
}
// JsonResult 响应 json 结果
func (c *BaseController) JsonResult(errCode int,errMsg string,data ...interface{}){
json := make(map[string]interface{},3)
json["errcode"] = errCode
json["message"] = errMsg
if len(data) > 0 && data[0] != nil{
json["data"] = data[0]
}
c.Data["json"] = json
c.ServeJSON(true)
c.StopRun()
}
// ExecuteViewPathTemplate 执行指定的模板并返回执行结果.
func (c *BaseController) ExecuteViewPathTemplate(tplName string,data interface{}) (string,error){
var buf bytes.Buffer
viewPath := c.ViewPath
if c.ViewPath == "" {
viewPath = beego.BConfig.WebConfig.ViewsPath
}
if err := beego.ExecuteViewPathTemplate(&buf,tplName,viewPath,data); err != nil {
return "",err
}
return buf.String(),nil
}

View File

@ -1,5 +1,7 @@
package controllers
import "strings"
type BookController struct {
BaseController
}
@ -22,8 +24,17 @@ func (p *BookController) Users() {
p.TplName = "book/users.tpl"
}
func (p *BookController) Create() {
p.TplName = "book/create.tpl"
func (c *BookController) Create() {
if c.Ctx.Input.IsPost() {
book_name := strings.TrimSpace(c.GetString("book_name",""))
identify := strings.TrimSpace(c.GetString("identify",""))
description := strings.TrimSpace(c.GetString("description",""))
privately_owned := c.GetString("privately_owned")
comment_status := c.GetString("comment_status")
}
c.JsonResult(6001,"error")
}
// Edit 编辑项目.

View File

@ -7,3 +7,7 @@ type ManagerController struct {
func (p *ManagerController) Index() {
p.TplName = "manager/index.tpl"
}
func (p *ManagerController) Users() {
p.TplName = "manager/users.tpl"
}

View File

@ -1,13 +1,196 @@
package controllers
import (
"image"
"fmt"
"os"
"strings"
"image/jpeg"
"image/png"
"image/gif"
"path/filepath"
"strconv"
"time"
"io/ioutil"
"bytes"
"github.com/astaxie/beego/logs"
"github.com/lifei6671/godoc/models"
"github.com/lifei6671/godoc/utils"
)
type SettingController struct {
BaseController
}
func (p *SettingController) Index() {
p.TplName = "setting/index.tpl"
func (c *SettingController) Index() {
c.TplName = "setting/index.tpl"
if c.Ctx.Input.IsPost() {
email := strings.TrimSpace(c.GetString("email", ""))
phone := strings.TrimSpace(c.GetString("phone"))
description := strings.TrimSpace(c.GetString("description"))
if email == "" {
c.JsonResult(601, "邮箱不能为空")
}
member := c.Member
member.Email = email
member.Phone = phone
member.Description = description
if err := member.Update(); err != nil {
c.JsonResult(602, err.Error())
}
c.JsonResult(0, "ok")
}
}
func (p *SettingController) Password() {
p.TplName = "setting/password.tpl"
func (c *SettingController) Password() {
c.TplName = "setting/password.tpl"
if c.Ctx.Input.IsPost() {
password1 := c.GetString("password1")
password2 := c.GetString("password2")
password3 := c.GetString("password3")
if password1 == "" {
c.JsonResult(6003,"原密码不能为空")
}
if password2 == "" {
c.JsonResult(6004,"新密码不能为空")
}
if count := strings.Count(password2,""); count < 6 || count > 18 {
c.JsonResult(6009,"密码必须在6-18字之间")
}
if password2 != password3 {
c.JsonResult(6003,"确认密码不正确")
}
if ok,_ := utils.PasswordVerify(c.Member.Password,password1) ; !ok {
c.JsonResult(6005,"原始密码不正确")
}
if password1 == password2 {
c.JsonResult(6006,"新密码不能和原始密码相同")
}
pwd,err := utils.PasswordHash(password2)
if err != nil {
c.JsonResult(6007,"密码加密失败")
}
c.Member.Password = pwd
if err := c.Member.Update();err != nil {
c.JsonResult(6008,err.Error())
}
c.JsonResult(0,"ok")
}
}
// Upload 上传图片
func (c *SettingController) Upload() {
file,moreFile,err := c.GetFile("image-file")
defer file.Close()
if err != nil {
logs.Error("",err.Error())
c.JsonResult(500,"读取文件异常")
}
ext := filepath.Ext(moreFile.Filename)
if !strings.EqualFold(ext,".png") && !strings.EqualFold(ext,".jpg") && !strings.EqualFold(ext,".gif") && !strings.EqualFold(ext,".jpeg") {
c.JsonResult(500,"不支持的图片格式")
}
x1 ,_ := strconv.ParseFloat(c.GetString("x"),10)
y1 ,_ := strconv.ParseFloat(c.GetString("y"),10)
w1 ,_ := strconv.ParseFloat(c.GetString("width"),10)
h1 ,_ := strconv.ParseFloat(c.GetString("height"),10)
x := int(x1)
y := int(y1)
width := int(w1)
height := int(h1)
fmt.Println(x,x1,y,y1)
fileName := "avatar_" + strconv.FormatInt(int64(time.Now().Nanosecond()), 16)
filePath := "static/uploads/" + time.Now().Format("200601") + "/" + fileName + ext
path := filepath.Dir(filePath)
os.MkdirAll(path, os.ModePerm)
err = c.SaveToFile("image-file",filePath)
if err != nil {
logs.Error("",err)
c.JsonResult(500,"图片保存失败")
}
fileBytes,err := ioutil.ReadFile(filePath)
if err != nil {
logs.Error("",err)
c.JsonResult(500,"图片保存失败")
}
buf := bytes.NewBuffer(fileBytes)
m,_,err := image.Decode(buf)
if err != nil{
logs.Error("image.Decode => ",err)
c.JsonResult(500,"图片解码失败")
}
var subImg image.Image
if rgbImg,ok := m.(*image.YCbCr); ok {
subImg = rgbImg.SubImage(image.Rect(x, y, x+width, y+height)).(*image.YCbCr) //图片裁剪x0 y0 x1 y1
}else if rgbImg,ok := m.(*image.RGBA); ok {
subImg = rgbImg.SubImage(image.Rect(x, y, x+width, y+height)).(*image.YCbCr) //图片裁剪x0 y0 x1 y1
}else if rgbImg,ok := m.(*image.NRGBA); ok {
subImg = rgbImg.SubImage(image.Rect(x, y, x+width, y+height)).(*image.YCbCr) //图片裁剪x0 y0 x1 y1
} else {
fmt.Println(m)
c.JsonResult(500,"图片解码失败")
}
f, err := os.OpenFile("./" + filePath, os.O_SYNC | os.O_RDWR, 0666)
if err != nil{
c.JsonResult(500,"保存图片失败")
}
defer f.Close()
if strings.EqualFold(ext,".jpg") || strings.EqualFold(ext,".jpeg"){
err = jpeg.Encode(f,subImg,&jpeg.Options{ Quality : 100 })
}else if strings.EqualFold(ext,".png") {
err = png.Encode(f,subImg)
}else if strings.EqualFold(ext,".gif") {
err = gif.Encode(f,subImg,&gif.Options{ NumColors : 256})
}
if err != nil {
logs.Error("图片剪切失败 => ",err.Error())
c.JsonResult(500,"图片剪切失败")
}
if err != nil {
logs.Error("保存文件失败 => ",err.Error())
c.JsonResult(500,"保存文件失败")
}
url := "/" + filePath
member := models.NewMember()
if err := member.Find(c.Member.MemberId);err == nil {
member.Avatar = url
member.Update()
c.SetMember(*member)
}
c.JsonResult(0,"ok",url)
}

1
data/README.md 100644
View File

@ -0,0 +1 @@
## 搜索词库存放目录

589032
data/dictionary.txt 100644

File diff suppressed because it is too large Load Diff

1161
data/stop_tokens.txt 100644

File diff suppressed because it is too large Load Diff

3
docs/README.md 100644
View File

@ -0,0 +1,3 @@
## 文档缓存目录
文档在发布后会自动缓存到该目录。如果使用nginx代理可不经过 MinDoc 即可访问文档。也可以拷贝出去当成单独项目使用。

1
logs/README.md 100644
View File

@ -0,0 +1 @@
## 日志存放目录

View File

@ -1,11 +1,20 @@
package main
import (
_ "github.com/go-sql-driver/mysql"
_ "github.com/lifei6671/godoc/routers"
"github.com/astaxie/beego"
"github.com/lifei6671/godoc/commands"
)
func main() {
commands.RegisterDataBase()
commands.RegisterModel()
commands.RegisterLogger()
commands.RegisterCommand()
commands.RegisterFunction()
beego.SetStaticPath("uploads","uploads")
beego.Run()
}

39
models/book.go 100644
View File

@ -0,0 +1,39 @@
package models
import "time"
// Book struct .
type Book struct {
BookId int `orm:"pk;auto;unique;column(book_id)" json:"book_id"`
// BookName 项目名称.
BookName string `orm:"column(book_name);size(500)" json:"book_name"`
// Identify 项目唯一标识.
Identify string `orm:"column(identify);size(100);unique" json:"identify"`
// Description 项目描述.
Description string `orm:"column(description);size(2000)" json:"description"`
// PrivatelyOwned 项目私有: 0 公开/ 1 私有
PrivatelyOwned int `orm:"column(privately_owned);type(int);default(0)" json:"privately_owned"`
// 当项目是私有时的访问Token.
PrivateToken string `orm:"column(private_token);size(500)" json:"private_token"`
// DocCount 包含文档数量.
DocCount int `orm:"column(doc_count);type(int)" json:"doc_count"`
// CommentStatus 评论设置的状态:open为允许所有人评论closed为不允许评论, group_only 仅允许参与者评论 ,registered_only 仅允许注册者评论.
CommentStatus string `orm:"column(comment_status);size(20);default(open)" json:"comment_status"`
CommentCount int `orm:"column(comment_count);type(int)" json:"comment_count"`
// CreateTime 创建时间 .
CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add"`
MemberId int `orm:"column(member_id);size(100)" json:"member_id"`
ModifyTime time.Time `orm:"type(datetime);column(modify_time);null;auto_now" json:"modify_time"`
Version int64 `orm:"type(bigint);column(version)" json:"version"`
}
// TableName 获取对应数据库表名.
func (m *Book) TableName() string {
return "books"
}
// TableEngine 获取数据使用的引擎.
func (m *Book) TableEngine() string {
return "INNODB"
}

36
models/comment.go 100644
View File

@ -0,0 +1,36 @@
package models
import "time"
//Comment struct
type Comment struct {
CommentId int `orm:"pk;auto;unique;column(comment_id)" json:"comment_id"`
// DocumentId 评论所属的文档.
DocumentId int `orm:"column(document_id);type(int)" json:"document_id"`
// Author 评论作者.
Author string `orm:"column(author);size(100)" json:"author"`
//MemberId 评论用户ID.
MemberId int `orm:"column(member_id);type(int)" json:"member_id"`
// IPAddress 评论者的IP地址
IPAddress string `orm:"column(ip_address);size(100)" json:"ip_address"`
// 评论日期.
CommentDate time.Time `orm:"type(datetime);column(comment_date);auto_now_add" json:"comment_date"`
//Content 评论内容.
Content string `orm:"column(content);size(2000)" json:"content"`
// Approved 评论状态0 待审核/1 已审核/2 垃圾评论
Approved int `orm:"column(approved);type(int)" json:"approved"`
// UserAgent 评论者浏览器内容
UserAgent string `orm:"column(user_agent);size(500)" json:"user_agent"`
// Parent 评论所属父级
ParentId int `orm:"column(parent_id);type(int);default(0)" json:"parent_id"`
}
// TableName 获取对应数据库表名.
func (m *Comment) TableName() string {
return "comments"
}
// TableEngine 获取数据使用的引擎.
func (m *Comment) TableEngine() string {
return "INNODB"
}

34
models/document.go 100644
View File

@ -0,0 +1,34 @@
package models
import "time"
// Document struct.
type Document struct {
DocumentId int `orm:"pk;auto;unique;column(document_id)" json:"document_id"`
DocumentName string `orm:"column(document_name);size(500)" json:"document_name"`
// Identify 文档唯一标识
Identify string `orm:"column(identify);size(100);unique" json:"identify"`
BookId int `orm:"column(book_id);type(int);index" json:"book_id"`
OrderSort int `orm:"column(order_sort);default(0);type(int)" json:"order_sort"`
// Markdown markdown格式文档.
Markdown string `orm:"column(markdown);type(longtext)" json:"markdown"`
// Release 发布后的Html格式内容.
Release string `orm:"column(release);type(longtext)" json:"release"`
// Content 未发布的 Html 格式内容.
Content string `orm:"column(content);type(longtext)" json:"content"`
CreateTime time.Time `orm:"column(create_time);type(datetime)" json:"create_time"`
CreateAt int `orm:"column(create_at);type(int)" json:"create_at"`
ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"`
ModifyAt int `orm:"column(modify_at);type(int)" json:"modify_at"`
Version int64 `orm:"type(bigint);column(version)" json:"version"`
}
// TableName 获取对应数据库表名.
func (m *Document) TableName() string {
return "documents"
}
// TableEngine 获取数据使用的引擎.
func (m *Document) TableEngine() string {
return "INNODB"
}

16
models/errors.go 100644
View File

@ -0,0 +1,16 @@
// Package models 为项目所需的模型对象定义.
package models
import "errors"
var(
// ErrMemberNoExist 用户不存在.
ErrMemberNoExist = errors.New("用户不存在")
// ErrorMemberPasswordError 密码错误.
ErrorMemberPasswordError = errors.New("用户密码错误")
// ErrServerAlreadyExist 指定的服务已存在.
ErrServerAlreadyExist = errors.New("服务已存在")
// ErrInvalidParameter 参数错误.
ErrInvalidParameter = errors.New("Invalid parameter")
)

View File

@ -1,6 +1,97 @@
// Package models .
package models
type Member struct {
import (
"time"
"github.com/astaxie/beego/orm"
"github.com/lifei6671/godoc/utils"
)
type Member struct {
MemberId int `orm:"pk;auto;unique;column(member_id)"`
Account string `orm:"size(100);unique;column(account)"`
Password string `orm:"size(1000);column(password)"`
Description string `orm:"column(description);size(2000)" json:"description"`
Email string `orm:"size(255);column(email);null;default(null)"`
Phone string `orm:"size(255);column(phone);null;default(null)"`
Avatar string `orm:"size(1000);column(avatar)"`
Role int `orm:"column(role);type(int);default(1);index"` //用户角色0 管理员/ 1 普通用户
Status int `orm:"column(status);type(int);default(0)"` //用户状态0 正常/1 禁用
CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add"`
CreateAt int `orm:"type(int);column(create_at)"`
LastLoginTime time.Time `orm:"type(datetime);column(last_login_time);null"`
}
// TableName 获取对应数据库表名.
func (m *Member) TableName() string {
return "members"
}
// TableEngine 获取数据使用的引擎.
func (m *Member) TableEngine() string {
return "INNODB"
}
func NewMember() *Member {
return &Member{}
}
// Login 用户登录.
func (m *Member) Login(account string,password string) (*Member,error) {
o := orm.NewOrm()
member := &Member{}
err := o.QueryTable("md_" + m.TableName()).Filter("account",account).Filter("status",0).One(member);
if err != nil {
return member,ErrMemberNoExist
}
ok,err := utils.PasswordVerify(member.Password,password) ;
if ok && err == nil {
return member,nil
}
return member,ErrorMemberPasswordError
}
// Add 添加一个用户.
func (member *Member) Add () (error) {
o := orm.NewOrm()
hash ,err := utils.PasswordHash(member.Password);
if err != nil {
return err
}
member.Password = hash
_,err = o.Insert(member)
if err != nil {
return err
}
return nil
}
// Update 更新用户信息.
func (m *Member) Update(cols... string) (error) {
o := orm.NewOrm()
if _,err := o.Update(m,cols...);err != nil {
return err
}
return nil
}
func (m *Member) Find(id int) error{
o := orm.NewOrm()
m.MemberId = id
if err := o.Read(m); err != nil {
return err
}
return nil
}

92
models/options.go 100644
View File

@ -0,0 +1,92 @@
package models
import (
"github.com/astaxie/beego/orm"
"github.com/lifei6671/godoc/conf"
)
// Option struct .
type Option struct {
OptionId int `orm:"pk;auto;unique;column(option_id)" json:"option_id"`
OptionTitle string `orm:"column(option_title);size(500)" json:"option_title"`
OptionName string `orm:"column(option_name);unique;size(80)" json:"option_name"`
OptionValue string `orm:"column(option_value);type(text);null" json:"option_value"`
Remark string `orm:"column(remark);type(text);null" json:"remark"`
}
// TableName 获取对应数据库表名.
func (m *Option) TableName() string {
return "options"
}
// TableEngine 获取数据使用的引擎.
func (m *Option) TableEngine() string {
return "INNODB"
}
func NewOption() *Option {
return &Option{}
}
func (p *Option) Find(id int) error {
o := orm.NewOrm()
p.OptionId = id
if err := o.Read(p);err != nil {
return err
}
return nil
}
func (p *Option) FindByKey(key string) error {
o := orm.NewOrm()
p.OptionName = key
if err := o.Read(p);err != nil {
return err
}
return nil
}
func GetOptionValue(key, def string) string {
option := NewOption()
if err := option.FindByKey(key); err == nil {
return option.OptionValue
}
return def
}
func (p *Option) InsertOrUpdate() error {
o := orm.NewOrm()
var err error
if p.OptionId > 0 {
_,err = o.Update(o)
}else{
_,err = o.Insert(p)
}
return err
}
func (p *Option) InsertMulti(option... Option ) (error){
o := orm.NewOrm()
_,err := o.InsertMulti(len(option),option)
return err
}
func (p *Option) All() ([]Option,error) {
o := orm.NewOrm()
var options []Option
_,err := o.QueryTable(conf.GetDatabasePrefix() + p.TableName()).All(&options)
if err != nil {
return options,err
}
return options,nil
}

View File

@ -0,0 +1,26 @@
package models
type Relationship struct {
RelationshipId int `orm:"pk;auto;unique;column(relationship_id)" json:"relationship_id"`
MemberId int `orm:"column(member_id);type(int)" json:"member_id"`
BookId int `orm:"column(book_id);type(int)" json:"book_id"`
// RoleId 角色0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者
RoleId int `orm:"column(role_id);type(int)" json:"role_id"`
}
// TableName 获取对应数据库表名.
func (m *Relationship) TableName() string {
return "relationship"
}
// TableEngine 获取数据使用的引擎.
func (m *Relationship) TableEngine() string {
return "INNODB"
}
// 联合唯一键
func (u *Relationship) TableUnique() [][]string {
return [][]string{
[]string{"MemberId", "BookId"},
}
}

View File

@ -8,10 +8,17 @@ import (
func init() {
beego.Router("/",&controllers.HomeController{},"*:Index")
beego.Router("/login", &controllers.AccountController{},"*:Login")
beego.Router("/logout", &controllers.AccountController{},"*:Logout")
beego.Router("/register", &controllers.AccountController{},"*:Register")
beego.Router("/find_password", &controllers.AccountController{},"*:FindPassword")
beego.Router("/manager", &controllers.ManagerController{},"*:Index")
beego.Router("/manager/users", &controllers.ManagerController{},"*:Users")
beego.Router("/setting", &controllers.SettingController{},"*:Index")
beego.Router("/setting/password", &controllers.SettingController{},"*:Password")
beego.Router("/setting/upload", &controllers.SettingController{},"*:Upload")
beego.Router("/book", &controllers.BookController{},"*:Index")
beego.Router("/book/:key/dashboard", &controllers.BookController{},"*:Dashboard")

18
search/search.go 100644
View File

@ -0,0 +1,18 @@
package search
import (
"github.com/huichen/wukong/engine"
"github.com/huichen/wukong/types"
)
var searcher engine.Engine
func init() {
searcher.Init(types.EngineInitOptions{
SegmenterDictionaries: "data/dictionary.txt",
StopTokenFile: "data/stop_tokens.txt",
IndexerInitOptions: &types.IndexerInitOptions{
IndexType: types.LocationsIndex,
},
})
}

View File

@ -0,0 +1,375 @@
/*!
* Cropper v2.3.4
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2014-2016 Fengyuan Chen and contributors
* Released under the MIT license
*
* Date: 2016-09-03T05:50:45.412Z
*/
.cropper-container {
font-size: 0;
line-height: 0;
position: relative;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
direction: ltr !important;
}
.cropper-container img {
display: block;
width: 100%;
min-width: 0 !important;
max-width: none !important;
height: 100%;
min-height: 0 !important;
max-height: none !important;
image-orientation: 0deg !important;
}
.cropper-wrap-box,
.cropper-canvas,
.cropper-drag-box,
.cropper-crop-box,
.cropper-modal {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.cropper-wrap-box {
overflow: hidden;
}
.cropper-drag-box {
opacity: 0;
background-color: #fff;
filter: alpha(opacity=0);
}
.cropper-modal {
opacity: .5;
background-color: #000;
filter: alpha(opacity=50);
}
.cropper-view-box {
display: block;
overflow: hidden;
width: 100%;
height: 100%;
outline: 1px solid #39f;
outline-color: rgba(51, 153, 255, .75);
}
.cropper-dashed {
position: absolute;
display: block;
opacity: .5;
border: 0 dashed #eee;
filter: alpha(opacity=50);
}
.cropper-dashed.dashed-h {
top: 33.33333%;
left: 0;
width: 100%;
height: 33.33333%;
border-top-width: 1px;
border-bottom-width: 1px;
}
.cropper-dashed.dashed-v {
top: 0;
left: 33.33333%;
width: 33.33333%;
height: 100%;
border-right-width: 1px;
border-left-width: 1px;
}
.cropper-center {
position: absolute;
top: 50%;
left: 50%;
display: block;
width: 0;
height: 0;
opacity: .75;
filter: alpha(opacity=75);
}
.cropper-center:before,
.cropper-center:after {
position: absolute;
display: block;
content: ' ';
background-color: #eee;
}
.cropper-center:before {
top: 0;
left: -3px;
width: 7px;
height: 1px;
}
.cropper-center:after {
top: -3px;
left: 0;
width: 1px;
height: 7px;
}
.cropper-face,
.cropper-line,
.cropper-point {
position: absolute;
display: block;
width: 100%;
height: 100%;
opacity: .1;
filter: alpha(opacity=10);
}
.cropper-face {
top: 0;
left: 0;
background-color: #fff;
}
.cropper-line {
background-color: #39f;
}
.cropper-line.line-e {
top: 0;
right: -3px;
width: 5px;
cursor: e-resize;
}
.cropper-line.line-n {
top: -3px;
left: 0;
height: 5px;
cursor: n-resize;
}
.cropper-line.line-w {
top: 0;
left: -3px;
width: 5px;
cursor: w-resize;
}
.cropper-line.line-s {
bottom: -3px;
left: 0;
height: 5px;
cursor: s-resize;
}
.cropper-point {
width: 5px;
height: 5px;
opacity: .75;
background-color: #39f;
filter: alpha(opacity=75);
}
.cropper-point.point-e {
top: 50%;
right: -3px;
margin-top: -3px;
cursor: e-resize;
}
.cropper-point.point-n {
top: -3px;
left: 50%;
margin-left: -3px;
cursor: n-resize;
}
.cropper-point.point-w {
top: 50%;
left: -3px;
margin-top: -3px;
cursor: w-resize;
}
.cropper-point.point-s {
bottom: -3px;
left: 50%;
margin-left: -3px;
cursor: s-resize;
}
.cropper-point.point-ne {
top: -3px;
right: -3px;
cursor: ne-resize;
}
.cropper-point.point-nw {
top: -3px;
left: -3px;
cursor: nw-resize;
}
.cropper-point.point-sw {
bottom: -3px;
left: -3px;
cursor: sw-resize;
}
.cropper-point.point-se {
right: -3px;
bottom: -3px;
width: 20px;
height: 20px;
cursor: se-resize;
opacity: 1;
filter: alpha(opacity=100);
}
.cropper-point.point-se:before {
position: absolute;
right: -50%;
bottom: -50%;
display: block;
width: 200%;
height: 200%;
content: ' ';
opacity: 0;
background-color: #39f;
filter: alpha(opacity=0);
}
@media (min-width: 768px) {
.cropper-point.point-se {
width: 15px;
height: 15px;
}
}
@media (min-width: 992px) {
.cropper-point.point-se {
width: 10px;
height: 10px;
}
}
@media (min-width: 1200px) {
.cropper-point.point-se {
width: 5px;
height: 5px;
opacity: .75;
filter: alpha(opacity=75);
}
}
.cropper-invisible {
opacity: 0;
filter: alpha(opacity=0);
}
.cropper-bg {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC');
}
.cropper-hide {
position: absolute;
display: block;
width: 0;
height: 0;
}
.cropper-hidden {
display: none !important;
}
.cropper-move {
cursor: move;
}
.cropper-crop {
cursor: crosshair;
}
.cropper-disabled .cropper-drag-box,
.cropper-disabled .cropper-face,
.cropper-disabled .cropper-line,
.cropper-disabled .cropper-point {
cursor: not-allowed;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
/*!
* Cropper v2.3.4
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2014-2016 Fengyuan Chen and contributors
* Released under the MIT license
*
* Date: 2016-09-03T05:50:45.412Z
*/.cropper-container{font-size:0;line-height:0;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;direction:ltr!important}.cropper-container img{display:block;width:100%;min-width:0!important;max-width:none!important;height:100%;min-height:0!important;max-height:none!important;image-orientation:0deg!important}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{position:absolute;top:0;right:0;bottom:0;left:0}.cropper-wrap-box{overflow:hidden}.cropper-drag-box{opacity:0;background-color:#fff;filter:alpha(opacity=0)}.cropper-dashed,.cropper-modal{opacity:.5;filter:alpha(opacity=50)}.cropper-modal{background-color:#000}.cropper-view-box{display:block;overflow:hidden;width:100%;height:100%;outline:#39f solid 1px;outline-color:rgba(51,153,255,.75)}.cropper-dashed{position:absolute;display:block;border:0 dashed #eee}.cropper-dashed.dashed-h{top:33.33333%;left:0;width:100%;height:33.33333%;border-top-width:1px;border-bottom-width:1px}.cropper-dashed.dashed-v{top:0;left:33.33333%;width:33.33333%;height:100%;border-right-width:1px;border-left-width:1px}.cropper-center{position:absolute;top:50%;left:50%;display:block;width:0;height:0;opacity:.75;filter:alpha(opacity=75)}.cropper-center:after,.cropper-center:before{position:absolute;display:block;content:' ';background-color:#eee}.cropper-center:before{top:0;left:-3px;width:7px;height:1px}.cropper-center:after{top:-3px;left:0;width:1px;height:7px}.cropper-face,.cropper-line,.cropper-point{position:absolute;display:block;width:100%;height:100%;opacity:.1;filter:alpha(opacity=10)}.cropper-face{top:0;left:0;background-color:#fff}.cropper-line,.cropper-point{background-color:#39f}.cropper-line.line-e{top:0;right:-3px;width:5px;cursor:e-resize}.cropper-line.line-n{top:-3px;left:0;height:5px;cursor:n-resize}.cropper-line.line-w{top:0;left:-3px;width:5px;cursor:w-resize}.cropper-line.line-s{bottom:-3px;left:0;height:5px;cursor:s-resize}.cropper-point{width:5px;height:5px;opacity:.75;filter:alpha(opacity=75)}.cropper-point.point-e{top:50%;right:-3px;margin-top:-3px;cursor:e-resize}.cropper-point.point-n{top:-3px;left:50%;margin-left:-3px;cursor:n-resize}.cropper-point.point-w{top:50%;left:-3px;margin-top:-3px;cursor:w-resize}.cropper-point.point-s{bottom:-3px;left:50%;margin-left:-3px;cursor:s-resize}.cropper-point.point-ne{top:-3px;right:-3px;cursor:ne-resize}.cropper-point.point-nw{top:-3px;left:-3px;cursor:nw-resize}.cropper-point.point-sw{bottom:-3px;left:-3px;cursor:sw-resize}.cropper-point.point-se{right:-3px;bottom:-3px;width:20px;height:20px;cursor:se-resize;opacity:1;filter:alpha(opacity=100)}.cropper-point.point-se:before{position:absolute;right:-50%;bottom:-50%;display:block;width:200%;height:200%;content:' ';opacity:0;background-color:#39f;filter:alpha(opacity=0)}@media (min-width:768px){.cropper-point.point-se{width:15px;height:15px}}@media (min-width:992px){.cropper-point.point-se{width:10px;height:10px}}@media (min-width:1200px){.cropper-point.point-se{width:5px;height:5px;opacity:.75;filter:alpha(opacity=75)}}.cropper-invisible{opacity:0;filter:alpha(opacity=0)}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-hide{position:absolute;display:block;width:0;height:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}

File diff suppressed because one or more lines are too long

View File

@ -12,6 +12,20 @@ a:hover{
textarea{
resize: none;
}
.text{
font-size: 12px;
color: #999999;
font-weight: 200;
}
.error-message{
color: red;
font-size: 12px;
}
.success-message{
color: green;
font-size: 12px;
}
::-webkit-scrollbar , body .scrollbar-track-color{
height: 9px;
width: 7px;
@ -176,7 +190,7 @@ textarea{
.manual-list .list-item .manual-item-standard>dt{
margin-bottom: 6px;
height: 231px;
position: relative
position: relative;
}
.manual-list .list-item .manual-item-standard .cover {
border: 1px solid #f3f3f3;
@ -275,7 +289,101 @@ textarea{
.users-list .list-item .operate{
float: right;
}
/***************************************/
/**************用户登录界面样式*******************/
.login .login-body{
width: 370px;
padding: 5px 30px 25px 30px;
margin: 0 auto;
margin-top: 30px;
background-color: #FFF;
border: 1px solid #ddd;
border-radius: 5px;
}
.login .login-body .tooltip.bottom .tooltip-arrow,.has-error .tooltip.bottom .tooltip-arrow{
border-bottom-color: #a94442;
}
.login .login-body .tooltip.top .tooltip-arrow,.has-error .tooltip.top .tooltip-arrow{
border-top-color: #a94442;
}
.login .login-body .tooltip.right .tooltip-arrow,.has-error .tooltip.right .tooltip-arrow{
border-top-color: #a94442;
}
.login .login-body .tooltip.left .tooltip-arrow,.has-error .tooltip.left .tooltip-arrow{
border-top-color: #a94442;
}
.login .login-body .tooltip-inner,.has-error .tooltip-inner{
background-color: #a94442;
}
/************图片上传样式*******************/
#upload-logo-panel .wraper{
float: left;
background: #f6f6f6;
position: relative;
width: 360px;
height: 360px;
overflow: hidden;
}
#upload-logo-panel .watch-crop-list{
width: 170px;
padding:10px 20px;
margin-left: 10px;
background-color: #f6f6f6;
text-align: center;
float: right;
height: 360px;
}
#image-wraper{
text-align: center;
}
.webuploader-pick{
}
.webuploader-pick-hover{
}
.webuploader-container{
padding: 0;
border: 0;
height: 40px;
}
.watch-crop-list>ul{
list-style: none;
padding: 0;
margin: 0;
}
.webuploader-container div{
width: 77px !important;
height: 40px !important;
left: 0 !important;
}
.img-preview {
margin: 5px auto 10px auto;
text-align: center;
overflow: hidden;
}
.img-preview > img {
max-width: 100%;
}
.preview-lg{
width: 120px;
height: 120px;
}
.preview-sm{
width: 60px;
height: 60px;
}
#error-message{
font-size: 13px;
color: red;
vertical-align: middle;
margin-top: -10px;
display: inline-block;
height: 40px;
}
/**************网站底部样式*************************/
.footer{
color: #777;
padding: 30px 0;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(e){"use strict";function t(){"complete"===document.readyState?n():e.addEventListener("DOMContentLoaded",n)}function n(){try{var e=document.querySelectorAll("code.hljs");for(var t in e)e.hasOwnProperty(t)&&r(e[t])}catch(n){console.error("LineNumbers error: ",n)}}function r(e){if("object"==typeof e){var t=e.parentNode,n=o(t.textContent);if(n>1){for(var r="",c=0;n>c;c++)r+=c+1+"\n";var l=document.createElement("code");l.className="hljs hljs-line-numbers",l.style["float"]="left",l.textContent=r,t.insertBefore(l,e)}}}function o(e){if(0===e.length)return 0;var t=/\r\n|\r|\n/g,n=e.match(t);return n=n?n.length:0,e[e.length-1].match(t)||(n+=1),n}"undefined"==typeof e.hljs?console.error("highlight.js not detected!"):(e.hljs.initLineNumbersOnLoad=t,e.hljs.lineNumbersBlock=r)}(window);

View File

@ -0,0 +1,85 @@
/*
Language: 1C
Author: Yuri Ivanov <ivanov@supersoft.ru>
Contributors: Sergey Baranov <segyrn@yandex.ru>
Category: enterprise
*/
function(hljs){
var IDENT_RE_RU = '[a-zA-Zа-яА-Я][a-zA-Z0-9_а-яА-Я]*';
var OneS_KEYWORDS = 'возврат дата для если и или иначе иначеесли исключение конецесли ' +
'конецпопытки конецпроцедуры конецфункции конеццикла константа не перейти перем ' +
'перечисление по пока попытка прервать продолжить процедура строка тогда фс функция цикл ' +
'число экспорт';
var OneS_BUILT_IN = 'ansitooem oemtoansi ввестивидсубконто ввестидату ввестизначение ' +
'ввестиперечисление ввестипериод ввестиплансчетов ввестистроку ввестичисло вопрос ' +
'восстановитьзначение врег выбранныйплансчетов вызватьисключение датагод датамесяц ' +
'датачисло добавитьмесяц завершитьработусистемы заголовоксистемы записьжурналарегистрации ' +
'запуститьприложение зафиксироватьтранзакцию значениевстроку значениевстрокувнутр ' +
'значениевфайл значениеизстроки значениеизстрокивнутр значениеизфайла имякомпьютера ' +
'имяпользователя каталогвременныхфайлов каталогиб каталогпользователя каталогпрограммы ' +
'кодсимв командасистемы конгода конецпериодаби конецрассчитанногопериодаби ' +
'конецстандартногоинтервала конквартала конмесяца коннедели лев лог лог10 макс ' +
'максимальноеколичествосубконто мин монопольныйрежим названиеинтерфейса названиенабораправ ' +
'назначитьвид назначитьсчет найти найтипомеченныенаудаление найтиссылки началопериодаби ' +
'началостандартногоинтервала начатьтранзакцию начгода начквартала начмесяца начнедели ' +
'номерднягода номерднянедели номернеделигода нрег обработкаожидания окр описаниеошибки ' +
'основнойжурналрасчетов основнойплансчетов основнойязык открытьформу открытьформумодально ' +
'отменитьтранзакцию очиститьокносообщений периодстр полноеимяпользователя получитьвремята ' +
'получитьдатута получитьдокументта получитьзначенияотбора получитьпозициюта ' +
'получитьпустоезначение получитьта прав праводоступа предупреждение префиксавтонумерации ' +
'пустаястрока пустоезначение рабочаядаттьпустоезначение рабочаядата разделительстраниц ' +
'разделительстрок разм разобратьпозициюдокумента рассчитатьрегистрына ' +
'рассчитатьрегистрыпо сигнал симв символтабуляции создатьобъект сокрл сокрлп сокрп ' +
'сообщить состояние сохранитьзначение сред статусвозврата стрдлина стрзаменить ' +
'стрколичествострок стрполучитьстроку стрчисловхождений сформироватьпозициюдокумента ' +
'счетпокоду текущаядата текущеевремя типзначения типзначениястр удалитьобъекты ' +
'установитьтана установитьтапо фиксшаблон формат цел шаблон';
var DQUOTE = {begin: '""'};
var STR_START = {
className: 'string',
begin: '"', end: '"|$',
contains: [DQUOTE]
};
var STR_CONT = {
className: 'string',
begin: '\\|', end: '"|$',
contains: [DQUOTE]
};
return {
case_insensitive: true,
lexemes: IDENT_RE_RU,
keywords: {keyword: OneS_KEYWORDS, built_in: OneS_BUILT_IN},
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.NUMBER_MODE,
STR_START, STR_CONT,
{
className: 'function',
begin: '(процедура|функция)', end: '$',
lexemes: IDENT_RE_RU,
keywords: 'процедура функция',
contains: [
{
begin: 'экспорт', endsWithParent: true,
lexemes: IDENT_RE_RU,
keywords: 'экспорт',
contains: [hljs.C_LINE_COMMENT_MODE]
},
{
className: 'params',
begin: '\\(', end: '\\)',
lexemes: IDENT_RE_RU,
keywords: 'знач',
contains: [STR_START, STR_CONT]
},
hljs.C_LINE_COMMENT_MODE,
hljs.inherit(hljs.TITLE_MODE, {begin: IDENT_RE_RU})
]
},
{className: 'meta', begin: '#', end: '$'},
{className: 'number', begin: '\'\\d{2}\\.\\d{2}\\.(\\d{2}|\\d{4})\''} // date
]
};
}

View File

@ -0,0 +1,75 @@
/*
Language: Augmented Backus-Naur Form
Author: Alex McKibben <alex@nullscope.net>
*/
function(hljs) {
var regexes = {
ruleDeclaration: "^[a-zA-Z][a-zA-Z0-9-]*",
unexpectedChars: "[!@#$^&',?+~`|:]"
};
var keywords = [
"ALPHA",
"BIT",
"CHAR",
"CR",
"CRLF",
"CTL",
"DIGIT",
"DQUOTE",
"HEXDIG",
"HTAB",
"LF",
"LWSP",
"OCTET",
"SP",
"VCHAR",
"WSP"
];
var commentMode = hljs.COMMENT(";", "$");
var terminalBinaryMode = {
className: "symbol",
begin: /%b[0-1]+(-[0-1]+|(\.[0-1]+)+){0,1}/
};
var terminalDecimalMode = {
className: "symbol",
begin: /%d[0-9]+(-[0-9]+|(\.[0-9]+)+){0,1}/
};
var terminalHexadecimalMode = {
className: "symbol",
begin: /%x[0-9A-F]+(-[0-9A-F]+|(\.[0-9A-F]+)+){0,1}/,
};
var caseSensitivityIndicatorMode = {
className: "symbol",
begin: /%[si]/
};
var ruleDeclarationMode = {
begin: regexes.ruleDeclaration + '\\s*=',
returnBegin: true,
end: /=/,
relevance: 0,
contains: [{className: "attribute", begin: regexes.ruleDeclaration}]
};
return {
illegal: regexes.unexpectedChars,
keywords: keywords.join(" "),
contains: [
ruleDeclarationMode,
commentMode,
terminalBinaryMode,
terminalDecimalMode,
terminalHexadecimalMode,
caseSensitivityIndicatorMode,
hljs.QUOTE_STRING_MODE,
hljs.NUMBER_MODE
]
};
}

View File

@ -0,0 +1,43 @@
/*
Language: Access log
Author: Oleg Efimov <efimovov@gmail.com>
Description: Apache/Nginx Access Logs
*/
function(hljs) {
return {
contains: [
// IP
{
className: 'number',
begin: '\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b'
},
// Other numbers
{
className: 'number',
begin: '\\b\\d+\\b',
relevance: 0
},
// Requests
{
className: 'string',
begin: '"(GET|POST|HEAD|PUT|DELETE|CONNECT|OPTIONS|PATCH|TRACE)', end: '"',
keywords: 'GET POST HEAD PUT DELETE CONNECT OPTIONS PATCH TRACE',
illegal: '\\n',
relevance: 10
},
// Dates
{
className: 'string',
begin: /\[/, end: /\]/,
illegal: '\\n'
},
// Strings
{
className: 'string',
begin: '"', end: '"',
illegal: '\\n'
}
]
};
}

View File

@ -0,0 +1,79 @@
/*
Language: ActionScript
Author: Alexander Myadzel <myadzel@gmail.com>
Category: scripting
*/
function(hljs) {
var IDENT_RE = '[a-zA-Z_$][a-zA-Z0-9_$]*';
var IDENT_FUNC_RETURN_TYPE_RE = '([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)';
var AS3_REST_ARG_MODE = {
className: 'rest_arg',
begin: '[.]{3}', end: IDENT_RE,
relevance: 10
};
return {
aliases: ['as'],
keywords: {
keyword: 'as break case catch class const continue default delete do dynamic each ' +
'else extends final finally for function get if implements import in include ' +
'instanceof interface internal is namespace native new override package private ' +
'protected public return set static super switch this throw try typeof use var void ' +
'while with',
literal: 'true false null undefined'
},
contains: [
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.C_NUMBER_MODE,
{
className: 'class',
beginKeywords: 'package', end: '{',
contains: [hljs.TITLE_MODE]
},
{
className: 'class',
beginKeywords: 'class interface', end: '{', excludeEnd: true,
contains: [
{
beginKeywords: 'extends implements'
},
hljs.TITLE_MODE
]
},
{
className: 'meta',
beginKeywords: 'import include', end: ';',
keywords: {'meta-keyword': 'import include'}
},
{
className: 'function',
beginKeywords: 'function', end: '[{;]', excludeEnd: true,
illegal: '\\S',
contains: [
hljs.TITLE_MODE,
{
className: 'params',
begin: '\\(', end: '\\)',
contains: [
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
AS3_REST_ARG_MODE
]
},
{
begin: ':\\s*' + IDENT_FUNC_RETURN_TYPE_RE
}
]
},
hljs.METHOD_GUARD
],
illegal: /#/
};
}

View File

@ -0,0 +1,181 @@
/*
Language: Ada
Author: Lars Schulna <kartoffelbrei.mit.muskatnuss@gmail.org>
Description: Ada is a general-purpose programming language that has great support for saftey critical and real-time applications.
It has been developed by the DoD and thus has been used in military and safety-critical applications (like civil aviation).
The first version appeared in the 80s, but it's still actively developed today with
the newest standard being Ada2012.
*/
// We try to support full Ada2012
//
// We highlight all appearances of types, keywords, literals (string, char, number, bool)
// and titles (user defined function/procedure/package)
// CSS classes are set accordingly
//
// Languages causing problems for language detection:
// xml (broken by Foo : Bar type), elm (broken by Foo : Bar type), vbscript-html (broken by body keyword)
// sql (ada default.txt has a lot of sql keywords)
function(hljs) {
// Regular expression for Ada numeric literals.
// stolen form the VHDL highlighter
// Decimal literal:
var INTEGER_RE = '\\d(_|\\d)*';
var EXPONENT_RE = '[eE][-+]?' + INTEGER_RE;
var DECIMAL_LITERAL_RE = INTEGER_RE + '(\\.' + INTEGER_RE + ')?' + '(' + EXPONENT_RE + ')?';
// Based literal:
var BASED_INTEGER_RE = '\\w+';
var BASED_LITERAL_RE = INTEGER_RE + '#' + BASED_INTEGER_RE + '(\\.' + BASED_INTEGER_RE + ')?' + '#' + '(' + EXPONENT_RE + ')?';
var NUMBER_RE = '\\b(' + BASED_LITERAL_RE + '|' + DECIMAL_LITERAL_RE + ')';
// Identifier regex
var ID_REGEX = '[A-Za-z](_?[A-Za-z0-9.])*';
// bad chars, only allowed in literals
var BAD_CHARS = '[]{}%#\'\"'
// Ada doesn't have block comments, only line comments
var COMMENTS = hljs.COMMENT('--', '$');
// variable declarations of the form
// Foo : Bar := Baz;
// where only Bar will be highlighted
var VAR_DECLS = {
// TODO: These spaces are not required by the Ada syntax
// however, I have yet to see handwritten Ada code where
// someone does not put spaces around :
begin: '\\s+:\\s+', end: '\\s*(:=|;|\\)|=>|$)',
// endsWithParent: true,
// returnBegin: true,
illegal: BAD_CHARS,
contains: [
{
// workaround to avoid highlighting
// named loops and declare blocks
beginKeywords: 'loop for declare others',
endsParent: true,
},
{
// properly highlight all modifiers
className: 'keyword',
beginKeywords: 'not null constant access function procedure in out aliased exception'
},
{
className: 'type',
begin: ID_REGEX,
endsParent: true,
relevance: 0,
}
]
};
return {
case_insensitive: true,
keywords: {
keyword:
'abort else new return abs elsif not reverse abstract end ' +
'accept entry select access exception of separate aliased exit or some ' +
'all others subtype and for out synchronized array function overriding ' +
'at tagged generic package task begin goto pragma terminate ' +
'body private then if procedure type case in protected constant interface ' +
'is raise use declare range delay limited record when delta loop rem while ' +
'digits renames with do mod requeue xor',
literal:
'True False',
},
contains: [
COMMENTS,
// strings "foobar"
{
className: 'string',
begin: /"/, end: /"/,
contains: [{begin: /""/, relevance: 0}]
},
// characters ''
{
// character literals always contain one char
className: 'string',
begin: /'.'/
},
{
// number literals
className: 'number',
begin: NUMBER_RE,
relevance: 0
},
{
// Attributes
className: 'symbol',
begin: "'" + ID_REGEX,
},
{
// package definition, maybe inside generic
className: 'title',
begin: '(\\bwith\\s+)?(\\bprivate\\s+)?\\bpackage\\s+(\\bbody\\s+)?', end: '(is|$)',
keywords: 'package body',
excludeBegin: true,
excludeEnd: true,
illegal: BAD_CHARS
},
{
// function/procedure declaration/definition
// maybe inside generic
begin: '(\\b(with|overriding)\\s+)?\\b(function|procedure)\\s+', end: '(\\bis|\\bwith|\\brenames|\\)\\s*;)',
keywords: 'overriding function procedure with is renames return',
// we need to re-match the 'function' keyword, so that
// the title mode below matches only exactly once
returnBegin: true,
contains:
[
COMMENTS,
{
// name of the function/procedure
className: 'title',
begin: '(\\bwith\\s+)?\\b(function|procedure)\\s+',
end: '(\\(|\\s+|$)',
excludeBegin: true,
excludeEnd: true,
illegal: BAD_CHARS
},
// 'self'
// // parameter types
VAR_DECLS,
{
// return type
className: 'type',
begin: '\\breturn\\s+', end: '(\\s+|;|$)',
keywords: 'return',
excludeBegin: true,
excludeEnd: true,
// we are done with functions
endsParent: true,
illegal: BAD_CHARS
},
]
},
{
// new type declarations
// maybe inside generic
className: 'type',
begin: '\\b(sub)?type\\s+', end: '\\s+',
keywords: 'type',
excludeBegin: true,
illegal: BAD_CHARS
},
// see comment above the definition
VAR_DECLS,
// no markup
// relevance boosters for small snippets
// {begin: '\\s*=>\\s*'},
// {begin: '\\s*:=\\s*'},
// {begin: '\\s+:=\\s+'},
]
};
}

View File

@ -0,0 +1,54 @@
/*
Language: Apache
Author: Ruslan Keba <rukeba@gmail.com>
Contributors: Ivan Sagalaev <maniac@softwaremaniacs.org>
Website: http://rukeba.com/
Description: language definition for Apache configuration files (httpd.conf & .htaccess)
Category: common, config
*/
function(hljs) {
var NUMBER = {className: 'number', begin: '[\\$%]\\d+'};
return {
aliases: ['apacheconf'],
case_insensitive: true,
contains: [
hljs.HASH_COMMENT_MODE,
{className: 'section', begin: '</?', end: '>'},
{
className: 'attribute',
begin: /\w+/,
relevance: 0,
// keywords arent needed for highlighting per se, they only boost relevance
// for a very generally defined mode (starts with a word, ends with line-end
keywords: {
nomarkup:
'order deny allow setenv rewriterule rewriteengine rewritecond documentroot ' +
'sethandler errordocument loadmodule options header listen serverroot ' +
'servername'
},
starts: {
end: /$/,
relevance: 0,
keywords: {
literal: 'on off all'
},
contains: [
{
className: 'meta',
begin: '\\s\\[', end: '\\]$'
},
{
className: 'variable',
begin: '[\\$%]\\{', end: '\\}',
contains: ['self', NUMBER]
},
NUMBER,
hljs.QUOTE_STRING_MODE
]
}
}
],
illegal: /\S/
};
}

View File

@ -0,0 +1,91 @@
/*
Language: AppleScript
Authors: Nathan Grigg <nathan@nathanamy.org>, Dr. Drang <drdrang@gmail.com>
Category: scripting
*/
function(hljs) {
var STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: ''});
var PARAMS = {
className: 'params',
begin: '\\(', end: '\\)',
contains: ['self', hljs.C_NUMBER_MODE, STRING]
};
var COMMENT_MODE_1 = hljs.COMMENT('--', '$');
var COMMENT_MODE_2 = hljs.COMMENT(
'\\(\\*',
'\\*\\)',
{
contains: ['self', COMMENT_MODE_1] //allow nesting
}
);
var COMMENTS = [
COMMENT_MODE_1,
COMMENT_MODE_2,
hljs.HASH_COMMENT_MODE
];
return {
aliases: ['osascript'],
keywords: {
keyword:
'about above after against and around as at back before beginning ' +
'behind below beneath beside between but by considering ' +
'contain contains continue copy div does eighth else end equal ' +
'equals error every exit fifth first for fourth from front ' +
'get given global if ignoring in into is it its last local me ' +
'middle mod my ninth not of on onto or over prop property put ref ' +
'reference repeat returning script second set seventh since ' +
'sixth some tell tenth that the|0 then third through thru ' +
'timeout times to transaction try until where while whose with ' +
'without',
literal:
'AppleScript false linefeed return pi quote result space tab true',
built_in:
'alias application boolean class constant date file integer list ' +
'number real record string text ' +
'activate beep count delay launch log offset read round ' +
'run say summarize write ' +
'character characters contents day frontmost id item length ' +
'month name paragraph paragraphs rest reverse running time version ' +
'weekday word words year'
},
contains: [
STRING,
hljs.C_NUMBER_MODE,
{
className: 'built_in',
begin:
'\\b(clipboard info|the clipboard|info for|list (disks|folder)|' +
'mount volume|path to|(close|open for) access|(get|set) eof|' +
'current date|do shell script|get volume settings|random number|' +
'set volume|system attribute|system info|time to GMT|' +
'(load|run|store) script|scripting components|' +
'ASCII (character|number)|localized string|' +
'choose (application|color|file|file name|' +
'folder|from list|remote application|URL)|' +
'display (alert|dialog))\\b|^\\s*return\\b'
},
{
className: 'literal',
begin:
'\\b(text item delimiters|current application|missing value)\\b'
},
{
className: 'keyword',
begin:
'\\b(apart from|aside from|instead of|out of|greater than|' +
"isn't|(doesn't|does not) (equal|come before|come after|contain)|" +
'(greater|less) than( or equal)?|(starts?|ends|begins?) with|' +
'contained by|comes (before|after)|a (ref|reference)|POSIX file|' +
'POSIX path|(date|time) string|quoted form)\\b'
},
{
beginKeywords: 'on',
illegal: '[${=;\\n]',
contains: [hljs.UNDERSCORE_TITLE_MODE, PARAMS]
}
].concat(COMMENTS),
illegal: '//|->|=>|\\[\\['
};
}

View File

@ -0,0 +1,106 @@
/*
Language: Arduino
Author: Stefania Mellai <s.mellai@arduino.cc>
Description: The Arduino® Language is a superset of C++. This rules are designed to highlight the Arduino® source code. For info about language see http://www.arduino.cc.
Requires: cpp.js
*/
function(hljs) {
var CPP = hljs.getLanguage('cpp').exports;
return {
keywords: {
keyword:
'boolean byte word string String array ' + CPP.keywords.keyword,
built_in:
'setup loop while catch for if do goto try switch case else ' +
'default break continue return ' +
'KeyboardController MouseController SoftwareSerial ' +
'EthernetServer EthernetClient LiquidCrystal ' +
'RobotControl GSMVoiceCall EthernetUDP EsploraTFT ' +
'HttpClient RobotMotor WiFiClient GSMScanner ' +
'FileSystem Scheduler GSMServer YunClient YunServer ' +
'IPAddress GSMClient GSMModem Keyboard Ethernet ' +
'Console GSMBand Esplora Stepper Process ' +
'WiFiUDP GSM_SMS Mailbox USBHost Firmata PImage ' +
'Client Server GSMPIN FileIO Bridge Serial ' +
'EEPROM Stream Mouse Audio Servo File Task ' +
'GPRS WiFi Wire TFT GSM SPI SD ' +
'runShellCommandAsynchronously analogWriteResolution ' +
'retrieveCallingNumber printFirmwareVersion ' +
'analogReadResolution sendDigitalPortPair ' +
'noListenOnLocalhost readJoystickButton setFirmwareVersion ' +
'readJoystickSwitch scrollDisplayRight getVoiceCallStatus ' +
'scrollDisplayLeft writeMicroseconds delayMicroseconds ' +
'beginTransmission getSignalStrength runAsynchronously ' +
'getAsynchronously listenOnLocalhost getCurrentCarrier ' +
'readAccelerometer messageAvailable sendDigitalPorts ' +
'lineFollowConfig countryNameWrite runShellCommand ' +
'readStringUntil rewindDirectory readTemperature ' +
'setClockDivider readLightSensor endTransmission ' +
'analogReference detachInterrupt countryNameRead ' +
'attachInterrupt encryptionType readBytesUntil ' +
'robotNameWrite readMicrophone robotNameRead cityNameWrite ' +
'userNameWrite readJoystickY readJoystickX mouseReleased ' +
'openNextFile scanNetworks noInterrupts digitalWrite ' +
'beginSpeaker mousePressed isActionDone mouseDragged ' +
'displayLogos noAutoscroll addParameter remoteNumber ' +
'getModifiers keyboardRead userNameRead waitContinue ' +
'processInput parseCommand printVersion readNetworks ' +
'writeMessage blinkVersion cityNameRead readMessage ' +
'setDataMode parsePacket isListening setBitOrder ' +
'beginPacket isDirectory motorsWrite drawCompass ' +
'digitalRead clearScreen serialEvent rightToLeft ' +
'setTextSize leftToRight requestFrom keyReleased ' +
'compassRead analogWrite interrupts WiFiServer ' +
'disconnect playMelody parseFloat autoscroll ' +
'getPINUsed setPINUsed setTimeout sendAnalog ' +
'readSlider analogRead beginWrite createChar ' +
'motorsStop keyPressed tempoWrite readButton ' +
'subnetMask debugPrint macAddress writeGreen ' +
'randomSeed attachGPRS readString sendString ' +
'remotePort releaseAll mouseMoved background ' +
'getXChange getYChange answerCall getResult ' +
'voiceCall endPacket constrain getSocket writeJSON ' +
'getButton available connected findUntil readBytes ' +
'exitValue readGreen writeBlue startLoop IPAddress ' +
'isPressed sendSysex pauseMode gatewayIP setCursor ' +
'getOemKey tuneWrite noDisplay loadImage switchPIN ' +
'onRequest onReceive changePIN playFile noBuffer ' +
'parseInt overflow checkPIN knobRead beginTFT ' +
'bitClear updateIR bitWrite position writeRGB ' +
'highByte writeRed setSpeed readBlue noStroke ' +
'remoteIP transfer shutdown hangCall beginSMS ' +
'endWrite attached maintain noCursor checkReg ' +
'checkPUK shiftOut isValid shiftIn pulseIn ' +
'connect println localIP pinMode getIMEI ' +
'display noBlink process getBand running beginSD ' +
'drawBMP lowByte setBand release bitRead prepare ' +
'pointTo readRed setMode noFill remove listen ' +
'stroke detach attach noTone exists buffer ' +
'height bitSet circle config cursor random ' +
'IRread setDNS endSMS getKey micros ' +
'millis begin print write ready flush width ' +
'isPIN blink clear press mkdir rmdir close ' +
'point yield image BSSID click delay ' +
'read text move peek beep rect line open ' +
'seek fill size turn stop home find ' +
'step tone sqrt RSSI SSID ' +
'end bit tan cos sin pow map abs max ' +
'min get run put',
literal:
'DIGITAL_MESSAGE FIRMATA_STRING ANALOG_MESSAGE ' +
'REPORT_DIGITAL REPORT_ANALOG INPUT_PULLUP ' +
'SET_PIN_MODE INTERNAL2V56 SYSTEM_RESET LED_BUILTIN ' +
'INTERNAL1V1 SYSEX_START INTERNAL EXTERNAL ' +
'DEFAULT OUTPUT INPUT HIGH LOW'
},
contains: [
CPP.preprocessor,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE
]
};
}

View File

@ -0,0 +1,98 @@
/*
Language: ARM Assembly
Author: Dan Panzarella <alsoelp@gmail.com>
Description: ARM Assembly including Thumb and Thumb2 instructions
Category: assembler
*/
function(hljs) {
//local labels: %?[FB]?[AT]?\d{1,2}\w+
return {
case_insensitive: true,
aliases: ['arm'],
lexemes: '\\.?' + hljs.IDENT_RE,
keywords: {
meta:
//GNU preprocs
'.2byte .4byte .align .ascii .asciz .balign .byte .code .data .else .end .endif .endm .endr .equ .err .exitm .extern .global .hword .if .ifdef .ifndef .include .irp .long .macro .rept .req .section .set .skip .space .text .word .arm .thumb .code16 .code32 .force_thumb .thumb_func .ltorg '+
//ARM directives
'ALIAS ALIGN ARM AREA ASSERT ATTR CN CODE CODE16 CODE32 COMMON CP DATA DCB DCD DCDU DCDO DCFD DCFDU DCI DCQ DCQU DCW DCWU DN ELIF ELSE END ENDFUNC ENDIF ENDP ENTRY EQU EXPORT EXPORTAS EXTERN FIELD FILL FUNCTION GBLA GBLL GBLS GET GLOBAL IF IMPORT INCBIN INCLUDE INFO KEEP LCLA LCLL LCLS LTORG MACRO MAP MEND MEXIT NOFP OPT PRESERVE8 PROC QN READONLY RELOC REQUIRE REQUIRE8 RLIST FN ROUT SETA SETL SETS SN SPACE SUBT THUMB THUMBX TTL WHILE WEND ',
built_in:
'r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 '+ //standard registers
'pc lr sp ip sl sb fp '+ //typical regs plus backward compatibility
'a1 a2 a3 a4 v1 v2 v3 v4 v5 v6 v7 v8 f0 f1 f2 f3 f4 f5 f6 f7 '+ //more regs and fp
'p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 '+ //coprocessor regs
'c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 '+ //more coproc
'q0 q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 q13 q14 q15 '+ //advanced SIMD NEON regs
//program status registers
'cpsr_c cpsr_x cpsr_s cpsr_f cpsr_cx cpsr_cxs cpsr_xs cpsr_xsf cpsr_sf cpsr_cxsf '+
'spsr_c spsr_x spsr_s spsr_f spsr_cx spsr_cxs spsr_xs spsr_xsf spsr_sf spsr_cxsf '+
//NEON and VFP registers
's0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14 s15 '+
's16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 '+
'd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 '+
'd16 d17 d18 d19 d20 d21 d22 d23 d24 d25 d26 d27 d28 d29 d30 d31 ' +
'{PC} {VAR} {TRUE} {FALSE} {OPT} {CONFIG} {ENDIAN} {CODESIZE} {CPU} {FPU} {ARCHITECTURE} {PCSTOREOFFSET} {ARMASM_VERSION} {INTER} {ROPI} {RWPI} {SWST} {NOSWST} . @'
},
contains: [
{
className: 'keyword',
begin: '\\b('+ //mnemonics
'adc|'+
'(qd?|sh?|u[qh]?)?add(8|16)?|usada?8|(q|sh?|u[qh]?)?(as|sa)x|'+
'and|adrl?|sbc|rs[bc]|asr|b[lx]?|blx|bxj|cbn?z|tb[bh]|bic|'+
'bfc|bfi|[su]bfx|bkpt|cdp2?|clz|clrex|cmp|cmn|cpsi[ed]|cps|'+
'setend|dbg|dmb|dsb|eor|isb|it[te]{0,3}|lsl|lsr|ror|rrx|'+
'ldm(([id][ab])|f[ds])?|ldr((s|ex)?[bhd])?|movt?|mvn|mra|mar|'+
'mul|[us]mull|smul[bwt][bt]|smu[as]d|smmul|smmla|'+
'mla|umlaal|smlal?([wbt][bt]|d)|mls|smlsl?[ds]|smc|svc|sev|'+
'mia([bt]{2}|ph)?|mrr?c2?|mcrr2?|mrs|msr|orr|orn|pkh(tb|bt)|rbit|'+
'rev(16|sh)?|sel|[su]sat(16)?|nop|pop|push|rfe([id][ab])?|'+
'stm([id][ab])?|str(ex)?[bhd]?|(qd?)?sub|(sh?|q|u[qh]?)?sub(8|16)|'+
'[su]xt(a?h|a?b(16)?)|srs([id][ab])?|swpb?|swi|smi|tst|teq|'+
'wfe|wfi|yield'+
')'+
'(eq|ne|cs|cc|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al|hs|lo)?'+ //condition codes
'[sptrx]?' , //legal postfixes
end: '\\s'
},
hljs.COMMENT('[;@]', '$', {relevance: 0}),
hljs.C_BLOCK_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
{
className: 'string',
begin: '\'',
end: '[^\\\\]\'',
relevance: 0
},
{
className: 'title',
begin: '\\|', end: '\\|',
illegal: '\\n',
relevance: 0
},
{
className: 'number',
variants: [
{begin: '[#$=]?0x[0-9a-f]+'}, //hex
{begin: '[#$=]?0b[01]+'}, //bin
{begin: '[#$=]\\d+'}, //literal
{begin: '\\b\\d+'} //bare number
],
relevance: 0
},
{
className: 'symbol',
variants: [
{begin: '^[a-z_\\.\\$][a-z0-9_\\.\\$]+'}, //ARM syntax
{begin: '^\\s*[a-z_\\.\\$][a-z0-9_\\.\\$]+:'}, //GNU ARM syntax
{begin: '[=#]\\w+' } //label reference
],
relevance: 0
}
]
};
}

View File

@ -0,0 +1,196 @@
/*
Language: AsciiDoc
Requires: xml.js
Author: Dan Allen <dan.j.allen@gmail.com>
Website: http://google.com/profiles/dan.j.allen
Description: A semantic, text-based document format that can be exported to HTML, DocBook and other backends.
Category: markup
*/
function(hljs) {
return {
aliases: ['adoc'],
contains: [
// block comment
hljs.COMMENT(
'^/{4,}\\n',
'\\n/{4,}$',
// can also be done as...
//'^/{4,}$',
//'^/{4,}$',
{
relevance: 10
}
),
// line comment
hljs.COMMENT(
'^//',
'$',
{
relevance: 0
}
),
// title
{
className: 'title',
begin: '^\\.\\w.*$'
},
// example, admonition & sidebar blocks
{
begin: '^[=\\*]{4,}\\n',
end: '\\n^[=\\*]{4,}$',
relevance: 10
},
// headings
{
className: 'section',
relevance: 10,
variants: [
{begin: '^(={1,5}) .+?( \\1)?$'},
{begin: '^[^\\[\\]\\n]+?\\n[=\\-~\\^\\+]{2,}$'},
]
},
// document attributes
{
className: 'meta',
begin: '^:.+?:',
end: '\\s',
excludeEnd: true,
relevance: 10
},
// block attributes
{
className: 'meta',
begin: '^\\[.+?\\]$',
relevance: 0
},
// quoteblocks
{
className: 'quote',
begin: '^_{4,}\\n',
end: '\\n_{4,}$',
relevance: 10
},
// listing and literal blocks
{
className: 'code',
begin: '^[\\-\\.]{4,}\\n',
end: '\\n[\\-\\.]{4,}$',
relevance: 10
},
// passthrough blocks
{
begin: '^\\+{4,}\\n',
end: '\\n\\+{4,}$',
contains: [
{
begin: '<', end: '>',
subLanguage: 'xml',
relevance: 0
}
],
relevance: 10
},
// lists (can only capture indicators)
{
className: 'bullet',
begin: '^(\\*+|\\-+|\\.+|[^\\n]+?::)\\s+'
},
// admonition
{
className: 'symbol',
begin: '^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+',
relevance: 10
},
// inline strong
{
className: 'strong',
// must not follow a word character or be followed by an asterisk or space
begin: '\\B\\*(?![\\*\\s])',
end: '(\\n{2}|\\*)',
// allow escaped asterisk followed by word char
contains: [
{
begin: '\\\\*\\w',
relevance: 0
}
]
},
// inline emphasis
{
className: 'emphasis',
// must not follow a word character or be followed by a single quote or space
begin: '\\B\'(?![\'\\s])',
end: '(\\n{2}|\')',
// allow escaped single quote followed by word char
contains: [
{
begin: '\\\\\'\\w',
relevance: 0
}
],
relevance: 0
},
// inline emphasis (alt)
{
className: 'emphasis',
// must not follow a word character or be followed by an underline or space
begin: '_(?![_\\s])',
end: '(\\n{2}|_)',
relevance: 0
},
// inline smart quotes
{
className: 'string',
variants: [
{begin: "``.+?''"},
{begin: "`.+?'"}
]
},
// inline code snippets (TODO should get same treatment as strong and emphasis)
{
className: 'code',
begin: '(`.+?`|\\+.+?\\+)',
relevance: 0
},
// indented literal block
{
className: 'code',
begin: '^[ \\t]',
end: '$',
relevance: 0
},
// horizontal rules
{
begin: '^\'{3,}[ \\t]*$',
relevance: 10
},
// images and links
{
begin: '(link:)?(http|https|ftp|file|irc|image:?):\\S+\\[.*?\\]',
returnBegin: true,
contains: [
{
begin: '(link|image:?):',
relevance: 0
},
{
className: 'link',
begin: '\\w',
end: '[^\\[]+',
relevance: 0
},
{
className: 'string',
begin: '\\[',
end: '\\]',
excludeBegin: true,
excludeEnd: true,
relevance: 0
}
],
relevance: 10
}
]
};
}

View File

@ -0,0 +1,148 @@
/*
Language: AspectJ
Author: Hakan Ozler <ozler.hakan@gmail.com>
Description: Syntax Highlighting for the AspectJ Language which is a general-purpose aspect-oriented extension to the Java programming language.
*/
function (hljs) {
var KEYWORDS =
'false synchronized int abstract float private char boolean static null if const ' +
'for true while long throw strictfp finally protected import native final return void ' +
'enum else extends implements break transient new catch instanceof byte super volatile case ' +
'assert short package default double public try this switch continue throws privileged ' +
'aspectOf adviceexecution proceed cflowbelow cflow initialization preinitialization ' +
'staticinitialization withincode target within execution getWithinTypeName handler ' +
'thisJoinPoint thisJoinPointStaticPart thisEnclosingJoinPointStaticPart declare parents '+
'warning error soft precedence thisAspectInstance';
var SHORTKEYS = 'get set args call';
return {
keywords : KEYWORDS,
illegal : /<\/|#/,
contains : [
hljs.COMMENT(
'/\\*\\*',
'\\*/',
{
relevance : 0,
contains : [
{
// eat up @'s in emails to prevent them to be recognized as doctags
begin: /\w+@/, relevance: 0
},
{
className : 'doctag',
begin : '@[A-Za-z]+'
}
]
}
),
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
{
className : 'class',
beginKeywords : 'aspect',
end : /[{;=]/,
excludeEnd : true,
illegal : /[:;"\[\]]/,
contains : [
{
beginKeywords : 'extends implements pertypewithin perthis pertarget percflowbelow percflow issingleton'
},
hljs.UNDERSCORE_TITLE_MODE,
{
begin : /\([^\)]*/,
end : /[)]+/,
keywords : KEYWORDS + ' ' + SHORTKEYS,
excludeEnd : false
}
]
},
{
className : 'class',
beginKeywords : 'class interface',
end : /[{;=]/,
excludeEnd : true,
relevance: 0,
keywords : 'class interface',
illegal : /[:"\[\]]/,
contains : [
{beginKeywords : 'extends implements'},
hljs.UNDERSCORE_TITLE_MODE
]
},
{
// AspectJ Constructs
beginKeywords : 'pointcut after before around throwing returning',
end : /[)]/,
excludeEnd : false,
illegal : /["\[\]]/,
contains : [
{
begin : hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
returnBegin : true,
contains : [hljs.UNDERSCORE_TITLE_MODE]
}
]
},
{
begin : /[:]/,
returnBegin : true,
end : /[{;]/,
relevance: 0,
excludeEnd : false,
keywords : KEYWORDS,
illegal : /["\[\]]/,
contains : [
{
begin : hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
keywords : KEYWORDS + ' ' + SHORTKEYS
},
hljs.QUOTE_STRING_MODE
]
},
{
// this prevents 'new Name(...), or throw ...' from being recognized as a function definition
beginKeywords : 'new throw',
relevance : 0
},
{
// the function class is a bit different for AspectJ compared to the Java language
className : 'function',
begin : /\w+ +\w+(\.)?\w+\s*\([^\)]*\)\s*((throws)[\w\s,]+)?[\{;]/,
returnBegin : true,
end : /[{;=]/,
keywords : KEYWORDS,
excludeEnd : true,
contains : [
{
begin : hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
returnBegin : true,
relevance: 0,
contains : [hljs.UNDERSCORE_TITLE_MODE]
},
{
className : 'params',
begin : /\(/, end : /\)/,
relevance: 0,
keywords : KEYWORDS,
contains : [
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
},
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
},
hljs.C_NUMBER_MODE,
{
// annotation is also used in this language
className : 'meta',
begin : '@[A-Za-z]+'
}
]
};
}

View File

@ -0,0 +1,54 @@
/*
Language: AutoHotkey
Author: Seongwon Lee <dlimpid@gmail.com>
Description: AutoHotkey language definition
Category: scripting
*/
function(hljs) {
var BACKTICK_ESCAPE = {
begin: /`[\s\S]/
};
return {
case_insensitive: true,
keywords: {
keyword: 'Break Continue Else Gosub If Loop Return While',
literal: 'A|0 true false NOT AND OR',
built_in: 'ComSpec Clipboard ClipboardAll ErrorLevel',
},
contains: [
{
className: 'built_in',
begin: 'A_[a-zA-Z0-9]+'
},
BACKTICK_ESCAPE,
hljs.inherit(hljs.QUOTE_STRING_MODE, {contains: [BACKTICK_ESCAPE]}),
hljs.COMMENT(';', '$', {relevance: 0}),
{
className: 'number',
begin: hljs.NUMBER_RE,
relevance: 0
},
{
className: 'variable', // FIXME
begin: '%', end: '%',
illegal: '\\n',
contains: [BACKTICK_ESCAPE]
},
{
className: 'symbol',
contains: [BACKTICK_ESCAPE],
variants: [
{begin: '^[^\\n";]+::(?!=)'},
{begin: '^[^\\n";]+:(?!=)', relevance: 0} // zero relevance as it catches a lot of things
// followed by a single ':' in many languages
]
},
{
// consecutive commas, not for highlighting but just for relevance
begin: ',\\s*,'
}
]
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,67 @@
/*
Language: AVR Assembler
Author: Vladimir Ermakov <vooon341@gmail.com>
Category: assembler
*/
function(hljs) {
return {
case_insensitive: true,
lexemes: '\\.?' + hljs.IDENT_RE,
keywords: {
keyword:
/* mnemonic */
'adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs ' +
'brid brie brlo brlt brmi brne brpl brsh brtc brts brvc brvs bset bst call cbi cbr ' +
'clc clh cli cln clr cls clt clv clz com cp cpc cpi cpse dec eicall eijmp elpm eor ' +
'fmul fmuls fmulsu icall ijmp in inc jmp ld ldd ldi lds lpm lsl lsr mov movw mul ' +
'muls mulsu neg nop or ori out pop push rcall ret reti rjmp rol ror sbc sbr sbrc sbrs ' +
'sec seh sbi sbci sbic sbis sbiw sei sen ser ses set sev sez sleep spm st std sts sub ' +
'subi swap tst wdr',
built_in:
/* general purpose registers */
'r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 ' +
'r23 r24 r25 r26 r27 r28 r29 r30 r31 x|0 xh xl y|0 yh yl z|0 zh zl ' +
/* IO Registers (ATMega128) */
'ucsr1c udr1 ucsr1a ucsr1b ubrr1l ubrr1h ucsr0c ubrr0h tccr3c tccr3a tccr3b tcnt3h ' +
'tcnt3l ocr3ah ocr3al ocr3bh ocr3bl ocr3ch ocr3cl icr3h icr3l etimsk etifr tccr1c ' +
'ocr1ch ocr1cl twcr twdr twar twsr twbr osccal xmcra xmcrb eicra spmcsr spmcr portg ' +
'ddrg ping portf ddrf sreg sph spl xdiv rampz eicrb eimsk gimsk gicr eifr gifr timsk ' +
'tifr mcucr mcucsr tccr0 tcnt0 ocr0 assr tccr1a tccr1b tcnt1h tcnt1l ocr1ah ocr1al ' +
'ocr1bh ocr1bl icr1h icr1l tccr2 tcnt2 ocr2 ocdr wdtcr sfior eearh eearl eedr eecr ' +
'porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 ' +
'ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf',
meta:
'.byte .cseg .db .def .device .dseg .dw .endmacro .equ .eseg .exit .include .list ' +
'.listmac .macro .nolist .org .set'
},
contains: [
hljs.C_BLOCK_COMMENT_MODE,
hljs.COMMENT(
';',
'$',
{
relevance: 0
}
),
hljs.C_NUMBER_MODE, // 0x..., decimal, float
hljs.BINARY_NUMBER_MODE, // 0b...
{
className: 'number',
begin: '\\b(\\$[a-zA-Z0-9]+|0o[0-7]+)' // $..., 0o...
},
hljs.QUOTE_STRING_MODE,
{
className: 'string',
begin: '\'', end: '[^\\\\]\'',
illegal: '[^\\\\][^\']'
},
{className: 'symbol', begin: '^[A-Za-z0-9_.$]+:'},
{className: 'meta', begin: '#', end: '$'},
{ // подстановка в «.macro»
className: 'subst',
begin: '@[0-9]+'
}
]
};
}

View File

@ -0,0 +1,59 @@
/*
Language: Awk
Author: Matthew Daly <matthewbdaly@gmail.com>
Website: http://matthewdaly.co.uk/
Description: language definition for Awk scripts
*/
function(hljs) {
var VARIABLE = {
className: 'variable',
variants: [
{begin: /\$[\w\d#@][\w\d_]*/},
{begin: /\$\{(.*?)}/}
]
};
var KEYWORDS = 'BEGIN END if else while do for in break continue delete next nextfile function func exit|10';
var STRING = {
className: 'string',
contains: [hljs.BACKSLASH_ESCAPE],
variants: [
{
begin: /(u|b)?r?'''/, end: /'''/,
relevance: 10
},
{
begin: /(u|b)?r?"""/, end: /"""/,
relevance: 10
},
{
begin: /(u|r|ur)'/, end: /'/,
relevance: 10
},
{
begin: /(u|r|ur)"/, end: /"/,
relevance: 10
},
{
begin: /(b|br)'/, end: /'/
},
{
begin: /(b|br)"/, end: /"/
},
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE
]
};
return {
keywords: {
keyword: KEYWORDS
},
contains: [
VARIABLE,
STRING,
hljs.REGEXP_MODE,
hljs.HASH_COMMENT_MODE,
hljs.NUMBER_MODE
]
}
}

View File

@ -0,0 +1,36 @@
/*
Language: Axapta
Author: Dmitri Roudakov <dmitri@roudakov.ru>
Category: enterprise
*/
function(hljs) {
return {
keywords: 'false int abstract private char boolean static null if for true ' +
'while long throw finally protected final return void enum else ' +
'break new catch byte super case short default double public try this switch ' +
'continue reverse firstfast firstonly forupdate nofetch sum avg minof maxof count ' +
'order group by asc desc index hint like dispaly edit client server ttsbegin ' +
'ttscommit str real date container anytype common div mod',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
{
className: 'meta',
begin: '#', end: '$'
},
{
className: 'class',
beginKeywords: 'class interface', end: '{', excludeEnd: true,
illegal: ':',
contains: [
{beginKeywords: 'extends implements'},
hljs.UNDERSCORE_TITLE_MODE
]
}
]
};
}

View File

@ -0,0 +1,81 @@
/*
Language: Bash
Author: vah <vahtenberg@gmail.com>
Contributrors: Benjamin Pannell <contact@sierrasoftworks.com>
Category: common
*/
function(hljs) {
var VAR = {
className: 'variable',
variants: [
{begin: /\$[\w\d#@][\w\d_]*/},
{begin: /\$\{(.*?)}/}
]
};
var QUOTE_STRING = {
className: 'string',
begin: /"/, end: /"/,
contains: [
hljs.BACKSLASH_ESCAPE,
VAR,
{
className: 'variable',
begin: /\$\(/, end: /\)/,
contains: [hljs.BACKSLASH_ESCAPE]
}
]
};
var APOS_STRING = {
className: 'string',
begin: /'/, end: /'/
};
return {
aliases: ['sh', 'zsh'],
lexemes: /-?[a-z\._]+/,
keywords: {
keyword:
'if then else elif fi for while in do done case esac function',
literal:
'true false',
built_in:
// Shell built-ins
// http://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
'break cd continue eval exec exit export getopts hash pwd readonly return shift test times ' +
'trap umask unset ' +
// Bash built-ins
'alias bind builtin caller command declare echo enable help let local logout mapfile printf ' +
'read readarray source type typeset ulimit unalias ' +
// Shell modifiers
'set shopt ' +
// Zsh built-ins
'autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles ' +
'compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate ' +
'fc fg float functions getcap getln history integer jobs kill limit log noglob popd print ' +
'pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit ' +
'unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof ' +
'zpty zregexparse zsocket zstyle ztcp',
_:
'-ne -eq -lt -gt -f -d -e -s -l -a' // relevance booster
},
contains: [
{
className: 'meta',
begin: /^#![^\n]+sh\s*$/,
relevance: 10
},
{
className: 'function',
begin: /\w[\w\d_]*\s*\(\s*\)\s*\{/,
returnBegin: true,
contains: [hljs.inherit(hljs.TITLE_MODE, {begin: /\w[\w\d_]*/})],
relevance: 0
},
hljs.HASH_COMMENT_MODE,
QUOTE_STRING,
APOS_STRING,
VAR
]
};
}

View File

@ -0,0 +1,55 @@
/*
Language: Basic
Author: Raphaël Assénat <raph@raphnet.net>
Description: Based on the BASIC reference from the Tandy 1000 guide
*/
function(hljs) {
return {
case_insensitive: true,
illegal: '^\.',
// Support explicitely typed variables that end with $%! or #.
lexemes: '[a-zA-Z][a-zA-Z0-9_\$\%\!\#]*',
keywords: {
keyword:
'ABS ASC AND ATN AUTO|0 BEEP BLOAD|10 BSAVE|10 CALL CALLS CDBL CHAIN CHDIR CHR$|10 CINT CIRCLE ' +
'CLEAR CLOSE CLS COLOR COM COMMON CONT COS CSNG CSRLIN CVD CVI CVS DATA DATE$ ' +
'DEFDBL DEFINT DEFSNG DEFSTR DEF|0 SEG USR DELETE DIM DRAW EDIT END ENVIRON ENVIRON$ ' +
'EOF EQV ERASE ERDEV ERDEV$ ERL ERR ERROR EXP FIELD FILES FIX FOR|0 FRE GET GOSUB|10 GOTO ' +
'HEX$ IF|0 THEN ELSE|0 INKEY$ INP INPUT INPUT# INPUT$ INSTR IMP INT IOCTL IOCTL$ KEY ON ' +
'OFF LIST KILL LEFT$ LEN LET LINE LLIST LOAD LOC LOCATE LOF LOG LPRINT USING LSET ' +
'MERGE MID$ MKDIR MKD$ MKI$ MKS$ MOD NAME NEW NEXT NOISE NOT OCT$ ON OR PEN PLAY STRIG OPEN OPTION ' +
'BASE OUT PAINT PALETTE PCOPY PEEK PMAP POINT POKE POS PRINT PRINT] PSET PRESET ' +
'PUT RANDOMIZE READ REM RENUM RESET|0 RESTORE RESUME RETURN|0 RIGHT$ RMDIR RND RSET ' +
'RUN SAVE SCREEN SGN SHELL SIN SOUND SPACE$ SPC SQR STEP STICK STOP STR$ STRING$ SWAP ' +
'SYSTEM TAB TAN TIME$ TIMER TROFF TRON TO USR VAL VARPTR VARPTR$ VIEW WAIT WHILE ' +
'WEND WIDTH WINDOW WRITE XOR'
},
contains: [
hljs.QUOTE_STRING_MODE,
hljs.COMMENT('REM', '$', {relevance: 10}),
hljs.COMMENT('\'', '$', {relevance: 0}),
{
// Match line numbers
className: 'symbol',
begin: '^[0-9]+\ ',
relevance: 10
},
{
// Match typed numeric constants (1000, 12.34!, 1.2e5, 1.5#, 1.2D2)
className: 'number',
begin: '\\b([0-9]+[0-9edED\.]*[#\!]?)',
relevance: 0
},
{
// Match hexadecimal numbers (&Hxxxx)
className: 'number',
begin: '(\&[hH][0-9a-fA-F]{1,4})'
},
{
// Match octal numbers (&Oxxxxxx)
className: 'number',
begin: '(\&[oO][0-7]{1,6})'
}
]
};
}

View File

@ -0,0 +1,33 @@
/*
Language: BackusNaur Form
Author: Oleg Efimov <efimovov@gmail.com>
*/
function(hljs){
return {
contains: [
// Attribute
{
className: 'attribute',
begin: /</, end: />/
},
// Specific
{
begin: /::=/,
starts: {
end: /$/,
contains: [
{
begin: /</, end: />/
},
// Common
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE
]
}
}
]
};
}

View File

@ -0,0 +1,41 @@
/*
Language: Brainfuck
Author: Evgeny Stepanischev <imbolk@gmail.com>
*/
function(hljs){
var LITERAL = {
className: 'literal',
begin: '[\\+\\-]',
relevance: 0
};
return {
aliases: ['bf'],
contains: [
hljs.COMMENT(
'[^\\[\\]\\.,\\+\\-<> \r\n]',
'[\\[\\]\\.,\\+\\-<> \r\n]',
{
returnEnd: true,
relevance: 0
}
),
{
className: 'title',
begin: '[\\[\\]]',
relevance: 0
},
{
className: 'string',
begin: '[\\.,]',
relevance: 0
},
{
// this mode works as the only relevance counter
begin: /\+\+|\-\-/, returnBegin: true,
contains: [LITERAL]
},
LITERAL
]
};
}

View File

@ -0,0 +1,85 @@
/*
Language: C/AL
Author: Kenneth Fuglsang Christensen <kfuglsang@gmail.com>
Description: Provides highlighting of Microsoft Dynamics NAV C/AL code files
*/
function(hljs) {
var KEYWORDS =
'div mod in and or not xor asserterror begin case do downto else end exit for if of repeat then to ' +
'until while with var';
var LITERALS = 'false true';
var COMMENT_MODES = [
hljs.C_LINE_COMMENT_MODE,
hljs.COMMENT(
/\{/,
/\}/,
{
relevance: 0
}
),
hljs.COMMENT(
/\(\*/,
/\*\)/,
{
relevance: 10
}
)
];
var STRING = {
className: 'string',
begin: /'/, end: /'/,
contains: [{begin: /''/}]
};
var CHAR_STRING = {
className: 'string', begin: /(#\d+)+/
};
var DATE = {
className: 'number',
begin: '\\b\\d+(\\.\\d+)?(DT|D|T)',
relevance: 0
};
var DBL_QUOTED_VARIABLE = {
className: 'string', // not a string technically but makes sense to be highlighted in the same style
begin: '"',
end: '"'
};
var PROCEDURE = {
className: 'function',
beginKeywords: 'procedure', end: /[:;]/,
keywords: 'procedure|10',
contains: [
hljs.TITLE_MODE,
{
className: 'params',
begin: /\(/, end: /\)/,
keywords: KEYWORDS,
contains: [STRING, CHAR_STRING]
}
].concat(COMMENT_MODES)
};
var OBJECT = {
className: 'class',
begin: 'OBJECT (Table|Form|Report|Dataport|Codeunit|XMLport|MenuSuite|Page|Query) (\\d+) ([^\\r\\n]+)',
returnBegin: true,
contains: [
hljs.TITLE_MODE,
PROCEDURE
]
};
return {
case_insensitive: true,
keywords: { keyword: KEYWORDS, literal: LITERALS },
illegal: /\/\*/,
contains: [
STRING, CHAR_STRING,
DATE, DBL_QUOTED_VARIABLE,
hljs.NUMBER_MODE,
OBJECT,
PROCEDURE
]
};
}

View File

@ -0,0 +1,55 @@
/*
Language: Capn Proto
Author: Oleg Efimov <efimovov@gmail.com>
Description: Capn Proto message definition format
Category: protocols
*/
function(hljs) {
return {
aliases: ['capnp'],
keywords: {
keyword:
'struct enum interface union group import using const annotation extends in of on as with from fixed',
built_in:
'Void Bool Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float32 Float64 ' +
'Text Data AnyPointer AnyStruct Capability List',
literal:
'true false'
},
contains: [
hljs.QUOTE_STRING_MODE,
hljs.NUMBER_MODE,
hljs.HASH_COMMENT_MODE,
{
className: 'meta',
begin: /@0x[\w\d]{16};/,
illegal: /\n/
},
{
className: 'symbol',
begin: /@\d+\b/
},
{
className: 'class',
beginKeywords: 'struct enum', end: /\{/,
illegal: /\n/,
contains: [
hljs.inherit(hljs.TITLE_MODE, {
starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title
})
]
},
{
className: 'class',
beginKeywords: 'interface', end: /\{/,
illegal: /\n/,
contains: [
hljs.inherit(hljs.TITLE_MODE, {
starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title
})
]
}
]
};
}

View File

@ -0,0 +1,70 @@
/*
Language: Ceylon
Author: Lucas Werkmeister <mail@lucaswerkmeister.de>
*/
function(hljs) {
// 2.3. Identifiers and keywords
var KEYWORDS =
'assembly module package import alias class interface object given value ' +
'assign void function new of extends satisfies abstracts in out return ' +
'break continue throw assert dynamic if else switch case for while try ' +
'catch finally then let this outer super is exists nonempty';
// 7.4.1 Declaration Modifiers
var DECLARATION_MODIFIERS =
'shared abstract formal default actual variable late native deprecated' +
'final sealed annotation suppressWarnings small';
// 7.4.2 Documentation
var DOCUMENTATION =
'doc by license see throws tagged';
var SUBST = {
className: 'subst', excludeBegin: true, excludeEnd: true,
begin: /``/, end: /``/,
keywords: KEYWORDS,
relevance: 10
};
var EXPRESSIONS = [
{
// verbatim string
className: 'string',
begin: '"""',
end: '"""',
relevance: 10
},
{
// string literal or template
className: 'string',
begin: '"', end: '"',
contains: [SUBST]
},
{
// character literal
className: 'string',
begin: "'",
end: "'"
},
{
// numeric literal
className: 'number',
begin: '#[0-9a-fA-F_]+|\\$[01_]+|[0-9_]+(?:\\.[0-9_](?:[eE][+-]?\\d+)?)?[kMGTPmunpf]?',
relevance: 0
}
];
SUBST.contains = EXPRESSIONS;
return {
keywords: {
keyword: KEYWORDS + ' ' + DECLARATION_MODIFIERS,
meta: DOCUMENTATION
},
illegal: '\\$[^01]|#[^0-9a-fA-F]',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.COMMENT('/\\*', '\\*/', {contains: ['self']}),
{
// compiler annotation
className: 'meta',
begin: '@[a-z]\\w*(?:\\:\"[^\"]*\")?'
}
].concat(EXPRESSIONS)
};
}

View File

@ -0,0 +1,31 @@
/*
Language: Clean
Author: Camil Staps <info@camilstaps.nl>
Category: functional
Website: http://clean.cs.ru.nl
*/
function(hljs) {
return {
aliases: ['clean','icl','dcl'],
keywords: {
keyword:
'if let in with where case of class instance otherwise ' +
'implementation definition system module from import qualified as ' +
'special code inline foreign export ccall stdcall generic derive ' +
'infix infixl infixr',
literal:
'True False'
},
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
{begin: '->|<-[|:]?|::|#!?|>>=|\\{\\||\\|\\}|:==|=:|\\.\\.|<>|`'} // relevance booster
]
};
}

View File

@ -0,0 +1,22 @@
/*
Language: Clojure REPL
Description: Clojure REPL sessions
Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
Requires: clojure.js
Category: lisp
*/
function(hljs) {
return {
contains: [
{
className: 'meta',
begin: /^([\w.-]+|\s*#_)=>/,
starts: {
end: /$/,
subLanguage: 'clojure'
}
}
]
}
}

View File

@ -0,0 +1,101 @@
/*
Language: Clojure
Description: Clojure syntax (based on lisp.js)
Author: mfornos
Category: lisp
*/
function(hljs) {
var keywords = {
'builtin-name':
// Clojure keywords
'def defonce cond apply if-not if-let if not not= = < > <= >= == + / * - rem '+
'quot neg? pos? delay? symbol? keyword? true? false? integer? empty? coll? list? '+
'set? ifn? fn? associative? sequential? sorted? counted? reversible? number? decimal? '+
'class? distinct? isa? float? rational? reduced? ratio? odd? even? char? seq? vector? '+
'string? map? nil? contains? zero? instance? not-every? not-any? libspec? -> ->> .. . '+
'inc compare do dotimes mapcat take remove take-while drop letfn drop-last take-last '+
'drop-while while intern condp case reduced cycle split-at split-with repeat replicate '+
'iterate range merge zipmap declare line-seq sort comparator sort-by dorun doall nthnext '+
'nthrest partition eval doseq await await-for let agent atom send send-off release-pending-sends '+
'add-watch mapv filterv remove-watch agent-error restart-agent set-error-handler error-handler '+
'set-error-mode! error-mode shutdown-agents quote var fn loop recur throw try monitor-enter '+
'monitor-exit defmacro defn defn- macroexpand macroexpand-1 for dosync and or '+
'when when-not when-let comp juxt partial sequence memoize constantly complement identity assert '+
'peek pop doto proxy defstruct first rest cons defprotocol cast coll deftype defrecord last butlast '+
'sigs reify second ffirst fnext nfirst nnext defmulti defmethod meta with-meta ns in-ns create-ns import '+
'refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! '+
'assoc! dissoc! pop! disj! use class type num float double short byte boolean bigint biginteger '+
'bigdec print-method print-dup throw-if printf format load compile get-in update-in pr pr-on newline '+
'flush read slurp read-line subvec with-open memfn time re-find re-groups rand-int rand mod locking '+
'assert-valid-fdecl alias resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! '+
'reset-meta! commute get-validator alter ref-set ref-history-count ref-min-history ref-max-history ensure sync io! '+
'new next conj set! to-array future future-call into-array aset gen-class reduce map filter find empty '+
'hash-map hash-set sorted-map sorted-map-by sorted-set sorted-set-by vec vector seq flatten reverse assoc dissoc list '+
'disj get union difference intersection extend extend-type extend-protocol int nth delay count concat chunk chunk-buffer '+
'chunk-append chunk-first chunk-rest max min dec unchecked-inc-int unchecked-inc unchecked-dec-inc unchecked-dec unchecked-negate '+
'unchecked-add-int unchecked-add unchecked-subtract-int unchecked-subtract chunk-next chunk-cons chunked-seq? prn vary-meta '+
'lazy-seq spread list* str find-keyword keyword symbol gensym force rationalize'
};
var SYMBOLSTART = 'a-zA-Z_\\-!.?+*=<>&#\'';
var SYMBOL_RE = '[' + SYMBOLSTART + '][' + SYMBOLSTART + '0-9/;:]*';
var SIMPLE_NUMBER_RE = '[-+]?\\d+(\\.\\d+)?';
var SYMBOL = {
begin: SYMBOL_RE,
relevance: 0
};
var NUMBER = {
className: 'number', begin: SIMPLE_NUMBER_RE,
relevance: 0
};
var STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null});
var COMMENT = hljs.COMMENT(
';',
'$',
{
relevance: 0
}
);
var LITERAL = {
className: 'literal',
begin: /\b(true|false|nil)\b/
};
var COLLECTION = {
begin: '[\\[\\{]', end: '[\\]\\}]'
};
var HINT = {
className: 'comment',
begin: '\\^' + SYMBOL_RE
};
var HINT_COL = hljs.COMMENT('\\^\\{', '\\}');
var KEY = {
className: 'symbol',
begin: '[:]{1,2}' + SYMBOL_RE
};
var LIST = {
begin: '\\(', end: '\\)'
};
var BODY = {
endsWithParent: true,
relevance: 0
};
var NAME = {
keywords: keywords,
lexemes: SYMBOL_RE,
className: 'name', begin: SYMBOL_RE,
starts: BODY
};
var DEFAULT_CONTAINS = [LIST, STRING, HINT, HINT_COL, COMMENT, KEY, COLLECTION, NUMBER, LITERAL, SYMBOL];
LIST.contains = [hljs.COMMENT('comment', ''), NAME, BODY];
BODY.contains = DEFAULT_CONTAINS;
COLLECTION.contains = DEFAULT_CONTAINS;
return {
aliases: ['clj'],
illegal: /\S/,
contains: [LIST, STRING, HINT, HINT_COL, COMMENT, KEY, COLLECTION, NUMBER, LITERAL]
}
}

View File

@ -0,0 +1,44 @@
/*
Language: CMake
Description: CMake is an open-source cross-platform system for build automation.
Author: Igor Kalnitsky <igor@kalnitsky.org>
Website: http://kalnitsky.org/
*/
function(hljs) {
return {
aliases: ['cmake.in'],
case_insensitive: true,
keywords: {
keyword:
'add_custom_command add_custom_target add_definitions add_dependencies ' +
'add_executable add_library add_subdirectory add_test aux_source_directory ' +
'break build_command cmake_minimum_required cmake_policy configure_file ' +
'create_test_sourcelist define_property else elseif enable_language enable_testing ' +
'endforeach endfunction endif endmacro endwhile execute_process export find_file ' +
'find_library find_package find_path find_program fltk_wrap_ui foreach function ' +
'get_cmake_property get_directory_property get_filename_component get_property ' +
'get_source_file_property get_target_property get_test_property if include ' +
'include_directories include_external_msproject include_regular_expression install ' +
'link_directories load_cache load_command macro mark_as_advanced message option ' +
'output_required_files project qt_wrap_cpp qt_wrap_ui remove_definitions return ' +
'separate_arguments set set_directory_properties set_property ' +
'set_source_files_properties set_target_properties set_tests_properties site_name ' +
'source_group string target_link_libraries try_compile try_run unset variable_watch ' +
'while build_name exec_program export_library_dependencies install_files ' +
'install_programs install_targets link_libraries make_directory remove subdir_depends ' +
'subdirs use_mangled_mesa utility_source variable_requires write_file ' +
'qt5_use_modules qt5_use_package qt5_wrap_cpp on off true false and or ' +
'equal less greater strless strgreater strequal matches'
},
contains: [
{
className: 'variable',
begin: '\\${', end: '}'
},
hljs.HASH_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
hljs.NUMBER_MODE
]
};
}

View File

@ -0,0 +1,146 @@
/*
Language: CoffeeScript
Author: Dmytrii Nagirniak <dnagir@gmail.com>
Contributors: Oleg Efimov <efimovov@gmail.com>, Cédric Néhémie <cedric.nehemie@gmail.com>
Description: CoffeeScript is a programming language that transcompiles to JavaScript. For info about language see http://coffeescript.org/
Category: common, scripting
*/
function(hljs) {
var KEYWORDS = {
keyword:
// JS keywords
'in if for while finally new do return else break catch instanceof throw try this ' +
'switch continue typeof delete debugger super ' +
// Coffee keywords
'then unless until loop of by when and or is isnt not',
literal:
// JS literals
'true false null undefined ' +
// Coffee literals
'yes no on off',
built_in:
'npm require console print module global window document'
};
var JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
var SUBST = {
className: 'subst',
begin: /#\{/, end: /}/,
keywords: KEYWORDS
};
var EXPRESSIONS = [
hljs.BINARY_NUMBER_MODE,
hljs.inherit(hljs.C_NUMBER_MODE, {starts: {end: '(\\s*/)?', relevance: 0}}), // a number tries to eat the following slash to prevent treating it as a regexp
{
className: 'string',
variants: [
{
begin: /'''/, end: /'''/,
contains: [hljs.BACKSLASH_ESCAPE]
},
{
begin: /'/, end: /'/,
contains: [hljs.BACKSLASH_ESCAPE]
},
{
begin: /"""/, end: /"""/,
contains: [hljs.BACKSLASH_ESCAPE, SUBST]
},
{
begin: /"/, end: /"/,
contains: [hljs.BACKSLASH_ESCAPE, SUBST]
}
]
},
{
className: 'regexp',
variants: [
{
begin: '///', end: '///',
contains: [SUBST, hljs.HASH_COMMENT_MODE]
},
{
begin: '//[gim]*',
relevance: 0
},
{
// regex can't start with space to parse x / 2 / 3 as two divisions
// regex can't start with *, and it supports an "illegal" in the main mode
begin: /\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/
}
]
},
{
begin: '@' + JS_IDENT_RE // relevance booster
},
{
begin: '`', end: '`',
excludeBegin: true, excludeEnd: true,
subLanguage: 'javascript'
}
];
SUBST.contains = EXPRESSIONS;
var TITLE = hljs.inherit(hljs.TITLE_MODE, {begin: JS_IDENT_RE});
var PARAMS_RE = '(\\(.*\\))?\\s*\\B[-=]>';
var PARAMS = {
className: 'params',
begin: '\\([^\\(]', returnBegin: true,
/* We need another contained nameless mode to not have every nested
pair of parens to be called "params" */
contains: [{
begin: /\(/, end: /\)/,
keywords: KEYWORDS,
contains: ['self'].concat(EXPRESSIONS)
}]
};
return {
aliases: ['coffee', 'cson', 'iced'],
keywords: KEYWORDS,
illegal: /\/\*/,
contains: EXPRESSIONS.concat([
hljs.COMMENT('###', '###'),
hljs.HASH_COMMENT_MODE,
{
className: 'function',
begin: '^\\s*' + JS_IDENT_RE + '\\s*=\\s*' + PARAMS_RE, end: '[-=]>',
returnBegin: true,
contains: [TITLE, PARAMS]
},
{
// anonymous function start
begin: /[:\(,=]\s*/,
relevance: 0,
contains: [
{
className: 'function',
begin: PARAMS_RE, end: '[-=]>',
returnBegin: true,
contains: [PARAMS]
}
]
},
{
className: 'class',
beginKeywords: 'class',
end: '$',
illegal: /[:="\[\]]/,
contains: [
{
beginKeywords: 'extends',
endsWithParent: true,
illegal: /[:="\[\]]/,
contains: [TITLE]
},
TITLE
]
},
{
begin: JS_IDENT_RE + ':', end: ':',
returnBegin: true, returnEnd: true,
relevance: 0
}
])
};
}

View File

@ -0,0 +1,72 @@
/*
Language: Coq
Author: Stephan Boyer <stephan@stephanboyer.com>
Category: functional
*/
function(hljs) {
return {
keywords: {
keyword:
'_ as at cofix else end exists exists2 fix for forall fun if IF in let ' +
'match mod Prop return Set then Type using where with ' +
'Abort About Add Admit Admitted All Arguments Assumptions Axiom Back BackTo ' +
'Backtrack Bind Blacklist Canonical Cd Check Class Classes Close Coercion ' +
'Coercions CoFixpoint CoInductive Collection Combined Compute Conjecture ' +
'Conjectures Constant constr Constraint Constructors Context Corollary ' +
'CreateHintDb Cut Declare Defined Definition Delimit Dependencies Dependent' +
'Derive Drop eauto End Equality Eval Example Existential Existentials ' +
'Existing Export exporting Extern Extract Extraction Fact Field Fields File ' +
'Fixpoint Focus for From Function Functional Generalizable Global Goal Grab ' +
'Grammar Graph Guarded Heap Hint HintDb Hints Hypotheses Hypothesis ident ' +
'Identity If Immediate Implicit Import Include Inductive Infix Info Initial ' +
'Inline Inspect Instance Instances Intro Intros Inversion Inversion_clear ' +
'Language Left Lemma Let Libraries Library Load LoadPath Local Locate Ltac ML ' +
'Mode Module Modules Monomorphic Morphism Next NoInline Notation Obligation ' +
'Obligations Opaque Open Optimize Options Parameter Parameters Parametric ' +
'Path Paths pattern Polymorphic Preterm Print Printing Program Projections ' +
'Proof Proposition Pwd Qed Quit Rec Record Recursive Redirect Relation Remark ' +
'Remove Require Reserved Reset Resolve Restart Rewrite Right Ring Rings Save ' +
'Scheme Scope Scopes Script Search SearchAbout SearchHead SearchPattern ' +
'SearchRewrite Section Separate Set Setoid Show Solve Sorted Step Strategies ' +
'Strategy Structure SubClass Table Tables Tactic Term Test Theorem Time ' +
'Timeout Transparent Type Typeclasses Types Undelimit Undo Unfocus Unfocused ' +
'Unfold Universe Universes Unset Unshelve using Variable Variables Variant ' +
'Verbose Visibility where with',
built_in:
'abstract absurd admit after apply as assert assumption at auto autorewrite ' +
'autounfold before bottom btauto by case case_eq cbn cbv change ' +
'classical_left classical_right clear clearbody cofix compare compute ' +
'congruence constr_eq constructor contradict contradiction cut cutrewrite ' +
'cycle decide decompose dependent destruct destruction dintuition ' +
'discriminate discrR do double dtauto eapply eassumption eauto ecase ' +
'econstructor edestruct ediscriminate eelim eexact eexists einduction ' +
'einjection eleft elim elimtype enough equality erewrite eright ' +
'esimplify_eq esplit evar exact exactly_once exfalso exists f_equal fail ' +
'field field_simplify field_simplify_eq first firstorder fix fold fourier ' +
'functional generalize generalizing gfail give_up has_evar hnf idtac in ' +
'induction injection instantiate intro intro_pattern intros intuition ' +
'inversion inversion_clear is_evar is_var lapply lazy left lia lra move ' +
'native_compute nia nsatz omega once pattern pose progress proof psatz quote ' +
'record red refine reflexivity remember rename repeat replace revert ' +
'revgoals rewrite rewrite_strat right ring ring_simplify rtauto set ' +
'setoid_reflexivity setoid_replace setoid_rewrite setoid_symmetry ' +
'setoid_transitivity shelve shelve_unifiable simpl simple simplify_eq solve ' +
'specialize split split_Rabs split_Rmult stepl stepr subst sum swap ' +
'symmetry tactic tauto time timeout top transitivity trivial try tryif ' +
'unfold unify until using vm_compute with'
},
contains: [
hljs.QUOTE_STRING_MODE,
hljs.COMMENT('\\(\\*', '\\*\\)'),
hljs.C_NUMBER_MODE,
{
className: 'type',
excludeBegin: true,
begin: '\\|\\s*',
end: '\\w+'
},
{begin: /[-=]>/} // relevance booster
]
};
}

View File

@ -0,0 +1,128 @@
/*
Language: Caché Object Script
Author: Nikita Savchenko <zitros.lab@gmail.com>
Category: enterprise, scripting
*/
function cos (hljs) {
var STRINGS = {
className: 'string',
variants: [
{
begin: '"',
end: '"',
contains: [{ // escaped
begin: "\"\"",
relevance: 0
}]
}
]
};
var NUMBERS = {
className: "number",
begin: "\\b(\\d+(\\.\\d*)?|\\.\\d+)",
relevance: 0
};
var COS_KEYWORDS =
'property parameter class classmethod clientmethod extends as break ' +
'catch close continue do d|0 else elseif for goto halt hang h|0 if job ' +
'j|0 kill k|0 lock l|0 merge new open quit q|0 read r|0 return set s|0 ' +
'tcommit throw trollback try tstart use view while write w|0 xecute x|0 ' +
'zkill znspace zn ztrap zwrite zw zzdump zzwrite print zbreak zinsert ' +
'zload zprint zremove zsave zzprint mv mvcall mvcrt mvdim mvprint zquit ' +
'zsync ascii';
// registered function - no need in them due to all functions are highlighted,
// but I'll just leave this here.
//"$bit", "$bitcount",
//"$bitfind", "$bitlogic", "$case", "$char", "$classmethod", "$classname",
//"$compile", "$data", "$decimal", "$double", "$extract", "$factor",
//"$find", "$fnumber", "$get", "$increment", "$inumber", "$isobject",
//"$isvaliddouble", "$isvalidnum", "$justify", "$length", "$list",
//"$listbuild", "$listdata", "$listfind", "$listfromstring", "$listget",
//"$listlength", "$listnext", "$listsame", "$listtostring", "$listvalid",
//"$locate", "$match", "$method", "$name", "$nconvert", "$next",
//"$normalize", "$now", "$number", "$order", "$parameter", "$piece",
//"$prefetchoff", "$prefetchon", "$property", "$qlength", "$qsubscript",
//"$query", "$random", "$replace", "$reverse", "$sconvert", "$select",
//"$sortbegin", "$sortend", "$stack", "$text", "$translate", "$view",
//"$wascii", "$wchar", "$wextract", "$wfind", "$wiswide", "$wlength",
//"$wreverse", "$xecute", "$zabs", "$zarccos", "$zarcsin", "$zarctan",
//"$zcos", "$zcot", "$zcsc", "$zdate", "$zdateh", "$zdatetime",
//"$zdatetimeh", "$zexp", "$zhex", "$zln", "$zlog", "$zpower", "$zsec",
//"$zsin", "$zsqr", "$ztan", "$ztime", "$ztimeh", "$zboolean",
//"$zconvert", "$zcrc", "$zcyc", "$zdascii", "$zdchar", "$zf",
//"$ziswide", "$zlascii", "$zlchar", "$zname", "$zposition", "$zqascii",
//"$zqchar", "$zsearch", "$zseek", "$zstrip", "$zwascii", "$zwchar",
//"$zwidth", "$zwpack", "$zwbpack", "$zwunpack", "$zwbunpack", "$zzenkaku",
//"$change", "$mv", "$mvat", "$mvfmt", "$mvfmts", "$mviconv",
//"$mviconvs", "$mvinmat", "$mvlover", "$mvoconv", "$mvoconvs", "$mvraise",
//"$mvtrans", "$mvv", "$mvname", "$zbitand", "$zbitcount", "$zbitfind",
//"$zbitget", "$zbitlen", "$zbitnot", "$zbitor", "$zbitset", "$zbitstr",
//"$zbitxor", "$zincrement", "$znext", "$zorder", "$zprevious", "$zsort",
//"device", "$ecode", "$estack", "$etrap", "$halt", "$horolog",
//"$io", "$job", "$key", "$namespace", "$principal", "$quit", "$roles",
//"$storage", "$system", "$test", "$this", "$tlevel", "$username",
//"$x", "$y", "$za", "$zb", "$zchild", "$zeof", "$zeos", "$zerror",
//"$zhorolog", "$zio", "$zjob", "$zmode", "$znspace", "$zparent", "$zpi",
//"$zpos", "$zreference", "$zstorage", "$ztimestamp", "$ztimezone",
//"$ztrap", "$zversion"
return {
case_insensitive: true,
aliases: ["cos", "cls"],
keywords: COS_KEYWORDS,
contains: [
NUMBERS,
STRINGS,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
{
className: "comment",
begin: /;/, end: "$",
relevance: 0
},
{ // Functions and user-defined functions: write $ztime(60*60*3), $$myFunc(10), $$^Val(1)
className: "built_in",
begin: /(?:\$\$?|\.\.)\^?[a-zA-Z]+/
},
{ // Macro command: quit $$$OK
className: "built_in",
begin: /\$\$\$[a-zA-Z]+/
},
{ // Special (global) variables: write %request.Content; Built-in classes: %Library.Integer
className: "built_in",
begin: /%[a-z]+(?:\.[a-z]+)*/
},
{ // Global variable: set ^globalName = 12 write ^globalName
className: "symbol",
begin: /\^%?[a-zA-Z][\w]*/
},
{ // Some control constructions: do ##class(Package.ClassName).Method(), ##super()
className: "keyword",
begin: /##class|##super|#define|#dim/
},
// sub-languages: are not fully supported by hljs by 11/15/2015
// left for the future implementation.
{
begin: /&sql\(/, end: /\)/,
excludeBegin: true, excludeEnd: true,
subLanguage: "sql"
},
{
begin: /&(js|jscript|javascript)</, end: />/,
excludeBegin: true, excludeEnd: true,
subLanguage: "javascript"
},
{
// this brakes first and last tag, but this is the only way to embed a valid html
begin: /&html<\s*</, end: />\s*>/,
subLanguage: "xml"
}
]
};
}

View File

@ -0,0 +1,172 @@
/*
Language: C++
Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
Contributors: Evgeny Stepanischev <imbolk@gmail.com>, Zaven Muradyan <megalivoithos@gmail.com>, Roel Deckers <admin@codingcat.nl>
Category: common, system
*/
function(hljs) {
var CPP_PRIMITIVE_TYPES = {
className: 'keyword',
begin: '\\b[a-z\\d_]*_t\\b'
};
var STRINGS = {
className: 'string',
variants: [
{
begin: '(u8?|U)?L?"', end: '"',
illegal: '\\n',
contains: [hljs.BACKSLASH_ESCAPE]
},
{
begin: '(u8?|U)?R"', end: '"',
contains: [hljs.BACKSLASH_ESCAPE]
},
{
begin: '\'\\\\?.', end: '\'',
illegal: '.'
}
]
};
var NUMBERS = {
className: 'number',
variants: [
{ begin: '\\b(0b[01\']+)' },
{ begin: '\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)' },
{ begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' }
],
relevance: 0
};
var PREPROCESSOR = {
className: 'meta',
begin: /#\s*[a-z]+\b/, end: /$/,
keywords: {
'meta-keyword':
'if else elif endif define undef warning error line ' +
'pragma ifdef ifndef include'
},
contains: [
{
begin: /\\\n/, relevance: 0
},
hljs.inherit(STRINGS, {className: 'meta-string'}),
{
className: 'meta-string',
begin: '<', end: '>',
illegal: '\\n',
},
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
};
var FUNCTION_TITLE = hljs.IDENT_RE + '\\s*\\(';
var CPP_KEYWORDS = {
keyword: 'int float while private char catch import module export virtual operator sizeof ' +
'dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace ' +
'unsigned long volatile static protected bool template mutable if public friend ' +
'do goto auto void enum else break extern using class asm case typeid ' +
'short reinterpret_cast|10 default double register explicit signed typename try this ' +
'switch continue inline delete alignof constexpr decltype ' +
'noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary ' +
'atomic_bool atomic_char atomic_schar ' +
'atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong ' +
'atomic_ullong new throw return',
built_in: 'std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream ' +
'auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set ' +
'unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos ' +
'asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp ' +
'fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper ' +
'isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow ' +
'printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp ' +
'strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan ' +
'vfprintf vprintf vsprintf endl initializer_list unique_ptr',
literal: 'true false nullptr NULL'
};
var EXPRESSION_CONTAINS = [
CPP_PRIMITIVE_TYPES,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
NUMBERS,
STRINGS
];
return {
aliases: ['c', 'cc', 'h', 'c++', 'h++', 'hpp'],
keywords: CPP_KEYWORDS,
illegal: '</',
contains: EXPRESSION_CONTAINS.concat([
PREPROCESSOR,
{
begin: '\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', end: '>',
keywords: CPP_KEYWORDS,
contains: ['self', CPP_PRIMITIVE_TYPES]
},
{
begin: hljs.IDENT_RE + '::',
keywords: CPP_KEYWORDS
},
{
// This mode covers expression context where we can't expect a function
// definition and shouldn't highlight anything that looks like one:
// `return some()`, `else if()`, `(x*sum(1, 2))`
variants: [
{begin: /=/, end: /;/},
{begin: /\(/, end: /\)/},
{beginKeywords: 'new throw return else', end: /;/}
],
keywords: CPP_KEYWORDS,
contains: EXPRESSION_CONTAINS.concat([
{
begin: /\(/, end: /\)/,
keywords: CPP_KEYWORDS,
contains: EXPRESSION_CONTAINS.concat(['self']),
relevance: 0
}
]),
relevance: 0
},
{
className: 'function',
begin: '(' + hljs.IDENT_RE + '[\\*&\\s]+)+' + FUNCTION_TITLE,
returnBegin: true, end: /[{;=]/,
excludeEnd: true,
keywords: CPP_KEYWORDS,
illegal: /[^\w\s\*&]/,
contains: [
{
begin: FUNCTION_TITLE, returnBegin: true,
contains: [hljs.TITLE_MODE],
relevance: 0
},
{
className: 'params',
begin: /\(/, end: /\)/,
keywords: CPP_KEYWORDS,
relevance: 0,
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
STRINGS,
NUMBERS,
CPP_PRIMITIVE_TYPES
]
},
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
PREPROCESSOR
]
}
]),
exports: {
preprocessor: PREPROCESSOR,
strings: STRINGS,
keywords: CPP_KEYWORDS
}
};
}

View File

@ -0,0 +1,101 @@
/*
Language: crmsh
Author: Kristoffer Gronlund <kgronlund@suse.com>
Website: http://crmsh.github.io
Description: Syntax Highlighting for the crmsh DSL
Category: config
*/
function(hljs) {
var RESOURCES = 'primitive rsc_template';
var COMMANDS = 'group clone ms master location colocation order fencing_topology ' +
'rsc_ticket acl_target acl_group user role ' +
'tag xml';
var PROPERTY_SETS = 'property rsc_defaults op_defaults';
var KEYWORDS = 'params meta operations op rule attributes utilization';
var OPERATORS = 'read write deny defined not_defined in_range date spec in ' +
'ref reference attribute type xpath version and or lt gt tag ' +
'lte gte eq ne \\';
var TYPES = 'number string';
var LITERALS = 'Master Started Slave Stopped start promote demote stop monitor true false';
return {
aliases: ['crm', 'pcmk'],
case_insensitive: true,
keywords: {
keyword: KEYWORDS + ' ' + OPERATORS + ' ' + TYPES,
literal: LITERALS
},
contains: [
hljs.HASH_COMMENT_MODE,
{
beginKeywords: 'node',
starts: {
end: '\\s*([\\w_-]+:)?',
starts: {
className: 'title',
end: '\\s*[\\$\\w_][\\w_-]*'
}
}
},
{
beginKeywords: RESOURCES,
starts: {
className: 'title',
end: '\\s*[\\$\\w_][\\w_-]*',
starts: {
end: '\\s*@?[\\w_][\\w_\\.:-]*'
}
}
},
{
begin: '\\b(' + COMMANDS.split(' ').join('|') + ')\\s+',
keywords: COMMANDS,
starts: {
className: 'title',
end: '[\\$\\w_][\\w_-]*'
}
},
{
beginKeywords: PROPERTY_SETS,
starts: {
className: 'title',
end: '\\s*([\\w_-]+:)?'
}
},
hljs.QUOTE_STRING_MODE,
{
className: 'meta',
begin: '(ocf|systemd|service|lsb):[\\w_:-]+',
relevance: 0
},
{
className: 'number',
begin: '\\b\\d+(\\.\\d+)?(ms|s|h|m)?',
relevance: 0
},
{
className: 'literal',
begin: '[-]?(infinity|inf)',
relevance: 0
},
{
className: 'attr',
begin: /([A-Za-z\$_\#][\w_-]+)=/,
relevance: 0
},
{
className: 'tag',
begin: '</?',
end: '/?>',
relevance: 0
}
]
};
}

View File

@ -0,0 +1,181 @@
/*
Language: Crystal
Author: TSUYUSATO Kitsune <make.just.on@gmail.com>
*/
function(hljs) {
var NUM_SUFFIX = '(_[uif](8|16|32|64))?';
var CRYSTAL_IDENT_RE = '[a-zA-Z_]\\w*[!?=]?';
var RE_STARTER = '!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|' +
'>>|>|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~';
var CRYSTAL_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\][=?]?';
var CRYSTAL_KEYWORDS = {
keyword:
'abstract alias as asm begin break case class def do else elsif end ensure enum extend for fun if ifdef ' +
'include instance_sizeof is_a? lib macro module next of out pointerof private protected rescue responds_to? ' +
'return require self sizeof struct super then type typeof union unless until when while with yield ' +
'__DIR__ __FILE__ __LINE__',
literal: 'false nil true'
};
var SUBST = {
className: 'subst',
begin: '#{', end: '}',
keywords: CRYSTAL_KEYWORDS
};
var EXPANSION = {
className: 'template-variable',
variants: [
{begin: '\\{\\{', end: '\\}\\}'},
{begin: '\\{%', end: '%\\}'}
],
keywords: CRYSTAL_KEYWORDS
};
function recursiveParen(begin, end) {
var
contains = [{begin: begin, end: end}];
contains[0].contains = contains;
return contains;
}
var STRING = {
className: 'string',
contains: [hljs.BACKSLASH_ESCAPE, SUBST],
variants: [
{begin: /'/, end: /'/},
{begin: /"/, end: /"/},
{begin: /`/, end: /`/},
{begin: '%w?\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')},
{begin: '%w?\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')},
{begin: '%w?{', end: '}', contains: recursiveParen('{', '}')},
{begin: '%w?<', end: '>', contains: recursiveParen('<', '>')},
{begin: '%w?/', end: '/'},
{begin: '%w?%', end: '%'},
{begin: '%w?-', end: '-'},
{begin: '%w?\\|', end: '\\|'},
],
relevance: 0,
};
var REGEXP = {
begin: '(' + RE_STARTER + ')\\s*',
contains: [
{
className: 'regexp',
contains: [hljs.BACKSLASH_ESCAPE, SUBST],
variants: [
{begin: '//[a-z]*', relevance: 0},
{begin: '/', end: '/[a-z]*'},
{begin: '%r\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')},
{begin: '%r\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')},
{begin: '%r{', end: '}', contains: recursiveParen('{', '}')},
{begin: '%r<', end: '>', contains: recursiveParen('<', '>')},
{begin: '%r/', end: '/'},
{begin: '%r%', end: '%'},
{begin: '%r-', end: '-'},
{begin: '%r\\|', end: '\\|'},
]
}
],
relevance: 0
};
var REGEXP2 = {
className: 'regexp',
contains: [hljs.BACKSLASH_ESCAPE, SUBST],
variants: [
{begin: '%r\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')},
{begin: '%r\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')},
{begin: '%r{', end: '}', contains: recursiveParen('{', '}')},
{begin: '%r<', end: '>', contains: recursiveParen('<', '>')},
{begin: '%r/', end: '/'},
{begin: '%r%', end: '%'},
{begin: '%r-', end: '-'},
{begin: '%r\\|', end: '\\|'},
],
relevance: 0
};
var ATTRIBUTE = {
className: 'meta',
begin: '@\\[', end: '\\]',
contains: [
hljs.inherit(hljs.QUOTE_STRING_MODE, {className: 'meta-string'})
]
};
var CRYSTAL_DEFAULT_CONTAINS = [
EXPANSION,
STRING,
REGEXP,
REGEXP2,
ATTRIBUTE,
hljs.HASH_COMMENT_MODE,
{
className: 'class',
beginKeywords: 'class module struct', end: '$|;',
illegal: /=/,
contains: [
hljs.HASH_COMMENT_MODE,
hljs.inherit(hljs.TITLE_MODE, {begin: '[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?'}),
{begin: '<'} // relevance booster for inheritance
]
},
{
className: 'class',
beginKeywords: 'lib enum union', end: '$|;',
illegal: /=/,
contains: [
hljs.HASH_COMMENT_MODE,
hljs.inherit(hljs.TITLE_MODE, {begin: '[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?'}),
],
relevance: 10
},
{
className: 'function',
beginKeywords: 'def', end: /\B\b/,
contains: [
hljs.inherit(hljs.TITLE_MODE, {
begin: CRYSTAL_METHOD_RE,
endsParent: true
})
]
},
{
className: 'function',
beginKeywords: 'fun macro', end: /\B\b/,
contains: [
hljs.inherit(hljs.TITLE_MODE, {
begin: CRYSTAL_METHOD_RE,
endsParent: true
})
],
relevance: 5
},
{
className: 'symbol',
begin: hljs.UNDERSCORE_IDENT_RE + '(\\!|\\?)?:',
relevance: 0
},
{
className: 'symbol',
begin: ':',
contains: [STRING, {begin: CRYSTAL_METHOD_RE}],
relevance: 0
},
{
className: 'number',
variants: [
{ begin: '\\b0b([01_]*[01])' + NUM_SUFFIX },
{ begin: '\\b0o([0-7_]*[0-7])' + NUM_SUFFIX },
{ begin: '\\b0x([A-Fa-f0-9_]*[A-Fa-f0-9])' + NUM_SUFFIX },
{ begin: '\\b(([0-9][0-9_]*[0-9]|[0-9])(\\.[0-9_]*[0-9])?([eE][+-]?[0-9_]*[0-9])?)' + NUM_SUFFIX}
],
relevance: 0
}
];
SUBST.contains = CRYSTAL_DEFAULT_CONTAINS;
EXPANSION.contains = CRYSTAL_DEFAULT_CONTAINS.slice(1); // without EXPANSION
return {
aliases: ['cr'],
lexemes: CRYSTAL_IDENT_RE,
keywords: CRYSTAL_KEYWORDS,
contains: CRYSTAL_DEFAULT_CONTAINS
};
}

View File

@ -0,0 +1,172 @@
/*
Language: C#
Author: Jason Diamond <jason@diamond.name>
Category: common
*/
function(hljs) {
var KEYWORDS = {
keyword:
// Normal keywords.
'abstract as base bool break byte case catch char checked const continue decimal ' +
'default delegate do double else enum event explicit extern finally fixed float ' +
'for foreach goto if implicit in int interface internal is lock long ' +
'object operator out override params private protected public readonly ref sbyte ' +
'sealed short sizeof stackalloc static string struct switch this try typeof ' +
'uint ulong unchecked unsafe ushort using virtual void volatile while ' +
'nameof ' +
// Contextual keywords.
'add alias ascending async await by descending dynamic equals from get global group into join ' +
'let on orderby partial remove select set value var where yield',
literal:
'null false true'
};
var VERBATIM_STRING = {
className: 'string',
begin: '@"', end: '"',
contains: [{begin: '""'}]
};
var VERBATIM_STRING_NO_LF = hljs.inherit(VERBATIM_STRING, {illegal: /\n/});
var SUBST = {
className: 'subst',
begin: '{', end: '}',
keywords: KEYWORDS
};
var SUBST_NO_LF = hljs.inherit(SUBST, {illegal: /\n/});
var INTERPOLATED_STRING = {
className: 'string',
begin: /\$"/, end: '"',
illegal: /\n/,
contains: [{begin: '{{'}, {begin: '}}'}, hljs.BACKSLASH_ESCAPE, SUBST_NO_LF]
};
var INTERPOLATED_VERBATIM_STRING = {
className: 'string',
begin: /\$@"/, end: '"',
contains: [{begin: '{{'}, {begin: '}}'}, {begin: '""'}, SUBST]
};
var INTERPOLATED_VERBATIM_STRING_NO_LF = hljs.inherit(INTERPOLATED_VERBATIM_STRING, {
illegal: /\n/,
contains: [{begin: '{{'}, {begin: '}}'}, {begin: '""'}, SUBST_NO_LF]
});
SUBST.contains = [
INTERPOLATED_VERBATIM_STRING,
INTERPOLATED_STRING,
VERBATIM_STRING,
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
hljs.C_BLOCK_COMMENT_MODE
];
SUBST_NO_LF.contains = [
INTERPOLATED_VERBATIM_STRING_NO_LF,
INTERPOLATED_STRING,
VERBATIM_STRING_NO_LF,
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
hljs.inherit(hljs.C_BLOCK_COMMENT_MODE, {illegal: /\n/})
];
var STRING = {
variants: [
INTERPOLATED_VERBATIM_STRING,
INTERPOLATED_STRING,
VERBATIM_STRING,
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE
]
};
var TYPE_IDENT_RE = hljs.IDENT_RE + '(<' + hljs.IDENT_RE + '(\\s*,\\s*' + hljs.IDENT_RE + ')*>)?(\\[\\])?';
return {
aliases: ['csharp'],
keywords: KEYWORDS,
illegal: /::/,
contains: [
hljs.COMMENT(
'///',
'$',
{
returnBegin: true,
contains: [
{
className: 'doctag',
variants: [
{
begin: '///', relevance: 0
},
{
begin: '<!--|-->'
},
{
begin: '</?', end: '>'
}
]
}
]
}
),
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'meta',
begin: '#', end: '$',
keywords: {'meta-keyword': 'if else elif endif define undef warning error line region endregion pragma checksum'}
},
STRING,
hljs.C_NUMBER_MODE,
{
beginKeywords: 'class interface', end: /[{;=]/,
illegal: /[^\s:]/,
contains: [
hljs.TITLE_MODE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
},
{
beginKeywords: 'namespace', end: /[{;=]/,
illegal: /[^\s:]/,
contains: [
hljs.inherit(hljs.TITLE_MODE, {begin: '[a-zA-Z](\\.?\\w)*'}),
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
},
{
// Expression keywords prevent 'keyword Name(...)' from being
// recognized as a function definition
beginKeywords: 'new return throw await',
relevance: 0
},
{
className: 'function',
begin: '(' + TYPE_IDENT_RE + '\\s+)+' + hljs.IDENT_RE + '\\s*\\(', returnBegin: true, end: /[{;=]/,
excludeEnd: true,
keywords: KEYWORDS,
contains: [
{
begin: hljs.IDENT_RE + '\\s*\\(', returnBegin: true,
contains: [hljs.TITLE_MODE],
relevance: 0
},
{
className: 'params',
begin: /\(/, end: /\)/,
excludeBegin: true,
excludeEnd: true,
keywords: KEYWORDS,
relevance: 0,
contains: [
STRING,
hljs.C_NUMBER_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
},
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
}
]
};
}

View File

@ -0,0 +1,29 @@
/*
Language: CSP
Description: Content Security Policy definition highlighting
Author: Taras <oxdef@oxdef.info>
vim: ts=2 sw=2 st=2
*/
function(hljs) {
return {
case_insensitive: false,
lexemes: '[a-zA-Z][a-zA-Z0-9_-]*',
keywords: {
keyword: 'base-uri child-src connect-src default-src font-src form-action' +
' frame-ancestors frame-src img-src media-src object-src plugin-types' +
' report-uri sandbox script-src style-src',
},
contains: [
{
className: 'string',
begin: "'", end: "'"
},
{
className: 'attribute',
begin: '^Content', end: ':', excludeEnd: true,
},
]
};
}

View File

@ -0,0 +1,109 @@
/*
Language: CSS
Category: common, css
*/
function(hljs) {
var IDENT_RE = '[a-zA-Z-][a-zA-Z0-9_-]*';
var RULE = {
begin: /[A-Z\_\.\-]+\s*:/, returnBegin: true, end: ';', endsWithParent: true,
contains: [
{
className: 'attribute',
begin: /\S/, end: ':', excludeEnd: true,
starts: {
endsWithParent: true, excludeEnd: true,
contains: [
{
begin: /[\w-]+\(/, returnBegin: true,
contains: [
{
className: 'built_in',
begin: /[\w-]+/
},
{
begin: /\(/, end: /\)/,
contains: [
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE
]
}
]
},
hljs.CSS_NUMBER_MODE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'number', begin: '#[0-9A-Fa-f]+'
},
{
className: 'meta', begin: '!important'
}
]
}
}
]
};
return {
case_insensitive: true,
illegal: /[=\/|'\$]/,
contains: [
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'selector-id', begin: /#[A-Za-z0-9_-]+/
},
{
className: 'selector-class', begin: /\.[A-Za-z0-9_-]+/
},
{
className: 'selector-attr',
begin: /\[/, end: /\]/,
illegal: '$'
},
{
className: 'selector-pseudo',
begin: /:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/
},
{
begin: '@(font-face|page)',
lexemes: '[a-z-]+',
keywords: 'font-face page'
},
{
begin: '@', end: '[{;]', // at_rule eating first "{" is a good thing
// because it doesnt let it to be parsed as
// a rule set but instead drops parser into
// the default mode which is how it should be.
illegal: /:/, // break on Less variables @var: ...
contains: [
{
className: 'keyword',
begin: /\w+/
},
{
begin: /\s/, endsWithParent: true, excludeEnd: true,
relevance: 0,
contains: [
hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE,
hljs.CSS_NUMBER_MODE
]
}
]
},
{
className: 'selector-tag', begin: IDENT_RE,
relevance: 0
},
{
begin: '{', end: '}',
illegal: /\S/,
contains: [
hljs.C_BLOCK_COMMENT_MODE,
RULE,
]
}
]
};
}

View File

@ -0,0 +1,265 @@
/*
Language: D
Author: Aleksandar Ruzicic <aleksandar@ruzicic.info>
Description: D is a language with C-like syntax and static typing. It pragmatically combines efficiency, control, and modeling power, with safety and programmer productivity.
Version: 1.0a
Date: 2012-04-08
*/
/**
* Known issues:
*
* - invalid hex string literals will be recognized as a double quoted strings
* but 'x' at the beginning of string will not be matched
*
* - delimited string literals are not checked for matching end delimiter
* (not possible to do with js regexp)
*
* - content of token string is colored as a string (i.e. no keyword coloring inside a token string)
* also, content of token string is not validated to contain only valid D tokens
*
* - special token sequence rule is not strictly following D grammar (anything following #line
* up to the end of line is matched as special token sequence)
*/
function(hljs) {
/**
* Language keywords
*
* @type {Object}
*/
var D_KEYWORDS = {
keyword:
'abstract alias align asm assert auto body break byte case cast catch class ' +
'const continue debug default delete deprecated do else enum export extern final ' +
'finally for foreach foreach_reverse|10 goto if immutable import in inout int ' +
'interface invariant is lazy macro mixin module new nothrow out override package ' +
'pragma private protected public pure ref return scope shared static struct ' +
'super switch synchronized template this throw try typedef typeid typeof union ' +
'unittest version void volatile while with __FILE__ __LINE__ __gshared|10 ' +
'__thread __traits __DATE__ __EOF__ __TIME__ __TIMESTAMP__ __VENDOR__ __VERSION__',
built_in:
'bool cdouble cent cfloat char creal dchar delegate double dstring float function ' +
'idouble ifloat ireal long real short string ubyte ucent uint ulong ushort wchar ' +
'wstring',
literal:
'false null true'
};
/**
* Number literal regexps
*
* @type {String}
*/
var decimal_integer_re = '(0|[1-9][\\d_]*)',
decimal_integer_nosus_re = '(0|[1-9][\\d_]*|\\d[\\d_]*|[\\d_]+?\\d)',
binary_integer_re = '0[bB][01_]+',
hexadecimal_digits_re = '([\\da-fA-F][\\da-fA-F_]*|_[\\da-fA-F][\\da-fA-F_]*)',
hexadecimal_integer_re = '0[xX]' + hexadecimal_digits_re,
decimal_exponent_re = '([eE][+-]?' + decimal_integer_nosus_re + ')',
decimal_float_re = '(' + decimal_integer_nosus_re + '(\\.\\d*|' + decimal_exponent_re + ')|' +
'\\d+\\.' + decimal_integer_nosus_re + decimal_integer_nosus_re + '|' +
'\\.' + decimal_integer_re + decimal_exponent_re + '?' +
')',
hexadecimal_float_re = '(0[xX](' +
hexadecimal_digits_re + '\\.' + hexadecimal_digits_re + '|'+
'\\.?' + hexadecimal_digits_re +
')[pP][+-]?' + decimal_integer_nosus_re + ')',
integer_re = '(' +
decimal_integer_re + '|' +
binary_integer_re + '|' +
hexadecimal_integer_re +
')',
float_re = '(' +
hexadecimal_float_re + '|' +
decimal_float_re +
')';
/**
* Escape sequence supported in D string and character literals
*
* @type {String}
*/
var escape_sequence_re = '\\\\(' +
'[\'"\\?\\\\abfnrtv]|' + // common escapes
'u[\\dA-Fa-f]{4}|' + // four hex digit unicode codepoint
'[0-7]{1,3}|' + // one to three octal digit ascii char code
'x[\\dA-Fa-f]{2}|' + // two hex digit ascii char code
'U[\\dA-Fa-f]{8}' + // eight hex digit unicode codepoint
')|' +
'&[a-zA-Z\\d]{2,};'; // named character entity
/**
* D integer number literals
*
* @type {Object}
*/
var D_INTEGER_MODE = {
className: 'number',
begin: '\\b' + integer_re + '(L|u|U|Lu|LU|uL|UL)?',
relevance: 0
};
/**
* [D_FLOAT_MODE description]
* @type {Object}
*/
var D_FLOAT_MODE = {
className: 'number',
begin: '\\b(' +
float_re + '([fF]|L|i|[fF]i|Li)?|' +
integer_re + '(i|[fF]i|Li)' +
')',
relevance: 0
};
/**
* D character literal
*
* @type {Object}
*/
var D_CHARACTER_MODE = {
className: 'string',
begin: '\'(' + escape_sequence_re + '|.)', end: '\'',
illegal: '.'
};
/**
* D string escape sequence
*
* @type {Object}
*/
var D_ESCAPE_SEQUENCE = {
begin: escape_sequence_re,
relevance: 0
};
/**
* D double quoted string literal
*
* @type {Object}
*/
var D_STRING_MODE = {
className: 'string',
begin: '"',
contains: [D_ESCAPE_SEQUENCE],
end: '"[cwd]?'
};
/**
* D wysiwyg and delimited string literals
*
* @type {Object}
*/
var D_WYSIWYG_DELIMITED_STRING_MODE = {
className: 'string',
begin: '[rq]"',
end: '"[cwd]?',
relevance: 5
};
/**
* D alternate wysiwyg string literal
*
* @type {Object}
*/
var D_ALTERNATE_WYSIWYG_STRING_MODE = {
className: 'string',
begin: '`',
end: '`[cwd]?'
};
/**
* D hexadecimal string literal
*
* @type {Object}
*/
var D_HEX_STRING_MODE = {
className: 'string',
begin: 'x"[\\da-fA-F\\s\\n\\r]*"[cwd]?',
relevance: 10
};
/**
* D delimited string literal
*
* @type {Object}
*/
var D_TOKEN_STRING_MODE = {
className: 'string',
begin: 'q"\\{',
end: '\\}"'
};
/**
* Hashbang support
*
* @type {Object}
*/
var D_HASHBANG_MODE = {
className: 'meta',
begin: '^#!',
end: '$',
relevance: 5
};
/**
* D special token sequence
*
* @type {Object}
*/
var D_SPECIAL_TOKEN_SEQUENCE_MODE = {
className: 'meta',
begin: '#(line)',
end: '$',
relevance: 5
};
/**
* D attributes
*
* @type {Object}
*/
var D_ATTRIBUTE_MODE = {
className: 'keyword',
begin: '@[a-zA-Z_][a-zA-Z_\\d]*'
};
/**
* D nesting comment
*
* @type {Object}
*/
var D_NESTING_COMMENT_MODE = hljs.COMMENT(
'\\/\\+',
'\\+\\/',
{
contains: ['self'],
relevance: 10
}
);
return {
lexemes: hljs.UNDERSCORE_IDENT_RE,
keywords: D_KEYWORDS,
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
D_NESTING_COMMENT_MODE,
D_HEX_STRING_MODE,
D_STRING_MODE,
D_WYSIWYG_DELIMITED_STRING_MODE,
D_ALTERNATE_WYSIWYG_STRING_MODE,
D_TOKEN_STRING_MODE,
D_FLOAT_MODE,
D_INTEGER_MODE,
D_CHARACTER_MODE,
D_HASHBANG_MODE,
D_SPECIAL_TOKEN_SEQUENCE_MODE,
D_ATTRIBUTE_MODE
]
};
}

View File

@ -0,0 +1,109 @@
/*
Language: Dart
Requires: markdown.js
Author: Maxim Dikun <dikmax@gmail.com>
Description: Dart is a JavaScript replacement language developed by Google. For more information see http://dartlang.org/
Category: scripting
*/
function (hljs) {
var SUBST = {
className: 'subst',
begin: '\\$\\{', end: '}',
keywords: 'true false null this is new super'
};
var STRING = {
className: 'string',
variants: [
{
begin: 'r\'\'\'', end: '\'\'\''
},
{
begin: 'r"""', end: '"""'
},
{
begin: 'r\'', end: '\'',
illegal: '\\n'
},
{
begin: 'r"', end: '"',
illegal: '\\n'
},
{
begin: '\'\'\'', end: '\'\'\'',
contains: [hljs.BACKSLASH_ESCAPE, SUBST]
},
{
begin: '"""', end: '"""',
contains: [hljs.BACKSLASH_ESCAPE, SUBST]
},
{
begin: '\'', end: '\'',
illegal: '\\n',
contains: [hljs.BACKSLASH_ESCAPE, SUBST]
},
{
begin: '"', end: '"',
illegal: '\\n',
contains: [hljs.BACKSLASH_ESCAPE, SUBST]
}
]
};
SUBST.contains = [
hljs.C_NUMBER_MODE, STRING
];
var KEYWORDS = {
keyword: 'assert async await break case catch class const continue default do else enum extends false final ' +
'finally for if in is new null rethrow return super switch sync this throw true try var void while with yield ' +
'abstract as dynamic export external factory get implements import library operator part set static typedef',
built_in:
// dart:core
'print Comparable DateTime Duration Function Iterable Iterator List Map Match Null Object Pattern RegExp Set ' +
'Stopwatch String StringBuffer StringSink Symbol Type Uri bool double int num ' +
// dart:html
'document window querySelector querySelectorAll Element ElementList'
};
return {
keywords: KEYWORDS,
contains: [
STRING,
hljs.COMMENT(
'/\\*\\*',
'\\*/',
{
subLanguage: 'markdown'
}
),
hljs.COMMENT(
'///',
'$',
{
subLanguage: 'markdown'
}
),
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'class',
beginKeywords: 'class interface', end: '{', excludeEnd: true,
contains: [
{
beginKeywords: 'extends implements'
},
hljs.UNDERSCORE_TITLE_MODE
]
},
hljs.C_NUMBER_MODE,
{
className: 'meta', begin: '@[A-Za-z]+'
},
{
begin: '=>' // No markup, just a relevance booster
}
]
}
}

View File

@ -0,0 +1,75 @@
/*
Language: Delphi
*/
function(hljs) {
var KEYWORDS =
'exports register file shl array record property for mod while set ally label uses raise not ' +
'stored class safecall var interface or private static exit index inherited to else stdcall ' +
'override shr asm far resourcestring finalization packed virtual out and protected library do ' +
'xorwrite goto near function end div overload object unit begin string on inline repeat until ' +
'destructor write message program with read initialization except default nil if case cdecl in ' +
'downto threadvar of try pascal const external constructor type public then implementation ' +
'finally published procedure absolute reintroduce operator as is abstract alias assembler ' +
'bitpacked break continue cppdecl cvar enumerator experimental platform deprecated ' +
'unimplemented dynamic export far16 forward generic helper implements interrupt iochecks ' +
'local name nodefault noreturn nostackframe oldfpccall otherwise saveregisters softfloat ' +
'specialize strict unaligned varargs ';
var COMMENT_MODES = [
hljs.C_LINE_COMMENT_MODE,
hljs.COMMENT(
/\{/,
/\}/,
{
relevance: 0
}
),
hljs.COMMENT(
/\(\*/,
/\*\)/,
{
relevance: 10
}
)
];
var STRING = {
className: 'string',
begin: /'/, end: /'/,
contains: [{begin: /''/}]
};
var CHAR_STRING = {
className: 'string', begin: /(#\d+)+/
};
var CLASS = {
begin: hljs.IDENT_RE + '\\s*=\\s*class\\s*\\(', returnBegin: true,
contains: [
hljs.TITLE_MODE
]
};
var FUNCTION = {
className: 'function',
beginKeywords: 'function constructor destructor procedure', end: /[:;]/,
keywords: 'function constructor|10 destructor|10 procedure|10',
contains: [
hljs.TITLE_MODE,
{
className: 'params',
begin: /\(/, end: /\)/,
keywords: KEYWORDS,
contains: [STRING, CHAR_STRING]
}
].concat(COMMENT_MODES)
};
return {
aliases: ['dpr', 'dfm', 'pas', 'pascal', 'freepascal', 'lazarus', 'lpr', 'lfm'],
case_insensitive: true,
keywords: KEYWORDS,
illegal: /"|\$[G-Zg-z]|\/\*|<\/|\|/,
contains: [
STRING, CHAR_STRING,
hljs.NUMBER_MODE,
CLASS,
FUNCTION
].concat(COMMENT_MODES)
};
}

View File

@ -0,0 +1,46 @@
/*
Language: Diff
Description: Unified and context diff
Author: Vasily Polovnyov <vast@whiteants.net>
Category: common
*/
function(hljs) {
return {
aliases: ['patch'],
contains: [
{
className: 'meta',
relevance: 10,
variants: [
{begin: /^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},
{begin: /^\*\*\* +\d+,\d+ +\*\*\*\*$/},
{begin: /^\-\-\- +\d+,\d+ +\-\-\-\-$/}
]
},
{
className: 'comment',
variants: [
{begin: /Index: /, end: /$/},
{begin: /={3,}/, end: /$/},
{begin: /^\-{3}/, end: /$/},
{begin: /^\*{3} /, end: /$/},
{begin: /^\+{3}/, end: /$/},
{begin: /\*{5}/, end: /\*{5}$/}
]
},
{
className: 'addition',
begin: '^\\+', end: '$'
},
{
className: 'deletion',
begin: '^\\-', end: '$'
},
{
className: 'addition',
begin: '^\\!', end: '$'
}
]
};
}

View File

@ -0,0 +1,71 @@
/*
Language: Django
Requires: xml.js
Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
Contributors: Ilya Baryshev <baryshev@gmail.com>
Category: template
*/
function(hljs) {
var FILTER = {
begin: /\|[A-Za-z]+:?/,
keywords: {
name:
'truncatewords removetags linebreaksbr yesno get_digit timesince random striptags ' +
'filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands ' +
'title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode ' +
'timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort ' +
'dictsortreversed default_if_none pluralize lower join center default ' +
'truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first ' +
'escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize ' +
'localtime utc timezone'
},
contains: [
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE
]
};
return {
aliases: ['jinja'],
case_insensitive: true,
subLanguage: 'xml',
contains: [
hljs.COMMENT(/\{%\s*comment\s*%}/, /\{%\s*endcomment\s*%}/),
hljs.COMMENT(/\{#/, /#}/),
{
className: 'template-tag',
begin: /\{%/, end: /%}/,
contains: [
{
className: 'name',
begin: /\w+/,
keywords: {
name:
'comment endcomment load templatetag ifchanged endifchanged if endif firstof for ' +
'endfor ifnotequal endifnotequal widthratio extends include spaceless ' +
'endspaceless regroup ifequal endifequal ssi now with cycle url filter ' +
'endfilter debug block endblock else autoescape endautoescape csrf_token empty elif ' +
'endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix ' +
'plural get_current_language language get_available_languages ' +
'get_current_language_bidi get_language_info get_language_info_list localize ' +
'endlocalize localtime endlocaltime timezone endtimezone get_current_timezone ' +
'verbatim'
},
starts: {
endsWithParent: true,
keywords: 'in by as',
contains: [FILTER],
relevance: 0
}
}
]
},
{
className: 'template-variable',
begin: /\{\{/, end: /}}/,
contains: [FILTER]
}
]
};
}

View File

@ -0,0 +1,34 @@
/*
Language: DNS Zone file
Author: Tim Schumacher <tim@datenknoten.me>
Category: config
*/
function(hljs) {
return {
aliases: ['bind', 'zone'],
keywords: {
keyword:
'IN A AAAA AFSDB APL CAA CDNSKEY CDS CERT CNAME DHCID DLV DNAME DNSKEY DS HIP IPSECKEY KEY KX ' +
'LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM PTR RRSIG RP SIG SOA SRV SSHFP TA TKEY TLSA TSIG TXT'
},
contains: [
hljs.COMMENT(';', '$', {relevance: 0}),
{
className: 'meta',
begin: /^\$(TTL|GENERATE|INCLUDE|ORIGIN)\b/
},
// IPv6
{
className: 'number',
begin: '((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))\\b'
},
// IPv4
{
className: 'number',
begin: '((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\b'
},
hljs.inherit(hljs.NUMBER_MODE, {begin: /\b\d+[dhwm]?/})
]
};
}

View File

@ -0,0 +1,29 @@
/*
Language: Dockerfile
Requires: bash.js
Author: Alexis Hénaut <alexis@henaut.net>
Description: language definition for Dockerfile files
Category: config
*/
function(hljs) {
return {
aliases: ['docker'],
case_insensitive: true,
keywords: 'from maintainer expose env user onbuild',
contains: [
hljs.HASH_COMMENT_MODE,
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
hljs.NUMBER_MODE,
{
beginKeywords: 'run cmd entrypoint volume add copy workdir label healthcheck',
starts: {
end: /[^\\]\n/,
subLanguage: 'bash'
}
}
],
illegal: '</'
}
}

View File

@ -0,0 +1,57 @@
/*
Language: DOS .bat
Author: Alexander Makarov <sam@rmcreative.ru>
Contributors: Anton Kochkov <anton.kochkov@gmail.com>
*/
function(hljs) {
var COMMENT = hljs.COMMENT(
/^\s*@?rem\b/, /$/,
{
relevance: 10
}
);
var LABEL = {
className: 'symbol',
begin: '^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)',
relevance: 0
};
return {
aliases: ['bat', 'cmd'],
case_insensitive: true,
illegal: /\/\*/,
keywords: {
keyword:
'if else goto for in do call exit not exist errorlevel defined ' +
'equ neq lss leq gtr geq',
built_in:
'prn nul lpt3 lpt2 lpt1 con com4 com3 com2 com1 aux ' +
'shift cd dir echo setlocal endlocal set pause copy ' +
'append assoc at attrib break cacls cd chcp chdir chkdsk chkntfs cls cmd color ' +
'comp compact convert date dir diskcomp diskcopy doskey erase fs ' +
'find findstr format ftype graftabl help keyb label md mkdir mode more move path ' +
'pause print popd pushd promt rd recover rem rename replace restore rmdir shift' +
'sort start subst time title tree type ver verify vol ' +
// winutils
'ping net ipconfig taskkill xcopy ren del'
},
contains: [
{
className: 'variable', begin: /%%[^ ]|%[^ ]+?%|![^ ]+?!/
},
{
className: 'function',
begin: LABEL.begin, end: 'goto:eof',
contains: [
hljs.inherit(hljs.TITLE_MODE, {begin: '([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*'}),
COMMENT
]
},
{
className: 'number', begin: '\\b\\d+',
relevance: 0
},
COMMENT
]
};
}

View File

@ -0,0 +1,52 @@
/*
Language: dsconfig
Description: dsconfig batch configuration language for LDAP directory servers
Contributors: Jacob Childress <jacobc@gmail.com>
Category: enterprise, config
*/
function(hljs) {
var QUOTED_PROPERTY = {
className: 'string',
begin: /"/, end: /"/
};
var APOS_PROPERTY = {
className: 'string',
begin: /'/, end: /'/
};
var UNQUOTED_PROPERTY = {
className: 'string',
begin: '[\\w-?]+:\\w+', end: '\\W',
relevance: 0
};
var VALUELESS_PROPERTY = {
className: 'string',
begin: '\\w+-?\\w+', end: '\\W',
relevance: 0
};
return {
keywords: 'dsconfig',
contains: [
{
className: 'keyword',
begin: '^dsconfig', end: '\\s', excludeEnd: true,
relevance: 10
},
{
className: 'built_in',
begin: '(list|create|get|set|delete)-(\\w+)', end: '\\s', excludeEnd: true,
illegal: '!@#$%^&*()',
relevance: 10
},
{
className: 'built_in',
begin: '--(\\w+)', end: '\\s', excludeEnd: true
},
QUOTED_PROPERTY,
APOS_PROPERTY,
UNQUOTED_PROPERTY,
VALUELESS_PROPERTY,
hljs.HASH_COMMENT_MODE
]
};
}

View File

@ -0,0 +1,131 @@
/*
Language: Device Tree
Description: *.dts files used in the Linux kernel
Author: Martin Braun <martin.braun@ettus.com>, Moritz Fischer <moritz.fischer@ettus.com>
Category: config
*/
function(hljs) {
var STRINGS = {
className: 'string',
variants: [
hljs.inherit(hljs.QUOTE_STRING_MODE, { begin: '((u8?|U)|L)?"' }),
{
begin: '(u8?|U)?R"', end: '"',
contains: [hljs.BACKSLASH_ESCAPE]
},
{
begin: '\'\\\\?.', end: '\'',
illegal: '.'
}
]
};
var NUMBERS = {
className: 'number',
variants: [
{ begin: '\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)' },
{ begin: hljs.C_NUMBER_RE }
],
relevance: 0
};
var PREPROCESSOR = {
className: 'meta',
begin: '#', end: '$',
keywords: {'meta-keyword': 'if else elif endif define undef ifdef ifndef'},
contains: [
{
begin: /\\\n/, relevance: 0
},
{
beginKeywords: 'include', end: '$',
keywords: {'meta-keyword': 'include'},
contains: [
hljs.inherit(STRINGS, {className: 'meta-string'}),
{
className: 'meta-string',
begin: '<', end: '>',
illegal: '\\n'
}
]
},
STRINGS,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
};
var DTS_REFERENCE = {
className: 'variable',
begin: '\\&[a-z\\d_]*\\b'
};
var DTS_KEYWORD = {
className: 'meta-keyword',
begin: '/[a-z][a-z\\d-]*/'
};
var DTS_LABEL = {
className: 'symbol',
begin: '^\\s*[a-zA-Z_][a-zA-Z\\d_]*:'
};
var DTS_CELL_PROPERTY = {
className: 'params',
begin: '<',
end: '>',
contains: [
NUMBERS,
DTS_REFERENCE
]
};
var DTS_NODE = {
className: 'class',
begin: /[a-zA-Z_][a-zA-Z\d_@]*\s{/,
end: /[{;=]/,
returnBegin: true,
excludeEnd: true
};
var DTS_ROOT_NODE = {
className: 'class',
begin: '/\\s*{',
end: '};',
relevance: 10,
contains: [
DTS_REFERENCE,
DTS_KEYWORD,
DTS_LABEL,
DTS_NODE,
DTS_CELL_PROPERTY,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
NUMBERS,
STRINGS
]
};
return {
keywords: "",
contains: [
DTS_ROOT_NODE,
DTS_REFERENCE,
DTS_KEYWORD,
DTS_LABEL,
DTS_NODE,
DTS_CELL_PROPERTY,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
NUMBERS,
STRINGS,
PREPROCESSOR,
{
begin: hljs.IDENT_RE + '::',
keywords: ""
}
]
};
}

View File

@ -0,0 +1,39 @@
/*
Language: Dust
Requires: xml.js
Author: Michael Allen <michael.allen@benefitfocus.com>
Description: Matcher for dust.js templates.
Category: template
*/
function(hljs) {
var EXPRESSION_KEYWORDS = 'if eq ne lt lte gt gte select default math sep';
return {
aliases: ['dst'],
case_insensitive: true,
subLanguage: 'xml',
contains: [
{
className: 'template-tag',
begin: /\{[#\/]/, end: /\}/, illegal: /;/,
contains: [
{
className: 'name',
begin: /[a-zA-Z\.-]+/,
starts: {
endsWithParent: true, relevance: 0,
contains: [
hljs.QUOTE_STRING_MODE
]
}
}
]
},
{
className: 'template-variable',
begin: /\{/, end: /\}/, illegal: /;/,
keywords: EXPRESSION_KEYWORDS
}
]
};
}

View File

@ -0,0 +1,37 @@
/*
Language: Extended Backus-Naur Form
Author: Alex McKibben <alex@nullscope.net>
*/
function(hljs) {
var commentMode = hljs.COMMENT(/\(\*/, /\*\)/);
var nonTerminalMode = {
className: "attribute",
begin: /^[ ]*[a-zA-Z][a-zA-Z-]*([\s-]+[a-zA-Z][a-zA-Z]*)*/
};
var specialSequenceMode = {
className: "meta",
begin: /\?.*\?/
};
var ruleBodyMode = {
begin: /=/, end: /;/,
contains: [
commentMode,
specialSequenceMode,
// terminals
hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE
]
};
return {
illegal: /\S/,
contains: [
commentMode,
nonTerminalMode,
ruleBodyMode
]
};
}

View File

@ -0,0 +1,103 @@
/*
Language: Elixir
Author: Josh Adams <josh@isotope11.com>
Description: language definition for Elixir source code files (.ex and .exs). Based on ruby language support.
Category: functional
*/
function(hljs) {
var ELIXIR_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?';
var ELIXIR_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?';
var ELIXIR_KEYWORDS =
'and false then defined module in return redo retry end for true self when ' +
'next until do begin unless nil break not case cond alias while ensure or ' +
'include use alias fn quote';
var SUBST = {
className: 'subst',
begin: '#\\{', end: '}',
lexemes: ELIXIR_IDENT_RE,
keywords: ELIXIR_KEYWORDS
};
var STRING = {
className: 'string',
contains: [hljs.BACKSLASH_ESCAPE, SUBST],
variants: [
{
begin: /'/, end: /'/
},
{
begin: /"/, end: /"/
}
]
};
var FUNCTION = {
className: 'function',
beginKeywords: 'def defp defmacro', end: /\B\b/, // the mode is ended by the title
contains: [
hljs.inherit(hljs.TITLE_MODE, {
begin: ELIXIR_IDENT_RE,
endsParent: true
})
]
};
var CLASS = hljs.inherit(FUNCTION, {
className: 'class',
beginKeywords: 'defimpl defmodule defprotocol defrecord', end: /\bdo\b|$|;/
});
var ELIXIR_DEFAULT_CONTAINS = [
STRING,
hljs.HASH_COMMENT_MODE,
CLASS,
FUNCTION,
{
className: 'symbol',
begin: ':(?!\\s)',
contains: [STRING, {begin: ELIXIR_METHOD_RE}],
relevance: 0
},
{
className: 'symbol',
begin: ELIXIR_IDENT_RE + ':',
relevance: 0
},
{
className: 'number',
begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b',
relevance: 0
},
{
className: 'variable',
begin: '(\\$\\W)|((\\$|\\@\\@?)(\\w+))'
},
{
begin: '->'
},
{ // regexp container
begin: '(' + hljs.RE_STARTERS_RE + ')\\s*',
contains: [
hljs.HASH_COMMENT_MODE,
{
className: 'regexp',
illegal: '\\n',
contains: [hljs.BACKSLASH_ESCAPE, SUBST],
variants: [
{
begin: '/', end: '/[a-z]*'
},
{
begin: '%r\\[', end: '\\][a-z]*'
}
]
}
],
relevance: 0
}
];
SUBST.contains = ELIXIR_DEFAULT_CONTAINS;
return {
lexemes: ELIXIR_IDENT_RE,
keywords: ELIXIR_KEYWORDS,
contains: ELIXIR_DEFAULT_CONTAINS
};
}

View File

@ -0,0 +1,88 @@
/*
Language: Elm
Author: Janis Voigtlaender <janis.voigtlaender@gmail.com>
Category: functional
*/
function(hljs) {
var COMMENT = {
variants: [
hljs.COMMENT('--', '$'),
hljs.COMMENT(
'{-',
'-}',
{
contains: ['self']
}
)
]
};
var CONSTRUCTOR = {
className: 'type',
begin: '\\b[A-Z][\\w\']*', // TODO: other constructors (built-in, infix).
relevance: 0
};
var LIST = {
begin: '\\(', end: '\\)',
illegal: '"',
contains: [
{className: 'type', begin: '\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?'},
COMMENT
]
};
var RECORD = {
begin: '{', end: '}',
contains: LIST.contains
};
return {
keywords:
'let in if then else case of where module import exposing ' +
'type alias as infix infixl infixr port effect command subscription',
contains: [
// Top-level constructions.
{
beginKeywords: 'port effect module', end: 'exposing',
keywords: 'port effect module where command subscription exposing',
contains: [LIST, COMMENT],
illegal: '\\W\\.|;'
},
{
begin: 'import', end: '$',
keywords: 'import as exposing',
contains: [LIST, COMMENT],
illegal: '\\W\\.|;'
},
{
begin: 'type', end: '$',
keywords: 'type alias',
contains: [CONSTRUCTOR, LIST, RECORD, COMMENT]
},
{
beginKeywords: 'infix infixl infixr', end: '$',
contains: [hljs.C_NUMBER_MODE, COMMENT]
},
{
begin: 'port', end: '$',
keywords: 'port',
contains: [COMMENT]
},
// Literals and names.
// TODO: characters.
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
CONSTRUCTOR,
hljs.inherit(hljs.TITLE_MODE, {begin: '^[_a-z][\\w\']*'}),
COMMENT,
{begin: '->|<-'} // No markup, relevance booster
]
};
}

View File

@ -0,0 +1,23 @@
/*
Language: ERB (Embedded Ruby)
Requires: xml.js, ruby.js
Author: Lucas Mazza <lucastmazza@gmail.com>
Contributors: Kassio Borges <kassioborgesm@gmail.com>
Description: "Bridge" language defining fragments of Ruby in HTML within <% .. %>
Category: template
*/
function(hljs) {
return {
subLanguage: 'xml',
contains: [
hljs.COMMENT('<%#', '%>'),
{
begin: '<%[%=-]?', end: '[%-]?%>',
subLanguage: 'ruby',
excludeBegin: true,
excludeEnd: true
}
]
};
}

View File

@ -0,0 +1,51 @@
/*
Language: Erlang REPL
Author: Sergey Ignatov <sergey@ignatov.spb.su>
Category: functional
*/
function(hljs) {
return {
keywords: {
built_in:
'spawn spawn_link self',
keyword:
'after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if ' +
'let not of or orelse|10 query receive rem try when xor'
},
contains: [
{
className: 'meta', begin: '^[0-9]+> ',
relevance: 10
},
hljs.COMMENT('%', '$'),
{
className: 'number',
begin: '\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)',
relevance: 0
},
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
{
begin: '\\?(::)?([A-Z]\\w*(::)?)+'
},
{
begin: '->'
},
{
begin: 'ok'
},
{
begin: '!'
},
{
begin: '(\\b[a-z\'][a-zA-Z0-9_\']*:[a-z\'][a-zA-Z0-9_\']*)|(\\b[a-z\'][a-zA-Z0-9_\']*)',
relevance: 0
},
{
begin: '[A-Z][a-zA-Z0-9_\']*',
relevance: 0
}
]
};
}

View File

@ -0,0 +1,152 @@
/*
Language: Erlang
Description: Erlang is a general-purpose functional language, with strict evaluation, single assignment, and dynamic typing.
Author: Nikolay Zakharov <nikolay.desh@gmail.com>, Dmitry Kovega <arhibot@gmail.com>
Category: functional
*/
function(hljs) {
var BASIC_ATOM_RE = '[a-z\'][a-zA-Z0-9_\']*';
var FUNCTION_NAME_RE = '(' + BASIC_ATOM_RE + ':' + BASIC_ATOM_RE + '|' + BASIC_ATOM_RE + ')';
var ERLANG_RESERVED = {
keyword:
'after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun if ' +
'let not of orelse|10 query receive rem try when xor',
literal:
'false true'
};
var COMMENT = hljs.COMMENT('%', '$');
var NUMBER = {
className: 'number',
begin: '\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)',
relevance: 0
};
var NAMED_FUN = {
begin: 'fun\\s+' + BASIC_ATOM_RE + '/\\d+'
};
var FUNCTION_CALL = {
begin: FUNCTION_NAME_RE + '\\(', end: '\\)',
returnBegin: true,
relevance: 0,
contains: [
{
begin: FUNCTION_NAME_RE, relevance: 0
},
{
begin: '\\(', end: '\\)', endsWithParent: true,
returnEnd: true,
relevance: 0
// "contains" defined later
}
]
};
var TUPLE = {
begin: '{', end: '}',
relevance: 0
// "contains" defined later
};
var VAR1 = {
begin: '\\b_([A-Z][A-Za-z0-9_]*)?',
relevance: 0
};
var VAR2 = {
begin: '[A-Z][a-zA-Z0-9_]*',
relevance: 0
};
var RECORD_ACCESS = {
begin: '#' + hljs.UNDERSCORE_IDENT_RE,
relevance: 0,
returnBegin: true,
contains: [
{
begin: '#' + hljs.UNDERSCORE_IDENT_RE,
relevance: 0
},
{
begin: '{', end: '}',
relevance: 0
// "contains" defined later
}
]
};
var BLOCK_STATEMENTS = {
beginKeywords: 'fun receive if try case', end: 'end',
keywords: ERLANG_RESERVED
};
BLOCK_STATEMENTS.contains = [
COMMENT,
NAMED_FUN,
hljs.inherit(hljs.APOS_STRING_MODE, {className: ''}),
BLOCK_STATEMENTS,
FUNCTION_CALL,
hljs.QUOTE_STRING_MODE,
NUMBER,
TUPLE,
VAR1, VAR2,
RECORD_ACCESS
];
var BASIC_MODES = [
COMMENT,
NAMED_FUN,
BLOCK_STATEMENTS,
FUNCTION_CALL,
hljs.QUOTE_STRING_MODE,
NUMBER,
TUPLE,
VAR1, VAR2,
RECORD_ACCESS
];
FUNCTION_CALL.contains[1].contains = BASIC_MODES;
TUPLE.contains = BASIC_MODES;
RECORD_ACCESS.contains[1].contains = BASIC_MODES;
var PARAMS = {
className: 'params',
begin: '\\(', end: '\\)',
contains: BASIC_MODES
};
return {
aliases: ['erl'],
keywords: ERLANG_RESERVED,
illegal: '(</|\\*=|\\+=|-=|/\\*|\\*/|\\(\\*|\\*\\))',
contains: [
{
className: 'function',
begin: '^' + BASIC_ATOM_RE + '\\s*\\(', end: '->',
returnBegin: true,
illegal: '\\(|#|//|/\\*|\\\\|:|;',
contains: [
PARAMS,
hljs.inherit(hljs.TITLE_MODE, {begin: BASIC_ATOM_RE})
],
starts: {
end: ';|\\.',
keywords: ERLANG_RESERVED,
contains: BASIC_MODES
}
},
COMMENT,
{
begin: '^-', end: '\\.',
relevance: 0,
excludeEnd: true,
returnBegin: true,
lexemes: '-' + hljs.IDENT_RE,
keywords:
'-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn ' +
'-import -include -include_lib -compile -define -else -endif -file -behaviour ' +
'-behavior -spec',
contains: [PARAMS]
},
NUMBER,
hljs.QUOTE_STRING_MODE,
RECORD_ACCESS,
VAR1, VAR2,
TUPLE,
{begin: /\.$/} // relevance booster
]
};
}

View File

@ -0,0 +1,53 @@
/*
Language: Excel
Author: Victor Zhou <OiCMudkips@users.noreply.github.com>
Description: Excel formulae
*/
function(hljs) {
return {
aliases: ['xlsx', 'xls'],
case_insensitive: true,
lexemes: /[a-zA-Z][\w\.]*/,
// built-in functions imported from https://web.archive.org/web/20160513042710/https://support.office.com/en-us/article/Excel-functions-alphabetical-b3944572-255d-4efb-bb96-c6d90033e188
keywords: {
built_in: 'ABS ACCRINT ACCRINTM ACOS ACOSH ACOT ACOTH AGGREGATE ADDRESS AMORDEGRC AMORLINC AND ARABIC AREAS ASC ASIN ASINH ATAN ATAN2 ATANH AVEDEV AVERAGE AVERAGEA AVERAGEIF AVERAGEIFS BAHTTEXT BASE BESSELI BESSELJ BESSELK BESSELY BETADIST BETA.DIST BETAINV BETA.INV BIN2DEC BIN2HEX BIN2OCT BINOMDIST BINOM.DIST BINOM.DIST.RANGE BINOM.INV BITAND BITLSHIFT BITOR BITRSHIFT BITXOR CALL CEILING CEILING.MATH CEILING.PRECISE CELL CHAR CHIDIST CHIINV CHITEST CHISQ.DIST CHISQ.DIST.RT CHISQ.INV CHISQ.INV.RT CHISQ.TEST CHOOSE CLEAN CODE COLUMN COLUMNS COMBIN COMBINA COMPLEX CONCAT CONCATENATE CONFIDENCE CONFIDENCE.NORM CONFIDENCE.T CONVERT CORREL COS COSH COT COTH COUNT COUNTA COUNTBLANK COUNTIF COUNTIFS COUPDAYBS COUPDAYS COUPDAYSNC COUPNCD COUPNUM COUPPCD COVAR COVARIANCE.P COVARIANCE.S CRITBINOM CSC CSCH CUBEKPIMEMBER CUBEMEMBER CUBEMEMBERPROPERTY CUBERANKEDMEMBER CUBESET CUBESETCOUNT CUBEVALUE CUMIPMT CUMPRINC DATE DATEDIF DATEVALUE DAVERAGE DAY DAYS DAYS360 DB DBCS DCOUNT DCOUNTA DDB DEC2BIN DEC2HEX DEC2OCT DECIMAL DEGREES DELTA DEVSQ DGET DISC DMAX DMIN DOLLAR DOLLARDE DOLLARFR DPRODUCT DSTDEV DSTDEVP DSUM DURATION DVAR DVARP EDATE EFFECT ENCODEURL EOMONTH ERF ERF.PRECISE ERFC ERFC.PRECISE ERROR.TYPE EUROCONVERT EVEN EXACT EXP EXPON.DIST EXPONDIST FACT FACTDOUBLE FALSE|0 F.DIST FDIST F.DIST.RT FILTERXML FIND FINDB F.INV F.INV.RT FINV FISHER FISHERINV FIXED FLOOR FLOOR.MATH FLOOR.PRECISE FORECAST FORECAST.ETS FORECAST.ETS.CONFINT FORECAST.ETS.SEASONALITY FORECAST.ETS.STAT FORECAST.LINEAR FORMULATEXT FREQUENCY F.TEST FTEST FV FVSCHEDULE GAMMA GAMMA.DIST GAMMADIST GAMMA.INV GAMMAINV GAMMALN GAMMALN.PRECISE GAUSS GCD GEOMEAN GESTEP GETPIVOTDATA GROWTH HARMEAN HEX2BIN HEX2DEC HEX2OCT HLOOKUP HOUR HYPERLINK HYPGEOM.DIST HYPGEOMDIST IF|0 IFERROR IFNA IFS IMABS IMAGINARY IMARGUMENT IMCONJUGATE IMCOS IMCOSH IMCOT IMCSC IMCSCH IMDIV IMEXP IMLN IMLOG10 IMLOG2 IMPOWER IMPRODUCT IMREAL IMSEC IMSECH IMSIN IMSINH IMSQRT IMSUB IMSUM IMTAN INDEX INDIRECT INFO INT INTERCEPT INTRATE IPMT IRR ISBLANK ISERR ISERROR ISEVEN ISFORMULA ISLOGICAL ISNA ISNONTEXT ISNUMBER ISODD ISREF ISTEXT ISO.CEILING ISOWEEKNUM ISPMT JIS KURT LARGE LCM LEFT LEFTB LEN LENB LINEST LN LOG LOG10 LOGEST LOGINV LOGNORM.DIST LOGNORMDIST LOGNORM.INV LOOKUP LOWER MATCH MAX MAXA MAXIFS MDETERM MDURATION MEDIAN MID MIDBs MIN MINIFS MINA MINUTE MINVERSE MIRR MMULT MOD MODE MODE.MULT MODE.SNGL MONTH MROUND MULTINOMIAL MUNIT N NA NEGBINOM.DIST NEGBINOMDIST NETWORKDAYS NETWORKDAYS.INTL NOMINAL NORM.DIST NORMDIST NORMINV NORM.INV NORM.S.DIST NORMSDIST NORM.S.INV NORMSINV NOT NOW NPER NPV NUMBERVALUE OCT2BIN OCT2DEC OCT2HEX ODD ODDFPRICE ODDFYIELD ODDLPRICE ODDLYIELD OFFSET OR PDURATION PEARSON PERCENTILE.EXC PERCENTILE.INC PERCENTILE PERCENTRANK.EXC PERCENTRANK.INC PERCENTRANK PERMUT PERMUTATIONA PHI PHONETIC PI PMT POISSON.DIST POISSON POWER PPMT PRICE PRICEDISC PRICEMAT PROB PRODUCT PROPER PV QUARTILE QUARTILE.EXC QUARTILE.INC QUOTIENT RADIANS RAND RANDBETWEEN RANK.AVG RANK.EQ RANK RATE RECEIVED REGISTER.ID REPLACE REPLACEB REPT RIGHT RIGHTB ROMAN ROUND ROUNDDOWN ROUNDUP ROW ROWS RRI RSQ RTD SEARCH SEARCHB SEC SECH SECOND SERIESSUM SHEET SHEETS SIGN SIN SINH SKEW SKEW.P SLN SLOPE SMALL SQL.REQUEST SQRT SQRTPI STANDARDIZE STDEV STDEV.P STDEV.S STDEVA STDEVP STDEVPA STEYX SUBSTITUTE SUBTOTAL SUM SUMIF SUMIFS SUMPRODUCT SUMSQ SUMX2MY2 SUMX2PY2 SUMXMY2 SWITCH SYD T TAN TANH TBILLEQ TBILLPRICE TBILLYIELD T.DIST T.DIST.2T T.DIST.RT TDIST TEXT TEXTJOIN TIME TIMEVALUE T.INV T.INV.2T TINV TODAY TRANSPOSE TREND TRIM TRIMMEAN TRUE|0 TRUNC T.TEST TTEST TYPE UNICHAR UNICODE UPPER VALUE VAR VAR.P VAR.S VARA VARP VARPA VDB VLOOKUP WEBSERVICE WEEKDAY WEEKNUM WEIBULL WEIBULL.DIST WORKDAY WORKDAY.INTL XIRR XNPV XOR YEAR YEARFRAC YIELD YIELDDISC YIELDMAT Z.TEST ZTEST'
},
contains: [
{
/* matches a beginning equal sign found in Excel formula examples */
begin: /^=/,
end: /[^=]/, returnEnd: true, illegal: /=/, /* only allow single equal sign at front of line */
relevance: 10
},
/* technically, there can be more than 2 letters in column names, but this prevents conflict with some keywords */
{
/* matches a reference to a single cell */
className: 'symbol',
begin: /\b[A-Z]{1,2}\d+\b/,
end: /[^\d]/, excludeEnd: true,
relevance: 0
},
{
/* matches a reference to a range of cells */
className: 'symbol',
begin: /[A-Z]{0,2}\d*:[A-Z]{0,2}\d*/,
relevance: 0
},
hljs.BACKSLASH_ESCAPE,
hljs.QUOTE_STRING_MODE,
{
className: 'number',
begin: hljs.NUMBER_RE + '(%)?',
relevance: 0
},
/* Excel formula comments are done by putting the comment in a function call to N() */
hljs.COMMENT(/\bN\(/,/\)/,
{
excludeBegin: true,
excludeEnd: true,
illegal: /\n/
})
]
};
}

View File

@ -0,0 +1,33 @@
/*
Language: FIX
Author: Brent Bradbury <brent@brentium.com>
*/
function(hljs) {
return {
contains: [
{
begin: /[^\u2401\u0001]+/,
end: /[\u2401\u0001]/,
excludeEnd: true,
returnBegin: true,
returnEnd: false,
contains: [
{
begin: /([^\u2401\u0001=]+)/,
end: /=([^\u2401\u0001=]+)/,
returnEnd: true,
returnBegin: false,
className: 'attr'
},
{
begin: /=/,
end: /([\u2401\u0001])/,
excludeEnd: true,
excludeBegin: true,
className: 'string'
}]
}],
case_insensitive: true
};
}

View File

@ -0,0 +1,50 @@
/*
Language: Flix
Category: functional
Author: Magnus Madsen <mmadsen@uwaterloo.ca>
*/
function (hljs) {
var CHAR = {
className: 'string',
begin: /'(.|\\[xXuU][a-zA-Z0-9]+)'/
};
var STRING = {
className: 'string',
variants: [
{
begin: '"', end: '"'
}
]
};
var NAME = {
className: 'title',
begin: /[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/
};
var METHOD = {
className: 'function',
beginKeywords: 'def',
end: /[:={\[(\n;]/,
excludeEnd: true,
contains: [NAME]
};
return {
keywords: {
literal: 'true false',
keyword: 'case class def else enum if impl import in lat rel index let match namespace switch type yield with'
},
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
CHAR,
STRING,
METHOD,
hljs.C_NUMBER_MODE
]
};
}

View File

@ -0,0 +1,76 @@
/*
Language: Fortran
Author: Anthony Scemama <scemama@irsamc.ups-tlse.fr>
Category: scientific
*/
function(hljs) {
var PARAMS = {
className: 'params',
begin: '\\(', end: '\\)'
};
var F_KEYWORDS = {
literal: '.False. .True.',
keyword: 'kind do while private call intrinsic where elsewhere ' +
'type endtype endmodule endselect endinterface end enddo endif if forall endforall only contains default return stop then ' +
'public subroutine|10 function program .and. .or. .not. .le. .eq. .ge. .gt. .lt. ' +
'goto save else use module select case ' +
'access blank direct exist file fmt form formatted iostat name named nextrec number opened rec recl sequential status unformatted unit ' +
'continue format pause cycle exit ' +
'c_null_char c_alert c_backspace c_form_feed flush wait decimal round iomsg ' +
'synchronous nopass non_overridable pass protected volatile abstract extends import ' +
'non_intrinsic value deferred generic final enumerator class associate bind enum ' +
'c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t ' +
'c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double ' +
'c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr ' +
'c_new_line c_carriage_return c_horizontal_tab c_vertical_tab iso_c_binding c_loc c_funloc c_associated c_f_pointer ' +
'c_ptr c_funptr iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor ' +
'numeric_storage_size output_unit c_f_procpointer ieee_arithmetic ieee_support_underflow_control ' +
'ieee_get_underflow_mode ieee_set_underflow_mode newunit contiguous recursive ' +
'pad position action delim readwrite eor advance nml interface procedure namelist include sequence elemental pure ' +
'integer real character complex logical dimension allocatable|10 parameter ' +
'external implicit|10 none double precision assign intent optional pointer ' +
'target in out common equivalence data',
built_in: 'alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint ' +
'dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl ' +
'algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama ' +
'iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod ' +
'qnint qsign qsin qsinh qsqrt qtan qtanh abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log ' +
'log10 max min nint sign sin sinh sqrt tan tanh print write dim lge lgt lle llt mod nullify allocate deallocate ' +
'adjustl adjustr all allocated any associated bit_size btest ceiling count cshift date_and_time digits dot_product ' +
'eoshift epsilon exponent floor fraction huge iand ibclr ibits ibset ieor ior ishft ishftc lbound len_trim matmul ' +
'maxexponent maxloc maxval merge minexponent minloc minval modulo mvbits nearest pack present product ' +
'radix random_number random_seed range repeat reshape rrspacing scale scan selected_int_kind selected_real_kind ' +
'set_exponent shape size spacing spread sum system_clock tiny transpose trim ubound unpack verify achar iachar transfer ' +
'dble entry dprod cpu_time command_argument_count get_command get_command_argument get_environment_variable is_iostat_end ' +
'ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode ' +
'is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_of' +
'acosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 ' +
'atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits ' +
'bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr ' +
'num_images parity popcnt poppar shifta shiftl shiftr this_image'
};
return {
case_insensitive: true,
aliases: ['f90', 'f95'],
keywords: F_KEYWORDS,
illegal: /\/\*/,
contains: [
hljs.inherit(hljs.APOS_STRING_MODE, {className: 'string', relevance: 0}),
hljs.inherit(hljs.QUOTE_STRING_MODE, {className: 'string', relevance: 0}),
{
className: 'function',
beginKeywords: 'subroutine function program',
illegal: '[${=\\n]',
contains: [hljs.UNDERSCORE_TITLE_MODE, PARAMS]
},
hljs.COMMENT('!', '$', {relevance: 0}),
{
className: 'number',
begin: '(?=\\b|\\+|\\-|\\.)(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*)(?:[de][+-]?\\d+)?\\b\\.?',
relevance: 0
}
]
};
}

View File

@ -0,0 +1,64 @@
/*
Language: F#
Author: Jonas Follesø <jonas@follesoe.no>
Contributors: Troy Kershaw <hello@troykershaw.com>, Henrik Feldt <henrik@haf.se>
Category: functional
*/
function(hljs) {
var TYPEPARAM = {
begin: '<', end: '>',
contains: [
hljs.inherit(hljs.TITLE_MODE, {begin: /'[a-zA-Z0-9_]+/})
]
};
return {
aliases: ['fs'],
keywords:
'abstract and as assert base begin class default delegate do done ' +
'downcast downto elif else end exception extern false finally for ' +
'fun function global if in inherit inline interface internal lazy let ' +
'match member module mutable namespace new null of open or ' +
'override private public rec return sig static struct then to ' +
'true try type upcast use val void when while with yield',
illegal: /\/\*/,
contains: [
{
// monad builder keywords (matches before non-bang kws)
className: 'keyword',
begin: /\b(yield|return|let|do)!/
},
{
className: 'string',
begin: '@"', end: '"',
contains: [{begin: '""'}]
},
{
className: 'string',
begin: '"""', end: '"""'
},
hljs.COMMENT('\\(\\*', '\\*\\)'),
{
className: 'class',
beginKeywords: 'type', end: '\\(|=|$', excludeEnd: true,
contains: [
hljs.UNDERSCORE_TITLE_MODE,
TYPEPARAM
]
},
{
className: 'meta',
begin: '\\[<', end: '>\\]',
relevance: 10
},
{
className: 'symbol',
begin: '\\B(\'[A-Za-z])\\b',
contains: [hljs.BACKSLASH_ESCAPE]
},
hljs.C_LINE_COMMENT_MODE,
hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
hljs.C_NUMBER_MODE
]
};
}

View File

@ -0,0 +1,162 @@
/*
Language: GAMS
Author: Stefan Bechert <stefan.bechert@gmx.net>
Contributors: Oleg Efimov <efimovov@gmail.com>, Mikko Kouhia <mikko.kouhia@iki.fi>
Description: The General Algebraic Modeling System language
Category: scientific
*/
function (hljs) {
var KEYWORDS = {
'keyword':
'abort acronym acronyms alias all and assign binary card diag display ' +
'else eq file files for free ge gt if integer le loop lt maximizing ' +
'minimizing model models ne negative no not option options or ord ' +
'positive prod put putpage puttl repeat sameas semicont semiint smax ' +
'smin solve sos1 sos2 sum system table then until using while xor yes',
'literal': 'eps inf na',
'built-in':
'abs arccos arcsin arctan arctan2 Beta betaReg binomial ceil centropy ' +
'cos cosh cvPower div div0 eDist entropy errorf execSeed exp fact ' +
'floor frac gamma gammaReg log logBeta logGamma log10 log2 mapVal max ' +
'min mod ncpCM ncpF ncpVUpow ncpVUsin normal pi poly power ' +
'randBinomial randLinear randTriangle round rPower sigmoid sign ' +
'signPower sin sinh slexp sllog10 slrec sqexp sqlog10 sqr sqrec sqrt ' +
'tan tanh trunc uniform uniformInt vcPower bool_and bool_eqv bool_imp ' +
'bool_not bool_or bool_xor ifThen rel_eq rel_ge rel_gt rel_le rel_lt ' +
'rel_ne gday gdow ghour gleap gmillisec gminute gmonth gsecond gyear ' +
'jdate jnow jstart jtime errorLevel execError gamsRelease gamsVersion ' +
'handleCollect handleDelete handleStatus handleSubmit heapFree ' +
'heapLimit heapSize jobHandle jobKill jobStatus jobTerminate ' +
'licenseLevel licenseStatus maxExecError sleep timeClose timeComp ' +
'timeElapsed timeExec timeStart'
};
var PARAMS = {
className: 'params',
begin: /\(/, end: /\)/,
excludeBegin: true,
excludeEnd: true,
};
var SYMBOLS = {
className: 'symbol',
variants: [
{begin: /\=[lgenxc]=/},
{begin: /\$/},
]
};
var QSTR = { // One-line quoted comment string
className: 'comment',
variants: [
{begin: '\'', end: '\''},
{begin: '"', end: '"'},
],
illegal: '\\n',
contains: [hljs.BACKSLASH_ESCAPE]
};
var ASSIGNMENT = {
begin: '/',
end: '/',
keywords: KEYWORDS,
contains: [
QSTR,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
hljs.C_NUMBER_MODE,
],
};
var DESCTEXT = { // Parameter/set/variable description text
begin: /[a-z][a-z0-9_]*(\([a-z0-9_, ]*\))?[ \t]+/,
excludeBegin: true,
end: '$',
endsWithParent: true,
contains: [
QSTR,
ASSIGNMENT,
{
className: 'comment',
begin: /([ ]*[a-z0-9&#*=?@>\\<:\-,()$\[\]_.{}!+%^]+)+/,
relevance: 0
},
],
};
return {
aliases: ['gms'],
case_insensitive: true,
keywords: KEYWORDS,
contains: [
hljs.COMMENT(/^\$ontext/, /^\$offtext/),
{
className: 'meta',
begin: '^\\$[a-z0-9]+',
end: '$',
returnBegin: true,
contains: [
{
className: 'meta-keyword',
begin: '^\\$[a-z0-9]+',
}
]
},
hljs.COMMENT('^\\*', '$'),
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
// Declarations
{
beginKeywords:
'set sets parameter parameters variable variables ' +
'scalar scalars equation equations',
end: ';',
contains: [
hljs.COMMENT('^\\*', '$'),
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
ASSIGNMENT,
DESCTEXT,
]
},
{ // table environment
beginKeywords: 'table',
end: ';',
returnBegin: true,
contains: [
{ // table header row
beginKeywords: 'table',
end: '$',
contains: [DESCTEXT],
},
hljs.COMMENT('^\\*', '$'),
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
hljs.C_NUMBER_MODE,
// Table does not contain DESCTEXT or ASSIGNMENT
]
},
// Function definitions
{
className: 'function',
begin: /^[a-z][a-z0-9_,\-+' ()$]+\.{2}/,
returnBegin: true,
contains: [
{ // Function title
className: 'title',
begin: /^[a-z][a-z0-9_]+/,
},
PARAMS,
SYMBOLS,
],
},
hljs.C_NUMBER_MODE,
SYMBOLS,
]
};
}

View File

@ -0,0 +1,227 @@
/*
Language: GAUSS
Author: Matt Evans <matt@aptech.com>
Category: scientific
Description: GAUSS Mathematical and Statistical language
*/
function(hljs) {
var KEYWORDS = {
keyword: 'and bool break call callexe checkinterrupt clear clearg closeall cls comlog compile ' +
'continue create debug declare delete disable dlibrary dllcall do dos ed edit else ' +
'elseif enable end endfor endif endp endo errorlog errorlogat expr external fn ' +
'for format goto gosub graph if keyword let lib library line load loadarray loadexe ' +
'loadf loadk loadm loadp loads loadx local locate loopnextindex lprint lpwidth lshow ' +
'matrix msym ndpclex new not open or output outwidth plot plotsym pop prcsn print ' +
'printdos proc push retp return rndcon rndmod rndmult rndseed run save saveall screen ' +
'scroll setarray show sparse stop string struct system trace trap threadfor ' +
'threadendfor threadbegin threadjoin threadstat threadend until use while winprint',
built_in: 'abs acf aconcat aeye amax amean AmericanBinomCall AmericanBinomCall_Greeks AmericanBinomCall_ImpVol ' +
'AmericanBinomPut AmericanBinomPut_Greeks AmericanBinomPut_ImpVol AmericanBSCall AmericanBSCall_Greeks ' +
'AmericanBSCall_ImpVol AmericanBSPut AmericanBSPut_Greeks AmericanBSPut_ImpVol amin amult annotationGetDefaults ' +
'annotationSetBkd annotationSetFont annotationSetLineColor annotationSetLineStyle annotationSetLineThickness ' +
'annualTradingDays arccos arcsin areshape arrayalloc arrayindex arrayinit arraytomat asciiload asclabel astd ' +
'astds asum atan atan2 atranspose axmargin balance band bandchol bandcholsol bandltsol bandrv bandsolpd bar ' +
'base10 begwind besselj bessely beta box boxcox cdfBeta cdfBetaInv cdfBinomial cdfBinomialInv cdfBvn cdfBvn2 ' +
'cdfBvn2e cdfCauchy cdfCauchyInv cdfChic cdfChii cdfChinc cdfChincInv cdfExp cdfExpInv cdfFc cdfFnc cdfFncInv ' +
'cdfGam cdfGenPareto cdfHyperGeo cdfLaplace cdfLaplaceInv cdfLogistic cdfLogisticInv cdfmControlCreate cdfMvn ' +
'cdfMvn2e cdfMvnce cdfMvne cdfMvt2e cdfMvtce cdfMvte cdfN cdfN2 cdfNc cdfNegBinomial cdfNegBinomialInv cdfNi ' +
'cdfPoisson cdfPoissonInv cdfRayleigh cdfRayleighInv cdfTc cdfTci cdfTnc cdfTvn cdfWeibull cdfWeibullInv cdir ' +
'ceil ChangeDir chdir chiBarSquare chol choldn cholsol cholup chrs close code cols colsf combinate combinated ' +
'complex con cond conj cons ConScore contour conv convertsatostr convertstrtosa corrm corrms corrvc corrx corrxs ' +
'cos cosh counts countwts crossprd crout croutp csrcol csrlin csvReadM csvReadSA cumprodc cumsumc curve cvtos ' +
'datacreate datacreatecomplex datalist dataload dataloop dataopen datasave date datestr datestring datestrymd ' +
'dayinyr dayofweek dbAddDatabase dbClose dbCommit dbCreateQuery dbExecQuery dbGetConnectOptions dbGetDatabaseName ' +
'dbGetDriverName dbGetDrivers dbGetHostName dbGetLastErrorNum dbGetLastErrorText dbGetNumericalPrecPolicy ' +
'dbGetPassword dbGetPort dbGetTableHeaders dbGetTables dbGetUserName dbHasFeature dbIsDriverAvailable dbIsOpen ' +
'dbIsOpenError dbOpen dbQueryBindValue dbQueryClear dbQueryCols dbQueryExecPrepared dbQueryFetchAllM dbQueryFetchAllSA ' +
'dbQueryFetchOneM dbQueryFetchOneSA dbQueryFinish dbQueryGetBoundValue dbQueryGetBoundValues dbQueryGetField ' +
'dbQueryGetLastErrorNum dbQueryGetLastErrorText dbQueryGetLastInsertID dbQueryGetLastQuery dbQueryGetPosition ' +
'dbQueryIsActive dbQueryIsForwardOnly dbQueryIsNull dbQueryIsSelect dbQueryIsValid dbQueryPrepare dbQueryRows ' +
'dbQuerySeek dbQuerySeekFirst dbQuerySeekLast dbQuerySeekNext dbQuerySeekPrevious dbQuerySetForwardOnly ' +
'dbRemoveDatabase dbRollback dbSetConnectOptions dbSetDatabaseName dbSetHostName dbSetNumericalPrecPolicy ' +
'dbSetPort dbSetUserName dbTransaction DeleteFile delif delrows denseToSp denseToSpRE denToZero design det detl ' +
'dfft dffti diag diagrv digamma doswin DOSWinCloseall DOSWinOpen dotfeq dotfeqmt dotfge dotfgemt dotfgt dotfgtmt ' +
'dotfle dotflemt dotflt dotfltmt dotfne dotfnemt draw drop dsCreate dstat dstatmt dstatmtControlCreate dtdate dtday ' +
'dttime dttodtv dttostr dttoutc dtvnormal dtvtodt dtvtoutc dummy dummybr dummydn eig eigh eighv eigv elapsedTradingDays ' +
'endwind envget eof eqSolve eqSolvemt eqSolvemtControlCreate eqSolvemtOutCreate eqSolveset erf erfc erfccplx erfcplx error ' +
'etdays ethsec etstr EuropeanBinomCall EuropeanBinomCall_Greeks EuropeanBinomCall_ImpVol EuropeanBinomPut ' +
'EuropeanBinomPut_Greeks EuropeanBinomPut_ImpVol EuropeanBSCall EuropeanBSCall_Greeks EuropeanBSCall_ImpVol ' +
'EuropeanBSPut EuropeanBSPut_Greeks EuropeanBSPut_ImpVol exctsmpl exec execbg exp extern eye fcheckerr fclearerr feq ' +
'feqmt fflush fft ffti fftm fftmi fftn fge fgemt fgets fgetsa fgetsat fgetst fgt fgtmt fileinfo filesa fle flemt ' +
'floor flt fltmt fmod fne fnemt fonts fopen formatcv formatnv fputs fputst fseek fstrerror ftell ftocv ftos ftostrC ' +
'gamma gammacplx gammaii gausset gdaAppend gdaCreate gdaDStat gdaDStatMat gdaGetIndex gdaGetName gdaGetNames gdaGetOrders ' +
'gdaGetType gdaGetTypes gdaGetVarInfo gdaIsCplx gdaLoad gdaPack gdaRead gdaReadByIndex gdaReadSome gdaReadSparse ' +
'gdaReadStruct gdaReportVarInfo gdaSave gdaUpdate gdaUpdateAndPack gdaVars gdaWrite gdaWrite32 gdaWriteSome getarray ' +
'getdims getf getGAUSShome getmatrix getmatrix4D getname getnamef getNextTradingDay getNextWeekDay getnr getorders ' +
'getpath getPreviousTradingDay getPreviousWeekDay getRow getscalar3D getscalar4D getTrRow getwind glm gradcplx gradMT ' +
'gradMTm gradMTT gradMTTm gradp graphprt graphset hasimag header headermt hess hessMT hessMTg hessMTgw hessMTm ' +
'hessMTmw hessMTT hessMTTg hessMTTgw hessMTTm hessMTw hessp hist histf histp hsec imag indcv indexcat indices indices2 ' +
'indicesf indicesfn indnv indsav indx integrate1d integrateControlCreate intgrat2 intgrat3 inthp1 inthp2 inthp3 inthp4 ' +
'inthpControlCreate intquad1 intquad2 intquad3 intrleav intrleavsa intrsect intsimp inv invpd invswp iscplx iscplxf ' +
'isden isinfnanmiss ismiss key keyav keyw lag lag1 lagn lapEighb lapEighi lapEighvb lapEighvi lapgEig lapgEigh lapgEighv ' +
'lapgEigv lapgSchur lapgSvdcst lapgSvds lapgSvdst lapSvdcusv lapSvds lapSvdusv ldlp ldlsol linSolve listwise ln lncdfbvn ' +
'lncdfbvn2 lncdfmvn lncdfn lncdfn2 lncdfnc lnfact lngammacplx lnpdfmvn lnpdfmvt lnpdfn lnpdft loadd loadstruct loadwind ' +
'loess loessmt loessmtControlCreate log loglog logx logy lower lowmat lowmat1 ltrisol lu lusol machEpsilon make makevars ' +
'makewind margin matalloc matinit mattoarray maxbytes maxc maxindc maxv maxvec mbesselei mbesselei0 mbesselei1 mbesseli ' +
'mbesseli0 mbesseli1 meanc median mergeby mergevar minc minindc minv miss missex missrv moment momentd movingave ' +
'movingaveExpwgt movingaveWgt nextindex nextn nextnevn nextwind ntos null null1 numCombinations ols olsmt olsmtControlCreate ' +
'olsqr olsqr2 olsqrmt ones optn optnevn orth outtyp pacf packedToSp packr parse pause pdfCauchy pdfChi pdfExp pdfGenPareto ' +
'pdfHyperGeo pdfLaplace pdfLogistic pdfn pdfPoisson pdfRayleigh pdfWeibull pi pinv pinvmt plotAddArrow plotAddBar plotAddBox ' +
'plotAddHist plotAddHistF plotAddHistP plotAddPolar plotAddScatter plotAddShape plotAddTextbox plotAddTS plotAddXY plotArea ' +
'plotBar plotBox plotClearLayout plotContour plotCustomLayout plotGetDefaults plotHist plotHistF plotHistP plotLayout ' +
'plotLogLog plotLogX plotLogY plotOpenWindow plotPolar plotSave plotScatter plotSetAxesPen plotSetBar plotSetBarFill ' +
'plotSetBarStacked plotSetBkdColor plotSetFill plotSetGrid plotSetLegend plotSetLineColor plotSetLineStyle plotSetLineSymbol ' +
'plotSetLineThickness plotSetNewWindow plotSetTitle plotSetWhichYAxis plotSetXAxisShow plotSetXLabel plotSetXRange ' +
'plotSetXTicInterval plotSetXTicLabel plotSetYAxisShow plotSetYLabel plotSetYRange plotSetZAxisShow plotSetZLabel ' +
'plotSurface plotTS plotXY polar polychar polyeval polygamma polyint polymake polymat polymroot polymult polyroot ' +
'pqgwin previousindex princomp printfm printfmt prodc psi putarray putf putvals pvCreate pvGetIndex pvGetParNames ' +
'pvGetParVector pvLength pvList pvPack pvPacki pvPackm pvPackmi pvPacks pvPacksi pvPacksm pvPacksmi pvPutParVector ' +
'pvTest pvUnpack QNewton QNewtonmt QNewtonmtControlCreate QNewtonmtOutCreate QNewtonSet QProg QProgmt QProgmtInCreate ' +
'qqr qqre qqrep qr qre qrep qrsol qrtsol qtyr qtyre qtyrep quantile quantiled qyr qyre qyrep qz rank rankindx readr ' +
'real reclassify reclassifyCuts recode recserar recsercp recserrc rerun rescale reshape rets rev rfft rffti rfftip rfftn ' +
'rfftnp rfftp rndBernoulli rndBeta rndBinomial rndCauchy rndChiSquare rndCon rndCreateState rndExp rndGamma rndGeo rndGumbel ' +
'rndHyperGeo rndi rndKMbeta rndKMgam rndKMi rndKMn rndKMnb rndKMp rndKMu rndKMvm rndLaplace rndLCbeta rndLCgam rndLCi rndLCn ' +
'rndLCnb rndLCp rndLCu rndLCvm rndLogNorm rndMTu rndMVn rndMVt rndn rndnb rndNegBinomial rndp rndPoisson rndRayleigh ' +
'rndStateSkip rndu rndvm rndWeibull rndWishart rotater round rows rowsf rref sampleData satostrC saved saveStruct savewind ' +
'scale scale3d scalerr scalinfnanmiss scalmiss schtoc schur searchsourcepath seekr select selif seqa seqm setdif setdifsa ' +
'setvars setvwrmode setwind shell shiftr sin singleindex sinh sleep solpd sortc sortcc sortd sorthc sorthcc sortind ' +
'sortindc sortmc sortr sortrc spBiconjGradSol spChol spConjGradSol spCreate spDenseSubmat spDiagRvMat spEigv spEye spLDL ' +
'spline spLU spNumNZE spOnes spreadSheetReadM spreadSheetReadSA spreadSheetWrite spScale spSubmat spToDense spTrTDense ' +
'spTScalar spZeros sqpSolve sqpSolveMT sqpSolveMTControlCreate sqpSolveMTlagrangeCreate sqpSolveMToutCreate sqpSolveSet ' +
'sqrt statements stdc stdsc stocv stof strcombine strindx strlen strput strrindx strsect strsplit strsplitPad strtodt ' +
'strtof strtofcplx strtriml strtrimr strtrunc strtruncl strtruncpad strtruncr submat subscat substute subvec sumc sumr ' +
'surface svd svd1 svd2 svdcusv svds svdusv sysstate tab tan tanh tempname threadBegin threadEnd threadEndFor threadFor ' +
'threadJoin threadStat time timedt timestr timeutc title tkf2eps tkf2ps tocart todaydt toeplitz token topolar trapchk ' +
'trigamma trimr trunc type typecv typef union unionsa uniqindx uniqindxsa unique uniquesa upmat upmat1 upper utctodt ' +
'utctodtv utrisol vals varCovMS varCovXS varget vargetl varmall varmares varput varputl vartypef vcm vcms vcx vcxs ' +
'vec vech vecr vector vget view viewxyz vlist vnamecv volume vput vread vtypecv wait waitc walkindex where window ' +
'writer xlabel xlsGetSheetCount xlsGetSheetSize xlsGetSheetTypes xlsMakeRange xlsReadM xlsReadSA xlsWrite xlsWriteM ' +
'xlsWriteSA xpnd xtics xy xyz ylabel ytics zeros zeta zlabel ztics',
literal: 'DB_AFTER_LAST_ROW DB_ALL_TABLES DB_BATCH_OPERATIONS DB_BEFORE_FIRST_ROW DB_BLOB DB_EVENT_NOTIFICATIONS ' +
'DB_FINISH_QUERY DB_HIGH_PRECISION DB_LAST_INSERT_ID DB_LOW_PRECISION_DOUBLE DB_LOW_PRECISION_INT32 ' +
'DB_LOW_PRECISION_INT64 DB_LOW_PRECISION_NUMBERS DB_MULTIPLE_RESULT_SETS DB_NAMED_PLACEHOLDERS ' +
'DB_POSITIONAL_PLACEHOLDERS DB_PREPARED_QUERIES DB_QUERY_SIZE DB_SIMPLE_LOCKING DB_SYSTEM_TABLES DB_TABLES ' +
'DB_TRANSACTIONS DB_UNICODE DB_VIEWS'
};
var PREPROCESSOR =
{
className: 'meta',
begin: '#', end: '$',
keywords: {'meta-keyword': 'define definecs|10 undef ifdef ifndef iflight ifdllcall ifmac ifos2win ifunix else endif lineson linesoff srcfile srcline'},
contains: [
{
begin: /\\\n/, relevance: 0
},
{
beginKeywords: 'include', end: '$',
keywords: {'meta-keyword': 'include'},
contains: [
{
className: 'meta-string',
begin: '"', end: '"',
illegal: '\\n'
}
]
},
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
};
var FUNCTION_TITLE = hljs.UNDERSCORE_IDENT_RE + '\\s*\\(?';
var PARSE_PARAMS = [
{
className: 'params',
begin: /\(/, end: /\)/,
keywords: KEYWORDS,
relevance: 0,
contains: [
hljs.C_NUMBER_MODE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
}
];
return {
aliases: ['gss'],
case_insensitive: true, // language is case-insensitive
keywords: KEYWORDS,
illegal: '(\\{[%#]|[%#]\\})',
contains: [
hljs.C_NUMBER_MODE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.COMMENT('@', '@'),
PREPROCESSOR,
{
className: 'string',
begin: '"', end: '"',
contains: [hljs.BACKSLASH_ESCAPE]
},
{
className: 'function',
beginKeywords: 'proc keyword',
end: ';',
excludeEnd: true,
keywords: KEYWORDS,
contains: [
{
begin: FUNCTION_TITLE, returnBegin: true,
contains: [hljs.UNDERSCORE_TITLE_MODE],
relevance: 0
},
hljs.C_NUMBER_MODE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
PREPROCESSOR
].concat(PARSE_PARAMS)
},
{
className: 'function',
beginKeywords: 'fn',
end: ';',
excludeEnd: true,
keywords: KEYWORDS,
contains: [
{
begin: FUNCTION_TITLE + hljs.IDENT_RE + '\\)?\\s*\\=\\s*', returnBegin: true,
contains: [hljs.UNDERSCORE_TITLE_MODE],
relevance: 0
},
hljs.C_NUMBER_MODE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
].concat(PARSE_PARAMS)
},
{
className: 'function',
begin: '\\bexternal (proc|keyword|fn)\\s+',
end: ';',
excludeEnd: true,
keywords: KEYWORDS,
contains: [
{
begin: FUNCTION_TITLE, returnBegin: true,
contains: [hljs.UNDERSCORE_TITLE_MODE],
relevance: 0
},
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
},
{
className: 'function',
begin: '\\bexternal (matrix|string|array|sparse matrix|struct ' + hljs.IDENT_RE + ')\\s+',
end: ';',
excludeEnd: true,
keywords: KEYWORDS,
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
}
]
};
}

View File

@ -0,0 +1,72 @@
/*
Language: G-code (ISO 6983)
Contributors: Adam Joseph Cook <adam.joseph.cook@gmail.com>
Description: G-code syntax highlighter for Fanuc and other common CNC machine tool controls.
*/
function(hljs) {
var GCODE_IDENT_RE = '[A-Z_][A-Z0-9_.]*';
var GCODE_CLOSE_RE = '\\%';
var GCODE_KEYWORDS =
'IF DO WHILE ENDWHILE CALL ENDIF SUB ENDSUB GOTO REPEAT ENDREPEAT ' +
'EQ LT GT NE GE LE OR XOR';
var GCODE_START = {
className: 'meta',
begin: '([O])([0-9]+)'
};
var GCODE_CODE = [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.COMMENT(/\(/, /\)/),
hljs.inherit(hljs.C_NUMBER_MODE, {begin: '([-+]?([0-9]*\\.?[0-9]+\\.?))|' + hljs.C_NUMBER_RE}),
hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}),
hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
{
className: 'name',
begin: '([G])([0-9]+\\.?[0-9]?)'
},
{
className: 'name',
begin: '([M])([0-9]+\\.?[0-9]?)'
},
{
className: 'attr',
begin: '(VC|VS|#)',
end: '(\\d+)'
},
{
className: 'attr',
begin: '(VZOFX|VZOFY|VZOFZ)'
},
{
className: 'built_in',
begin: '(ATAN|ABS|ACOS|ASIN|SIN|COS|EXP|FIX|FUP|ROUND|LN|TAN)(\\[)',
end: '([-+]?([0-9]*\\.?[0-9]+\\.?))(\\])'
},
{
className: 'symbol',
variants: [
{
begin: 'N', end: '\\d+',
illegal: '\\W'
}
]
}
];
return {
aliases: ['nc'],
// Some implementations (CNC controls) of G-code are interoperable with uppercase and lowercase letters seamlessly.
// However, most prefer all uppercase and uppercase is customary.
case_insensitive: true,
lexemes: GCODE_IDENT_RE,
keywords: GCODE_KEYWORDS,
contains: [
{
className: 'meta',
begin: GCODE_CLOSE_RE
},
GCODE_START
].concat(GCODE_CODE)
};
}

View File

@ -0,0 +1,42 @@
/*
Language: Gherkin
Author: Sam Pikesley (@pikesley) <sam.pikesley@theodi.org>
Description: Gherkin (Cucumber etc)
*/
function (hljs) {
return {
aliases: ['feature'],
keywords: 'Feature Background Ability Business\ Need Scenario Scenarios Scenario\ Outline Scenario\ Template Examples Given And Then But When',
contains: [
{
className: 'symbol',
begin: '\\*',
relevance: 0
},
{
className: 'meta',
begin: '@[^@\\s]+'
},
{
begin: '\\|', end: '\\|\\w*$',
contains: [
{
className: 'string',
begin: '[^|]+'
}
]
},
{
className: 'variable',
begin: '<', end: '>'
},
hljs.HASH_COMMENT_MODE,
{
className: 'string',
begin: '"""', end: '"""'
},
hljs.QUOTE_STRING_MODE
]
};
}

View File

@ -0,0 +1,123 @@
/*
Language: GLSL
Description: OpenGL Shading Language
Author: Sergey Tikhomirov <sergey@tikhomirov.io>
Category: graphics
*/
function(hljs) {
return {
keywords: {
keyword:
// Statements
'break continue discard do else for if return while switch case default ' +
// Qualifiers
'attribute binding buffer ccw centroid centroid varying coherent column_major const cw ' +
'depth_any depth_greater depth_less depth_unchanged early_fragment_tests equal_spacing ' +
'flat fractional_even_spacing fractional_odd_spacing highp in index inout invariant ' +
'invocations isolines layout line_strip lines lines_adjacency local_size_x local_size_y ' +
'local_size_z location lowp max_vertices mediump noperspective offset origin_upper_left ' +
'out packed patch pixel_center_integer point_mode points precise precision quads r11f_g11f_b10f '+
'r16 r16_snorm r16f r16i r16ui r32f r32i r32ui r8 r8_snorm r8i r8ui readonly restrict ' +
'rg16 rg16_snorm rg16f rg16i rg16ui rg32f rg32i rg32ui rg8 rg8_snorm rg8i rg8ui rgb10_a2 ' +
'rgb10_a2ui rgba16 rgba16_snorm rgba16f rgba16i rgba16ui rgba32f rgba32i rgba32ui rgba8 ' +
'rgba8_snorm rgba8i rgba8ui row_major sample shared smooth std140 std430 stream triangle_strip ' +
'triangles triangles_adjacency uniform varying vertices volatile writeonly',
type:
'atomic_uint bool bvec2 bvec3 bvec4 dmat2 dmat2x2 dmat2x3 dmat2x4 dmat3 dmat3x2 dmat3x3 ' +
'dmat3x4 dmat4 dmat4x2 dmat4x3 dmat4x4 double dvec2 dvec3 dvec4 float iimage1D iimage1DArray ' +
'iimage2D iimage2DArray iimage2DMS iimage2DMSArray iimage2DRect iimage3D iimageBuffer' +
'iimageCube iimageCubeArray image1D image1DArray image2D image2DArray image2DMS image2DMSArray ' +
'image2DRect image3D imageBuffer imageCube imageCubeArray int isampler1D isampler1DArray ' +
'isampler2D isampler2DArray isampler2DMS isampler2DMSArray isampler2DRect isampler3D ' +
'isamplerBuffer isamplerCube isamplerCubeArray ivec2 ivec3 ivec4 mat2 mat2x2 mat2x3 ' +
'mat2x4 mat3 mat3x2 mat3x3 mat3x4 mat4 mat4x2 mat4x3 mat4x4 sampler1D sampler1DArray ' +
'sampler1DArrayShadow sampler1DShadow sampler2D sampler2DArray sampler2DArrayShadow ' +
'sampler2DMS sampler2DMSArray sampler2DRect sampler2DRectShadow sampler2DShadow sampler3D ' +
'samplerBuffer samplerCube samplerCubeArray samplerCubeArrayShadow samplerCubeShadow ' +
'image1D uimage1DArray uimage2D uimage2DArray uimage2DMS uimage2DMSArray uimage2DRect ' +
'uimage3D uimageBuffer uimageCube uimageCubeArray uint usampler1D usampler1DArray ' +
'usampler2D usampler2DArray usampler2DMS usampler2DMSArray usampler2DRect usampler3D ' +
'samplerBuffer usamplerCube usamplerCubeArray uvec2 uvec3 uvec4 vec2 vec3 vec4 void',
built_in:
// Constants
'gl_MaxAtomicCounterBindings gl_MaxAtomicCounterBufferSize gl_MaxClipDistances gl_MaxClipPlanes ' +
'gl_MaxCombinedAtomicCounterBuffers gl_MaxCombinedAtomicCounters gl_MaxCombinedImageUniforms ' +
'gl_MaxCombinedImageUnitsAndFragmentOutputs gl_MaxCombinedTextureImageUnits gl_MaxComputeAtomicCounterBuffers ' +
'gl_MaxComputeAtomicCounters gl_MaxComputeImageUniforms gl_MaxComputeTextureImageUnits ' +
'gl_MaxComputeUniformComponents gl_MaxComputeWorkGroupCount gl_MaxComputeWorkGroupSize ' +
'gl_MaxDrawBuffers gl_MaxFragmentAtomicCounterBuffers gl_MaxFragmentAtomicCounters ' +
'gl_MaxFragmentImageUniforms gl_MaxFragmentInputComponents gl_MaxFragmentInputVectors ' +
'gl_MaxFragmentUniformComponents gl_MaxFragmentUniformVectors gl_MaxGeometryAtomicCounterBuffers ' +
'gl_MaxGeometryAtomicCounters gl_MaxGeometryImageUniforms gl_MaxGeometryInputComponents ' +
'gl_MaxGeometryOutputComponents gl_MaxGeometryOutputVertices gl_MaxGeometryTextureImageUnits ' +
'gl_MaxGeometryTotalOutputComponents gl_MaxGeometryUniformComponents gl_MaxGeometryVaryingComponents ' +
'gl_MaxImageSamples gl_MaxImageUnits gl_MaxLights gl_MaxPatchVertices gl_MaxProgramTexelOffset ' +
'gl_MaxTessControlAtomicCounterBuffers gl_MaxTessControlAtomicCounters gl_MaxTessControlImageUniforms ' +
'gl_MaxTessControlInputComponents gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits ' +
'gl_MaxTessControlTotalOutputComponents gl_MaxTessControlUniformComponents ' +
'gl_MaxTessEvaluationAtomicCounterBuffers gl_MaxTessEvaluationAtomicCounters ' +
'gl_MaxTessEvaluationImageUniforms gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents ' +
'gl_MaxTessEvaluationTextureImageUnits gl_MaxTessEvaluationUniformComponents ' +
'gl_MaxTessGenLevel gl_MaxTessPatchComponents gl_MaxTextureCoords gl_MaxTextureImageUnits ' +
'gl_MaxTextureUnits gl_MaxVaryingComponents gl_MaxVaryingFloats gl_MaxVaryingVectors ' +
'gl_MaxVertexAtomicCounterBuffers gl_MaxVertexAtomicCounters gl_MaxVertexAttribs gl_MaxVertexImageUniforms ' +
'gl_MaxVertexOutputComponents gl_MaxVertexOutputVectors gl_MaxVertexTextureImageUnits ' +
'gl_MaxVertexUniformComponents gl_MaxVertexUniformVectors gl_MaxViewports gl_MinProgramTexelOffset ' +
// Variables
'gl_BackColor gl_BackLightModelProduct gl_BackLightProduct gl_BackMaterial ' +
'gl_BackSecondaryColor gl_ClipDistance gl_ClipPlane gl_ClipVertex gl_Color ' +
'gl_DepthRange gl_EyePlaneQ gl_EyePlaneR gl_EyePlaneS gl_EyePlaneT gl_Fog gl_FogCoord ' +
'gl_FogFragCoord gl_FragColor gl_FragCoord gl_FragData gl_FragDepth gl_FrontColor ' +
'gl_FrontFacing gl_FrontLightModelProduct gl_FrontLightProduct gl_FrontMaterial ' +
'gl_FrontSecondaryColor gl_GlobalInvocationID gl_InstanceID gl_InvocationID gl_Layer gl_LightModel ' +
'gl_LightSource gl_LocalInvocationID gl_LocalInvocationIndex gl_ModelViewMatrix ' +
'gl_ModelViewMatrixInverse gl_ModelViewMatrixInverseTranspose gl_ModelViewMatrixTranspose ' +
'gl_ModelViewProjectionMatrix gl_ModelViewProjectionMatrixInverse gl_ModelViewProjectionMatrixInverseTranspose ' +
'gl_ModelViewProjectionMatrixTranspose gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 ' +
'gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 ' +
'gl_Normal gl_NormalMatrix gl_NormalScale gl_NumSamples gl_NumWorkGroups gl_ObjectPlaneQ ' +
'gl_ObjectPlaneR gl_ObjectPlaneS gl_ObjectPlaneT gl_PatchVerticesIn gl_Point gl_PointCoord ' +
'gl_PointSize gl_Position gl_PrimitiveID gl_PrimitiveIDIn gl_ProjectionMatrix gl_ProjectionMatrixInverse ' +
'gl_ProjectionMatrixInverseTranspose gl_ProjectionMatrixTranspose gl_SampleID gl_SampleMask ' +
'gl_SampleMaskIn gl_SamplePosition gl_SecondaryColor gl_TessCoord gl_TessLevelInner gl_TessLevelOuter ' +
'gl_TexCoord gl_TextureEnvColor gl_TextureMatrix gl_TextureMatrixInverse gl_TextureMatrixInverseTranspose ' +
'gl_TextureMatrixTranspose gl_Vertex gl_VertexID gl_ViewportIndex gl_WorkGroupID gl_WorkGroupSize gl_in gl_out ' +
// Functions
'EmitStreamVertex EmitVertex EndPrimitive EndStreamPrimitive abs acos acosh all any asin ' +
'asinh atan atanh atomicAdd atomicAnd atomicCompSwap atomicCounter atomicCounterDecrement ' +
'atomicCounterIncrement atomicExchange atomicMax atomicMin atomicOr atomicXor barrier ' +
'bitCount bitfieldExtract bitfieldInsert bitfieldReverse ceil clamp cos cosh cross ' +
'dFdx dFdy degrees determinant distance dot equal exp exp2 faceforward findLSB findMSB ' +
'floatBitsToInt floatBitsToUint floor fma fract frexp ftransform fwidth greaterThan ' +
'greaterThanEqual groupMemoryBarrier imageAtomicAdd imageAtomicAnd imageAtomicCompSwap ' +
'imageAtomicExchange imageAtomicMax imageAtomicMin imageAtomicOr imageAtomicXor imageLoad ' +
'imageSize imageStore imulExtended intBitsToFloat interpolateAtCentroid interpolateAtOffset ' +
'interpolateAtSample inverse inversesqrt isinf isnan ldexp length lessThan lessThanEqual log ' +
'log2 matrixCompMult max memoryBarrier memoryBarrierAtomicCounter memoryBarrierBuffer ' +
'memoryBarrierImage memoryBarrierShared min mix mod modf noise1 noise2 noise3 noise4 ' +
'normalize not notEqual outerProduct packDouble2x32 packHalf2x16 packSnorm2x16 packSnorm4x8 ' +
'packUnorm2x16 packUnorm4x8 pow radians reflect refract round roundEven shadow1D shadow1DLod ' +
'shadow1DProj shadow1DProjLod shadow2D shadow2DLod shadow2DProj shadow2DProjLod sign sin sinh ' +
'smoothstep sqrt step tan tanh texelFetch texelFetchOffset texture texture1D texture1DLod ' +
'texture1DProj texture1DProjLod texture2D texture2DLod texture2DProj texture2DProjLod ' +
'texture3D texture3DLod texture3DProj texture3DProjLod textureCube textureCubeLod ' +
'textureGather textureGatherOffset textureGatherOffsets textureGrad textureGradOffset ' +
'textureLod textureLodOffset textureOffset textureProj textureProjGrad textureProjGradOffset ' +
'textureProjLod textureProjLodOffset textureProjOffset textureQueryLevels textureQueryLod ' +
'textureSize transpose trunc uaddCarry uintBitsToFloat umulExtended unpackDouble2x32 ' +
'unpackHalf2x16 unpackSnorm2x16 unpackSnorm4x8 unpackUnorm2x16 unpackUnorm4x8 usubBorrow',
literal: 'true false'
},
illegal: '"',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.C_NUMBER_MODE,
{
className: 'meta',
begin: '#', end: '$'
}
]
};
}

View File

@ -0,0 +1,61 @@
/*
Language: Go
Author: Stephan Kountso aka StepLg <steplg@gmail.com>
Contributors: Evgeny Stepanischev <imbolk@gmail.com>
Description: Google go language (golang). For info about language see http://golang.org/
Category: system
*/
function(hljs) {
var GO_KEYWORDS = {
keyword:
'break default func interface select case map struct chan else goto package switch ' +
'const fallthrough if range type continue for import return var go defer ' +
'bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 ' +
'uint16 uint32 uint64 int uint uintptr rune',
literal:
'true false iota nil',
built_in:
'append cap close complex copy imag len make new panic print println real recover delete'
};
return {
aliases: ['golang'],
keywords: GO_KEYWORDS,
illegal: '</',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'string',
variants: [
hljs.QUOTE_STRING_MODE,
{begin: '\'', end: '[^\\\\]\''},
{begin: '`', end: '`'},
]
},
{
className: 'number',
variants: [
{begin: hljs.C_NUMBER_RE + '[dflsi]', relevance: 1},
hljs.C_NUMBER_MODE
]
},
{
begin: /:=/ // relevance booster
},
{
className: 'function',
beginKeywords: 'func', end: /\s*\{/, excludeEnd: true,
contains: [
hljs.TITLE_MODE,
{
className: 'params',
begin: /\(/, end: /\)/,
keywords: GO_KEYWORDS,
illegal: /["']/
}
]
}
]
};
}

View File

@ -0,0 +1,28 @@
/*
Language: Golo
Author: Philippe Charriere <ph.charriere@gmail.com>
Description: a lightweight dynamic language for the JVM, see http://golo-lang.org/
*/
function(hljs) {
return {
keywords: {
keyword:
'println readln print import module function local return let var ' +
'while for foreach times in case when match with break continue ' +
'augment augmentation each find filter reduce ' +
'if then else otherwise try catch finally raise throw orIfNull ' +
'DynamicObject|10 DynamicVariable struct Observable map set vector list array',
literal:
'true false null'
},
contains: [
hljs.HASH_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
{
className: 'meta', begin: '@[A-Za-z]+'
}
]
}
}

View File

@ -0,0 +1,40 @@
/*
Language: Gradle
Author: Damian Mee <mee.damian@gmail.com>
Website: http://meeDamian.com
*/
function(hljs) {
return {
case_insensitive: true,
keywords: {
keyword:
'task project allprojects subprojects artifacts buildscript configurations ' +
'dependencies repositories sourceSets description delete from into include ' +
'exclude source classpath destinationDir includes options sourceCompatibility ' +
'targetCompatibility group flatDir doLast doFirst flatten todir fromdir ant ' +
'def abstract break case catch continue default do else extends final finally ' +
'for if implements instanceof native new private protected public return static ' +
'switch synchronized throw throws transient try volatile while strictfp package ' +
'import false null super this true antlrtask checkstyle codenarc copy boolean ' +
'byte char class double float int interface long short void compile runTime ' +
'file fileTree abs any append asList asWritable call collect compareTo count ' +
'div dump each eachByte eachFile eachLine every find findAll flatten getAt ' +
'getErr getIn getOut getText grep immutable inject inspect intersect invokeMethods ' +
'isCase join leftShift minus multiply newInputStream newOutputStream newPrintWriter ' +
'newReader newWriter next plus pop power previous print println push putAt read ' +
'readBytes readLines reverse reverseEach round size sort splitEachLine step subMap ' +
'times toInteger toList tokenize upto waitForOrKill withPrintWriter withReader ' +
'withStream withWriter withWriterAppend write writeLine'
},
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
hljs.NUMBER_MODE,
hljs.REGEXP_MODE
]
}
}

View File

@ -0,0 +1,100 @@
/*
Language: Groovy
Author: Guillaume Laforge <glaforge@gmail.com>
Website: http://glaforge.appspot.com
Description: Groovy programming language implementation inspired from Vsevolod's Java mode
*/
function(hljs) {
return {
keywords: {
literal : 'true false null',
keyword:
'byte short char int long boolean float double void ' +
// groovy specific keywords
'def as in assert trait ' +
// common keywords with Java
'super this abstract static volatile transient public private protected synchronized final ' +
'class interface enum if else for while switch case break default continue ' +
'throw throws try catch finally implements extends new import package return instanceof'
},
contains: [
hljs.COMMENT(
'/\\*\\*',
'\\*/',
{
relevance : 0,
contains : [
{
// eat up @'s in emails to prevent them to be recognized as doctags
begin: /\w+@/, relevance: 0
},
{
className : 'doctag',
begin : '@[A-Za-z]+'
}
]
}
),
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'string',
begin: '"""', end: '"""'
},
{
className: 'string',
begin: "'''", end: "'''"
},
{
className: 'string',
begin: "\\$/", end: "/\\$",
relevance: 10
},
hljs.APOS_STRING_MODE,
{
className: 'regexp',
begin: /~?\/[^\/\n]+\//,
contains: [
hljs.BACKSLASH_ESCAPE
]
},
hljs.QUOTE_STRING_MODE,
{
className: 'meta',
begin: "^#!/usr/bin/env", end: '$',
illegal: '\n'
},
hljs.BINARY_NUMBER_MODE,
{
className: 'class',
beginKeywords: 'class interface trait enum', end: '{',
illegal: ':',
contains: [
{beginKeywords: 'extends implements'},
hljs.UNDERSCORE_TITLE_MODE
]
},
hljs.C_NUMBER_MODE,
{
className: 'meta', begin: '@[A-Za-z]+'
},
{
// highlight map keys and named parameters as strings
className: 'string', begin: /[^\?]{0}[A-Za-z0-9_$]+ *:/
},
{
// catch middle element of the ternary operator
// to avoid highlight it as a label, named parameter, or map key
begin: /\?/, end: /\:/
},
{
// highlight labeled statements
className: 'symbol', begin: '^\\s*[A-Za-z0-9_$]+:',
relevance: 0
}
],
illegal: /#|<\//
}
}

View File

@ -0,0 +1,114 @@
/*
Language: Haml
Requires: ruby.js
Author: Dan Allen <dan.j.allen@gmail.com>
Website: http://google.com/profiles/dan.j.allen
Category: template
*/
// TODO support filter tags like :javascript, support inline HTML
function(hljs) {
return {
case_insensitive: true,
contains: [
{
className: 'meta',
begin: '^!!!( (5|1\\.1|Strict|Frameset|Basic|Mobile|RDFa|XML\\b.*))?$',
relevance: 10
},
// FIXME these comments should be allowed to span indented lines
hljs.COMMENT(
'^\\s*(!=#|=#|-#|/).*$',
false,
{
relevance: 0
}
),
{
begin: '^\\s*(-|=|!=)(?!#)',
starts: {
end: '\\n',
subLanguage: 'ruby'
}
},
{
className: 'tag',
begin: '^\\s*%',
contains: [
{
className: 'selector-tag',
begin: '\\w+'
},
{
className: 'selector-id',
begin: '#[\\w-]+'
},
{
className: 'selector-class',
begin: '\\.[\\w-]+'
},
{
begin: '{\\s*',
end: '\\s*}',
contains: [
{
begin: ':\\w+\\s*=>',
end: ',\\s+',
returnBegin: true,
endsWithParent: true,
contains: [
{
className: 'attr',
begin: ':\\w+'
},
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
{
begin: '\\w+',
relevance: 0
}
]
}
]
},
{
begin: '\\(\\s*',
end: '\\s*\\)',
excludeEnd: true,
contains: [
{
begin: '\\w+\\s*=',
end: '\\s+',
returnBegin: true,
endsWithParent: true,
contains: [
{
className: 'attr',
begin: '\\w+',
relevance: 0
},
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
{
begin: '\\w+',
relevance: 0
}
]
}
]
}
]
},
{
begin: '^\\s*[=~]\\s*'
},
{
begin: '#{',
starts: {
end: '}',
subLanguage: 'ruby'
}
}
]
};
}

View File

@ -0,0 +1,41 @@
/*
Language: Handlebars
Requires: xml.js
Author: Robin Ward <robin.ward@gmail.com>
Description: Matcher for Handlebars as well as EmberJS additions.
Category: template
*/
function(hljs) {
var BUILT_INS = {'builtin-name': 'each in with if else unless bindattr action collection debugger log outlet template unbound view yield'};
return {
aliases: ['hbs', 'html.hbs', 'html.handlebars'],
case_insensitive: true,
subLanguage: 'xml',
contains: [
hljs.COMMENT('{{!(--)?', '(--)?}}'),
{
className: 'template-tag',
begin: /\{\{[#\/]/, end: /\}\}/,
contains: [
{
className: 'name',
begin: /[a-zA-Z\.-]+/,
keywords: BUILT_INS,
starts: {
endsWithParent: true, relevance: 0,
contains: [
hljs.QUOTE_STRING_MODE
]
}
}
]
},
{
className: 'template-variable',
begin: /\{\{/, end: /\}\}/,
keywords: BUILT_INS
}
]
};
}

Some files were not shown because too many files have changed in this diff Show More