This commit is contained in:
Zachary Yedidia
2017-08-24 13:15:01 -04:00
8 changed files with 95 additions and 22 deletions

41
runtime/syntax/julia.yaml Normal file
View File

@@ -0,0 +1,41 @@
filetype: julia
detect:
filename: "\\.jl$"
header: "^#!.*/(env +)?julia( |$)"
rules:
# built-in objects
- constant.bool: "\\b(true|false)\\b"
# built-in attributes
- constant: "__[A-Za-z0-9_]+__"
# definitions
- identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
# keywords
- statement: "\\b(begin|break|catch|continue|function|elseif|else|end|finally|for|global|local|if|include|using|require|macro|println|return|try|type|while|module)\\b"
# decorators
- identifier.macro: "@[A-Za-z0-9_]+"
# operators
- symbol.operator: "[-+*/|=%<>&~^]|\\b(and|not|or|is|in)\\b"
# parentheses
- symbol.brackets: "([(){}]|\\[|\\])"
# numbers
- constant.number: "\\b[0-9]+\\b"
- constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
- constant.string:
start: "\"\"\""
end: "\"\"\""
rules: []
- constant.string:
start: "'''"
end: "'''"
rules: []
- comment:
start: "#"
end: "$"
rules: []

View File

@@ -1,7 +1,7 @@
filetype: ledger
detect:
filename: "(^|\\.|/)ledger|ldgr|beancount|bnct$"
filename: "(^|\\.|/)(ledger|ldgr|beancount|bnct)$"
rules:
- special: "^([0-9]{4}(/|-)[0-9]{2}(/|-)[0-9]{2}|[=~]) .*"

View File

@@ -15,16 +15,24 @@ func main() {
for _, f := range files {
if strings.HasSuffix(f.Name(), ".yaml") {
input, _ := ioutil.ReadFile(f.Name())
_, err := highlight.ParseDef(input)
//fmt.Println("Checking file -> ", f.Name())
file, err := highlight.ParseFile(input)
if err != nil {
hadErr = true
fmt.Printf("%s:\n", f.Name())
fmt.Printf("Could not parse file -> %s:\n", f.Name())
fmt.Println(err)
continue
}
_, err1 := highlight.ParseDef(file, nil)
if err1 != nil {
hadErr = true
fmt.Printf("Could not parse input file using highlight.ParseDef(%s):\n", f.Name())
fmt.Println(err1)
continue
}
}
}
if !hadErr {
fmt.Println("No issues!")
fmt.Println("No issues found!")
}
}

View File

@@ -15,16 +15,16 @@ rules:
- special: "(^---|^\\.\\.\\.|^%YAML|^%TAG)"
- constant.string:
start: "\""
start: "(^| )\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
start: "(^| )'"
end: "'"
skip: "\\\\."
skip: "(\\\\.)|('')"
rules:
- constant.specialChar: "\\\\."