Instantly share code, notes, and snippets.

Embed
What would you like to do?
highlighting Julia code with a2p(1)
# Style sheet for julia
# Ref: https://groups.google.com/forum/#!topic/julia-users/tisM_9sKPCc
# Gist: https://gist.github.com/t-nissie/83174cab99b11a2b5fa075ad845e6b4f
##
style Julia is
written by "Takeshi Nishimatsu"
version is 0.0.1
first alphabet is
"$@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_"
second alphabet is
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_"
case sensitive
keywords in Keyword_strong are
global, for, while, if, else, elseif, break,
switch, "case", otherwise, try, catch, "end", const, immutable,
import, importall, export, type, typealias, return, true,
false, macro, quote, "in", abstract, using, continue,
ifelse, do, eval, let, finally, throw,
# built-in function
cell, collect, filter, merge, divrem, hex, dec, oct, base,
int, round, cmp, float, linspace, fill, start, done, tuple,
minimum, maximum, count, index, append, push, pop, shift,
unshift, insert, splice, reverse, sort, zip, length, delete,
copy, haskey, keys, values, get, getkey, Set, isa, issubset,
intersect, setdiff, symdiff, complement, print, printf, println,
sprintf, join, utf8, char, search, rsearch, beginswith, endswith,
replace, lowercase, uppercase, ucfirst, lcfirst,
split, rsplit, chop, chomp, lpad, rpad, lstrip, rstrip,
strip, isalnum, isalpha, isascii, isblank, iscntrl, isdigit,
isgraph, islower, isprint, ispunct, isspace, isupper, isxdigit,
match, captures, offset, offsets, matchall, eachmatch, hcat,
vcat, hvcat, reshape, deepcopy, similar, reinterpret, map,
reduce, mapreduce, DataArray, DataFrame, removeNA, replaceNA,
colnames, head, tail, describe, join, groupby, "by", stack,
readtable, readcsv, readdlm, writetable, writecsv, writedlm,
require, reload, include, evalfile, cd, open, write, close,
position, seek, seekstart, seekend, skip, isopen, eof,
isreadonly, ltoh, htol, serialize, deserialize, download,
# System interaction
run, spawn, success, process_running, process_exited, kill,
readsfrom, writesto, readsandwrite, detach, setenv, ENV, getpid,
clipboard, strftime, time, cd, gethostname, getipaddr, pwd,
mkdir, mkpath, rmdir, ignorestatus
end keywords
sequences are
# Strings
C-string,
"'" Plain String "'" Plain
exceptions are
"\\'", "\\\\"
end exceptions,
# Comments
"#" Comment,
/^=begin/ Comment_strong /^=end/,
# Some declarations
(/(function|module)/ # \1. the keyword
/([[:blank:]]+)/ # \2. blanks
\1 Keyword_strong, \2 Plain) (Label_strong + Index1)
closers are
/$/ Plain,
/[ ;{]/ Plain
end closers
end sequences
end style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment