pygments.rb 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +51 -1
- data/ext/extconf.rb +1 -1
- data/ext/pygments.c +12 -1
- data/lib/pygments/ffi.rb +1 -0
- data/lib/pygments/lexer.rb +1 -1
- data/lib/pygments/version.rb +1 -1
- data/vendor/pygments-main/AUTHORS +3 -0
- data/vendor/pygments-main/CHANGES +5 -0
- data/vendor/pygments-main/REVISION +1 -1
- data/vendor/pygments-main/docs/src/lexerdevelopment.txt +1 -1
- data/vendor/pygments-main/docs/src/styles.txt +1 -1
- data/vendor/pygments-main/pygments/cmdline.py +1 -1
- data/vendor/pygments-main/pygments/formatters/latex.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_mapping.py +4 -1
- data/vendor/pygments-main/pygments/lexers/agile.py +21 -29
- data/vendor/pygments-main/pygments/lexers/functional.py +327 -3
- data/vendor/pygments-main/pygments/lexers/math.py +400 -7
- data/vendor/pygments-main/pygments/lexers/other.py +210 -170
- data/vendor/pygments-main/pygments/lexers/postgres.py +1 -1
- data/vendor/pygments-main/pygments/lexers/pypylog.py +6 -4
- data/vendor/pygments-main/pygments/lexers/web.py +45 -8
- data/vendor/pygments-main/tests/examplefiles/example.sml +156 -0
- data/vendor/pygments-main/tests/examplefiles/intsyn.fun +675 -0
- data/vendor/pygments-main/tests/examplefiles/intsyn.sig +286 -0
- data/vendor/pygments-main/tests/examplefiles/psql_session.txt +1 -0
- data/vendor/pygments-main/tests/examplefiles/test.nim +93 -0
- metadata +10 -6
@@ -17,8 +17,8 @@ from pygments.token import Comment, String, Punctuation, Keyword, Name, \
|
|
17
17
|
|
18
18
|
from pygments.lexers.agile import PythonLexer
|
19
19
|
|
20
|
-
__all__ = ['MuPADLexer', 'MatlabLexer', 'MatlabSessionLexer', '
|
21
|
-
'RConsoleLexer', 'SLexer']
|
20
|
+
__all__ = ['MuPADLexer', 'MatlabLexer', 'MatlabSessionLexer', 'OctaveLexer',
|
21
|
+
'NumPyLexer', 'RConsoleLexer', 'SLexer']
|
22
22
|
|
23
23
|
|
24
24
|
class MuPADLexer(RegexLexer):
|
@@ -94,13 +94,13 @@ class MuPADLexer(RegexLexer):
|
|
94
94
|
|
95
95
|
class MatlabLexer(RegexLexer):
|
96
96
|
"""
|
97
|
-
For Matlab
|
97
|
+
For Matlab source code.
|
98
98
|
Contributed by Ken Schutte <kschutte@csail.mit.edu>.
|
99
99
|
|
100
100
|
*New in Pygments 0.10.*
|
101
101
|
"""
|
102
102
|
name = 'Matlab'
|
103
|
-
aliases = ['matlab'
|
103
|
+
aliases = ['matlab']
|
104
104
|
filenames = ['*.m']
|
105
105
|
mimetypes = ['text/matlab']
|
106
106
|
|
@@ -195,11 +195,12 @@ class MatlabLexer(RegexLexer):
|
|
195
195
|
return 0.9
|
196
196
|
return 0.1
|
197
197
|
|
198
|
+
|
198
199
|
line_re = re.compile('.*?\n')
|
199
200
|
|
200
201
|
class MatlabSessionLexer(Lexer):
|
201
202
|
"""
|
202
|
-
For Matlab
|
203
|
+
For Matlab sessions. Modeled after PythonConsoleLexer.
|
203
204
|
Contributed by Ken Schutte <kschutte@csail.mit.edu>.
|
204
205
|
|
205
206
|
*New in Pygments 0.10.*
|
@@ -246,12 +247,404 @@ class MatlabSessionLexer(Lexer):
|
|
246
247
|
yield item
|
247
248
|
|
248
249
|
|
250
|
+
class OctaveLexer(RegexLexer):
|
251
|
+
"""
|
252
|
+
For GNU Octave source code.
|
253
|
+
|
254
|
+
*New in Pygments 1.5.*
|
255
|
+
"""
|
256
|
+
name = 'Octave'
|
257
|
+
aliases = ['octave']
|
258
|
+
filenames = ['*.m']
|
259
|
+
mimetypes = ['text/octave']
|
260
|
+
|
261
|
+
# These lists are generated automatically.
|
262
|
+
# Run the following in bash shell:
|
263
|
+
#
|
264
|
+
# First dump all of the Octave manual into a plain text file:
|
265
|
+
#
|
266
|
+
# $ info octave --subnodes -o octave-manual
|
267
|
+
#
|
268
|
+
# Now grep through it:
|
269
|
+
|
270
|
+
# for i in \
|
271
|
+
# "Built-in Function" "Command" "Function File" \
|
272
|
+
# "Loadable Function" "Mapping Function";
|
273
|
+
# do
|
274
|
+
# perl -e '@name = qw('"$i"');
|
275
|
+
# print lc($name[0]),"_kw = [\n"';
|
276
|
+
#
|
277
|
+
# perl -n -e 'print "\"$1\",\n" if /-- '"$i"': .* (\w*) \(/;' \
|
278
|
+
# octave-manual | sort | uniq ;
|
279
|
+
# echo "]" ;
|
280
|
+
# echo;
|
281
|
+
# done
|
282
|
+
|
283
|
+
# taken from Octave Mercurial changeset 8cc154f45e37 (30-jan-2011)
|
284
|
+
|
285
|
+
builtin_kw = [ "addlistener", "addpath", "addproperty", "all",
|
286
|
+
"and", "any", "argnames", "argv", "assignin",
|
287
|
+
"atexit", "autoload",
|
288
|
+
"available_graphics_toolkits", "beep_on_error",
|
289
|
+
"bitand", "bitmax", "bitor", "bitshift", "bitxor",
|
290
|
+
"cat", "cell", "cellstr", "char", "class", "clc",
|
291
|
+
"columns", "command_line_path",
|
292
|
+
"completion_append_char", "completion_matches",
|
293
|
+
"complex", "confirm_recursive_rmdir", "cputime",
|
294
|
+
"crash_dumps_octave_core", "ctranspose", "cumprod",
|
295
|
+
"cumsum", "debug_on_error", "debug_on_interrupt",
|
296
|
+
"debug_on_warning", "default_save_options",
|
297
|
+
"dellistener", "diag", "diff", "disp",
|
298
|
+
"doc_cache_file", "do_string_escapes", "double",
|
299
|
+
"drawnow", "e", "echo_executing_commands", "eps",
|
300
|
+
"eq", "errno", "errno_list", "error", "eval",
|
301
|
+
"evalin", "exec", "exist", "exit", "eye", "false",
|
302
|
+
"fclear", "fclose", "fcntl", "fdisp", "feof",
|
303
|
+
"ferror", "feval", "fflush", "fgetl", "fgets",
|
304
|
+
"fieldnames", "file_in_loadpath", "file_in_path",
|
305
|
+
"filemarker", "filesep", "find_dir_in_path",
|
306
|
+
"fixed_point_format", "fnmatch", "fopen", "fork",
|
307
|
+
"formula", "fprintf", "fputs", "fread", "freport",
|
308
|
+
"frewind", "fscanf", "fseek", "fskipl", "ftell",
|
309
|
+
"functions", "fwrite", "ge", "genpath", "get",
|
310
|
+
"getegid", "getenv", "geteuid", "getgid",
|
311
|
+
"getpgrp", "getpid", "getppid", "getuid", "glob",
|
312
|
+
"gt", "gui_mode", "history_control",
|
313
|
+
"history_file", "history_size",
|
314
|
+
"history_timestamp_format_string", "home",
|
315
|
+
"horzcat", "hypot", "ifelse",
|
316
|
+
"ignore_function_time_stamp", "inferiorto",
|
317
|
+
"info_file", "info_program", "inline", "input",
|
318
|
+
"intmax", "intmin", "ipermute",
|
319
|
+
"is_absolute_filename", "isargout", "isbool",
|
320
|
+
"iscell", "iscellstr", "ischar", "iscomplex",
|
321
|
+
"isempty", "isfield", "isfloat", "isglobal",
|
322
|
+
"ishandle", "isieee", "isindex", "isinteger",
|
323
|
+
"islogical", "ismatrix", "ismethod", "isnull",
|
324
|
+
"isnumeric", "isobject", "isreal",
|
325
|
+
"is_rooted_relative_filename", "issorted",
|
326
|
+
"isstruct", "isvarname", "kbhit", "keyboard",
|
327
|
+
"kill", "lasterr", "lasterror", "lastwarn",
|
328
|
+
"ldivide", "le", "length", "link", "linspace",
|
329
|
+
"logical", "lstat", "lt", "make_absolute_filename",
|
330
|
+
"makeinfo_program", "max_recursion_depth", "merge",
|
331
|
+
"methods", "mfilename", "minus", "mislocked",
|
332
|
+
"mkdir", "mkfifo", "mkstemp", "mldivide", "mlock",
|
333
|
+
"mouse_wheel_zoom", "mpower", "mrdivide", "mtimes",
|
334
|
+
"munlock", "nargin", "nargout",
|
335
|
+
"native_float_format", "ndims", "ne", "nfields",
|
336
|
+
"nnz", "norm", "not", "numel", "nzmax",
|
337
|
+
"octave_config_info", "octave_core_file_limit",
|
338
|
+
"octave_core_file_name",
|
339
|
+
"octave_core_file_options", "ones", "or",
|
340
|
+
"output_max_field_width", "output_precision",
|
341
|
+
"page_output_immediately", "page_screen_output",
|
342
|
+
"path", "pathsep", "pause", "pclose", "permute",
|
343
|
+
"pi", "pipe", "plus", "popen", "power",
|
344
|
+
"print_empty_dimensions", "printf",
|
345
|
+
"print_struct_array_contents", "prod",
|
346
|
+
"program_invocation_name", "program_name",
|
347
|
+
"putenv", "puts", "pwd", "quit", "rats", "rdivide",
|
348
|
+
"readdir", "readlink", "read_readline_init_file",
|
349
|
+
"realmax", "realmin", "rehash", "rename",
|
350
|
+
"repelems", "re_read_readline_init_file", "reset",
|
351
|
+
"reshape", "resize", "restoredefaultpath",
|
352
|
+
"rethrow", "rmdir", "rmfield", "rmpath", "rows",
|
353
|
+
"save_header_format_string", "save_precision",
|
354
|
+
"saving_history", "scanf", "set", "setenv",
|
355
|
+
"shell_cmd", "sighup_dumps_octave_core",
|
356
|
+
"sigterm_dumps_octave_core", "silent_functions",
|
357
|
+
"single", "size", "size_equal", "sizemax",
|
358
|
+
"sizeof", "sleep", "source", "sparse_auto_mutate",
|
359
|
+
"split_long_rows", "sprintf", "squeeze", "sscanf",
|
360
|
+
"stat", "stderr", "stdin", "stdout", "strcmp",
|
361
|
+
"strcmpi", "string_fill_char", "strncmp",
|
362
|
+
"strncmpi", "struct", "struct_levels_to_print",
|
363
|
+
"strvcat", "subsasgn", "subsref", "sum", "sumsq",
|
364
|
+
"superiorto", "suppress_verbose_help_message",
|
365
|
+
"symlink", "system", "tic", "tilde_expand",
|
366
|
+
"times", "tmpfile", "tmpnam", "toc", "toupper",
|
367
|
+
"transpose", "true", "typeinfo", "umask", "uminus",
|
368
|
+
"uname", "undo_string_escapes", "unlink", "uplus",
|
369
|
+
"upper", "usage", "usleep", "vec", "vectorize",
|
370
|
+
"vertcat", "waitpid", "warning", "warranty",
|
371
|
+
"whos_line_format", "yes_or_no", "zeros",
|
372
|
+
"inf", "Inf", "nan", "NaN"]
|
373
|
+
|
374
|
+
command_kw = [ "close", "load", "who", "whos", ]
|
375
|
+
|
376
|
+
function_kw = [ "accumarray", "accumdim", "acosd", "acotd",
|
377
|
+
"acscd", "addtodate", "allchild", "ancestor",
|
378
|
+
"anova", "arch_fit", "arch_rnd", "arch_test",
|
379
|
+
"area", "arma_rnd", "arrayfun", "ascii", "asctime",
|
380
|
+
"asecd", "asind", "assert", "atand",
|
381
|
+
"autoreg_matrix", "autumn", "axes", "axis", "bar",
|
382
|
+
"barh", "bartlett", "bartlett_test", "beep",
|
383
|
+
"betacdf", "betainv", "betapdf", "betarnd",
|
384
|
+
"bicgstab", "bicubic", "binary", "binocdf",
|
385
|
+
"binoinv", "binopdf", "binornd", "bitcmp",
|
386
|
+
"bitget", "bitset", "blackman", "blanks",
|
387
|
+
"blkdiag", "bone", "box", "brighten", "calendar",
|
388
|
+
"cast", "cauchy_cdf", "cauchy_inv", "cauchy_pdf",
|
389
|
+
"cauchy_rnd", "caxis", "celldisp", "center", "cgs",
|
390
|
+
"chisquare_test_homogeneity",
|
391
|
+
"chisquare_test_independence", "circshift", "cla",
|
392
|
+
"clabel", "clf", "clock", "cloglog", "closereq",
|
393
|
+
"colon", "colorbar", "colormap", "colperm",
|
394
|
+
"comet", "common_size", "commutation_matrix",
|
395
|
+
"compan", "compare_versions", "compass",
|
396
|
+
"computer", "cond", "condest", "contour",
|
397
|
+
"contourc", "contourf", "contrast", "conv",
|
398
|
+
"convhull", "cool", "copper", "copyfile", "cor",
|
399
|
+
"corrcoef", "cor_test", "cosd", "cotd", "cov",
|
400
|
+
"cplxpair", "cross", "cscd", "cstrcat", "csvread",
|
401
|
+
"csvwrite", "ctime", "cumtrapz", "curl", "cut",
|
402
|
+
"cylinder", "date", "datenum", "datestr",
|
403
|
+
"datetick", "datevec", "dblquad", "deal",
|
404
|
+
"deblank", "deconv", "delaunay", "delaunayn",
|
405
|
+
"delete", "demo", "detrend", "diffpara", "diffuse",
|
406
|
+
"dir", "discrete_cdf", "discrete_inv",
|
407
|
+
"discrete_pdf", "discrete_rnd", "display",
|
408
|
+
"divergence", "dlmwrite", "dos", "dsearch",
|
409
|
+
"dsearchn", "duplication_matrix", "durbinlevinson",
|
410
|
+
"ellipsoid", "empirical_cdf", "empirical_inv",
|
411
|
+
"empirical_pdf", "empirical_rnd", "eomday",
|
412
|
+
"errorbar", "etime", "etreeplot", "example",
|
413
|
+
"expcdf", "expinv", "expm", "exppdf", "exprnd",
|
414
|
+
"ezcontour", "ezcontourf", "ezmesh", "ezmeshc",
|
415
|
+
"ezplot", "ezpolar", "ezsurf", "ezsurfc", "factor",
|
416
|
+
"factorial", "fail", "fcdf", "feather", "fftconv",
|
417
|
+
"fftfilt", "fftshift", "figure", "fileattrib",
|
418
|
+
"fileparts", "fill", "findall", "findobj",
|
419
|
+
"findstr", "finv", "flag", "flipdim", "fliplr",
|
420
|
+
"flipud", "fpdf", "fplot", "fractdiff", "freqz",
|
421
|
+
"freqz_plot", "frnd", "fsolve",
|
422
|
+
"f_test_regression", "ftp", "fullfile", "fzero",
|
423
|
+
"gamcdf", "gaminv", "gampdf", "gamrnd", "gca",
|
424
|
+
"gcbf", "gcbo", "gcf", "genvarname", "geocdf",
|
425
|
+
"geoinv", "geopdf", "geornd", "getfield", "ginput",
|
426
|
+
"glpk", "gls", "gplot", "gradient",
|
427
|
+
"graphics_toolkit", "gray", "grid", "griddata",
|
428
|
+
"griddatan", "gtext", "gunzip", "gzip", "hadamard",
|
429
|
+
"hamming", "hankel", "hanning", "hggroup",
|
430
|
+
"hidden", "hilb", "hist", "histc", "hold", "hot",
|
431
|
+
"hotelling_test", "housh", "hsv", "hurst",
|
432
|
+
"hygecdf", "hygeinv", "hygepdf", "hygernd",
|
433
|
+
"idivide", "ifftshift", "image", "imagesc",
|
434
|
+
"imfinfo", "imread", "imshow", "imwrite", "index",
|
435
|
+
"info", "inpolygon", "inputname", "interpft",
|
436
|
+
"interpn", "intersect", "invhilb", "iqr", "isa",
|
437
|
+
"isdefinite", "isdir", "is_duplicate_entry",
|
438
|
+
"isequal", "isequalwithequalnans", "isfigure",
|
439
|
+
"ishermitian", "ishghandle", "is_leap_year",
|
440
|
+
"isletter", "ismac", "ismember", "ispc", "isprime",
|
441
|
+
"isprop", "isscalar", "issquare", "isstrprop",
|
442
|
+
"issymmetric", "isunix", "is_valid_file_id",
|
443
|
+
"isvector", "jet", "kendall",
|
444
|
+
"kolmogorov_smirnov_cdf",
|
445
|
+
"kolmogorov_smirnov_test", "kruskal_wallis_test",
|
446
|
+
"krylov", "kurtosis", "laplace_cdf", "laplace_inv",
|
447
|
+
"laplace_pdf", "laplace_rnd", "legend", "legendre",
|
448
|
+
"license", "line", "linkprop", "list_primes",
|
449
|
+
"loadaudio", "loadobj", "logistic_cdf",
|
450
|
+
"logistic_inv", "logistic_pdf", "logistic_rnd",
|
451
|
+
"logit", "loglog", "loglogerr", "logm", "logncdf",
|
452
|
+
"logninv", "lognpdf", "lognrnd", "logspace",
|
453
|
+
"lookfor", "ls_command", "lsqnonneg", "magic",
|
454
|
+
"mahalanobis", "manova", "matlabroot",
|
455
|
+
"mcnemar_test", "mean", "meansq", "median", "menu",
|
456
|
+
"mesh", "meshc", "meshgrid", "meshz", "mexext",
|
457
|
+
"mget", "mkpp", "mode", "moment", "movefile",
|
458
|
+
"mpoles", "mput", "namelengthmax", "nargchk",
|
459
|
+
"nargoutchk", "nbincdf", "nbininv", "nbinpdf",
|
460
|
+
"nbinrnd", "nchoosek", "ndgrid", "newplot", "news",
|
461
|
+
"nonzeros", "normcdf", "normest", "norminv",
|
462
|
+
"normpdf", "normrnd", "now", "nthroot", "null",
|
463
|
+
"ocean", "ols", "onenormest", "optimget",
|
464
|
+
"optimset", "orderfields", "orient", "orth",
|
465
|
+
"pack", "pareto", "parseparams", "pascal", "patch",
|
466
|
+
"pathdef", "pcg", "pchip", "pcolor", "pcr",
|
467
|
+
"peaks", "periodogram", "perl", "perms", "pie",
|
468
|
+
"pink", "planerot", "playaudio", "plot",
|
469
|
+
"plotmatrix", "plotyy", "poisscdf", "poissinv",
|
470
|
+
"poisspdf", "poissrnd", "polar", "poly",
|
471
|
+
"polyaffine", "polyarea", "polyderiv", "polyfit",
|
472
|
+
"polygcd", "polyint", "polyout", "polyreduce",
|
473
|
+
"polyval", "polyvalm", "postpad", "powerset",
|
474
|
+
"ppder", "ppint", "ppjumps", "ppplot", "ppval",
|
475
|
+
"pqpnonneg", "prepad", "primes", "print",
|
476
|
+
"print_usage", "prism", "probit", "qp", "qqplot",
|
477
|
+
"quadcc", "quadgk", "quadl", "quadv", "quiver",
|
478
|
+
"qzhess", "rainbow", "randi", "range", "rank",
|
479
|
+
"ranks", "rat", "reallog", "realpow", "realsqrt",
|
480
|
+
"record", "rectangle_lw", "rectangle_sw",
|
481
|
+
"rectint", "refresh", "refreshdata",
|
482
|
+
"regexptranslate", "repmat", "residue", "ribbon",
|
483
|
+
"rindex", "roots", "rose", "rosser", "rotdim",
|
484
|
+
"rref", "run", "run_count", "rundemos", "run_test",
|
485
|
+
"runtests", "saveas", "saveaudio", "saveobj",
|
486
|
+
"savepath", "scatter", "secd", "semilogx",
|
487
|
+
"semilogxerr", "semilogy", "semilogyerr",
|
488
|
+
"setaudio", "setdiff", "setfield", "setxor",
|
489
|
+
"shading", "shift", "shiftdim", "sign_test",
|
490
|
+
"sinc", "sind", "sinetone", "sinewave", "skewness",
|
491
|
+
"slice", "sombrero", "sortrows", "spaugment",
|
492
|
+
"spconvert", "spdiags", "spearman", "spectral_adf",
|
493
|
+
"spectral_xdf", "specular", "speed", "spencer",
|
494
|
+
"speye", "spfun", "sphere", "spinmap", "spline",
|
495
|
+
"spones", "sprand", "sprandn", "sprandsym",
|
496
|
+
"spring", "spstats", "spy", "sqp", "stairs",
|
497
|
+
"statistics", "std", "stdnormal_cdf",
|
498
|
+
"stdnormal_inv", "stdnormal_pdf", "stdnormal_rnd",
|
499
|
+
"stem", "stft", "strcat", "strchr", "strjust",
|
500
|
+
"strmatch", "strread", "strsplit", "strtok",
|
501
|
+
"strtrim", "strtrunc", "structfun", "studentize",
|
502
|
+
"subplot", "subsindex", "subspace", "substr",
|
503
|
+
"substruct", "summer", "surf", "surface", "surfc",
|
504
|
+
"surfl", "surfnorm", "svds", "swapbytes",
|
505
|
+
"sylvester_matrix", "symvar", "synthesis", "table",
|
506
|
+
"tand", "tar", "tcdf", "tempdir", "tempname",
|
507
|
+
"test", "text", "textread", "textscan", "tinv",
|
508
|
+
"title", "toeplitz", "tpdf", "trace", "trapz",
|
509
|
+
"treelayout", "treeplot", "triangle_lw",
|
510
|
+
"triangle_sw", "tril", "trimesh", "triplequad",
|
511
|
+
"triplot", "trisurf", "triu", "trnd", "tsearchn",
|
512
|
+
"t_test", "t_test_regression", "type", "unidcdf",
|
513
|
+
"unidinv", "unidpdf", "unidrnd", "unifcdf",
|
514
|
+
"unifinv", "unifpdf", "unifrnd", "union", "unique",
|
515
|
+
"unix", "unmkpp", "unpack", "untabify", "untar",
|
516
|
+
"unwrap", "unzip", "u_test", "validatestring",
|
517
|
+
"vander", "var", "var_test", "vech", "ver",
|
518
|
+
"version", "view", "voronoi", "voronoin",
|
519
|
+
"waitforbuttonpress", "wavread", "wavwrite",
|
520
|
+
"wblcdf", "wblinv", "wblpdf", "wblrnd", "weekday",
|
521
|
+
"welch_test", "what", "white", "whitebg",
|
522
|
+
"wienrnd", "wilcoxon_test", "wilkinson", "winter",
|
523
|
+
"xlabel", "xlim", "ylabel", "yulewalker", "zip",
|
524
|
+
"zlabel", "z_test", ]
|
525
|
+
|
526
|
+
loadable_kw = [ "airy", "amd", "balance", "besselh", "besseli",
|
527
|
+
"besselj", "besselk", "bessely", "bitpack",
|
528
|
+
"bsxfun", "builtin", "ccolamd", "cellfun",
|
529
|
+
"cellslices", "chol", "choldelete", "cholinsert",
|
530
|
+
"cholinv", "cholshift", "cholupdate", "colamd",
|
531
|
+
"colloc", "convhulln", "convn", "csymamd",
|
532
|
+
"cummax", "cummin", "daspk", "daspk_options",
|
533
|
+
"dasrt", "dasrt_options", "dassl", "dassl_options",
|
534
|
+
"dbclear", "dbdown", "dbstack", "dbstatus",
|
535
|
+
"dbstop", "dbtype", "dbup", "dbwhere", "det",
|
536
|
+
"dlmread", "dmperm", "dot", "eig", "eigs",
|
537
|
+
"endgrent", "endpwent", "etree", "fft", "fftn",
|
538
|
+
"fftw", "filter", "find", "full", "gcd",
|
539
|
+
"getgrent", "getgrgid", "getgrnam", "getpwent",
|
540
|
+
"getpwnam", "getpwuid", "getrusage", "givens",
|
541
|
+
"gmtime", "gnuplot_binary", "hess", "ifft",
|
542
|
+
"ifftn", "inv", "isdebugmode", "issparse", "kron",
|
543
|
+
"localtime", "lookup", "lsode", "lsode_options",
|
544
|
+
"lu", "luinc", "luupdate", "matrix_type", "max",
|
545
|
+
"min", "mktime", "pinv", "qr", "qrdelete",
|
546
|
+
"qrinsert", "qrshift", "qrupdate", "quad",
|
547
|
+
"quad_options", "qz", "rand", "rande", "randg",
|
548
|
+
"randn", "randp", "randperm", "rcond", "regexp",
|
549
|
+
"regexpi", "regexprep", "schur", "setgrent",
|
550
|
+
"setpwent", "sort", "spalloc", "sparse", "spparms",
|
551
|
+
"sprank", "sqrtm", "strfind", "strftime",
|
552
|
+
"strptime", "strrep", "svd", "svd_driver", "syl",
|
553
|
+
"symamd", "symbfact", "symrcm", "time", "tsearch",
|
554
|
+
"typecast", "urlread", "urlwrite", ]
|
555
|
+
|
556
|
+
mapping_kw = [ "abs", "acos", "acosh", "acot", "acoth", "acsc",
|
557
|
+
"acsch", "angle", "arg", "asec", "asech", "asin",
|
558
|
+
"asinh", "atan", "atanh", "beta", "betainc",
|
559
|
+
"betaln", "bincoeff", "cbrt", "ceil", "conj", "cos",
|
560
|
+
"cosh", "cot", "coth", "csc", "csch", "erf", "erfc",
|
561
|
+
"erfcx", "erfinv", "exp", "finite", "fix", "floor",
|
562
|
+
"fmod", "gamma", "gammainc", "gammaln", "imag",
|
563
|
+
"isalnum", "isalpha", "isascii", "iscntrl",
|
564
|
+
"isdigit", "isfinite", "isgraph", "isinf",
|
565
|
+
"islower", "isna", "isnan", "isprint", "ispunct",
|
566
|
+
"isspace", "isupper", "isxdigit", "lcm", "lgamma",
|
567
|
+
"log", "lower", "mod", "real", "rem", "round",
|
568
|
+
"roundb", "sec", "sech", "sign", "sin", "sinh",
|
569
|
+
"sqrt", "tan", "tanh", "toascii", "tolower", "xor",
|
570
|
+
]
|
571
|
+
|
572
|
+
builtin_consts = [ "EDITOR", "EXEC_PATH", "I", "IMAGE_PATH", "NA",
|
573
|
+
"OCTAVE_HOME", "OCTAVE_VERSION", "PAGER",
|
574
|
+
"PAGER_FLAGS", "SEEK_CUR", "SEEK_END", "SEEK_SET",
|
575
|
+
"SIG", "S_ISBLK", "S_ISCHR", "S_ISDIR", "S_ISFIFO",
|
576
|
+
"S_ISLNK", "S_ISREG", "S_ISSOCK", "WCONTINUE",
|
577
|
+
"WCOREDUMP", "WEXITSTATUS", "WIFCONTINUED",
|
578
|
+
"WIFEXITED", "WIFSIGNALED", "WIFSTOPPED", "WNOHANG",
|
579
|
+
"WSTOPSIG", "WTERMSIG", "WUNTRACED", ]
|
580
|
+
|
581
|
+
tokens = {
|
582
|
+
'root': [
|
583
|
+
#We should look into multiline comments
|
584
|
+
(r'[%#].*$', Comment),
|
585
|
+
(r'^\s*function', Keyword, 'deffunc'),
|
586
|
+
|
587
|
+
# from 'iskeyword' on hg changeset 8cc154f45e37
|
588
|
+
(r'(__FILE__|__LINE__|break|case|catch|classdef|continue|do|else|'
|
589
|
+
r'elseif|end|end_try_catch|end_unwind_protect|endclassdef|'
|
590
|
+
r'endevents|endfor|endfunction|endif|endmethods|endproperties|'
|
591
|
+
r'endswitch|endwhile|events|for|function|get|global|if|methods|'
|
592
|
+
r'otherwise|persistent|properties|return|set|static|switch|try|'
|
593
|
+
r'until|unwind_protect|unwind_protect_cleanup|while)\b', Keyword),
|
594
|
+
|
595
|
+
("(" + "|".join( builtin_kw + command_kw
|
596
|
+
+ function_kw + loadable_kw
|
597
|
+
+ mapping_kw) + r')\b', Name.Builtin),
|
598
|
+
|
599
|
+
("(" + "|".join(builtin_consts) + r')\b', Name.Constant),
|
600
|
+
|
601
|
+
# operators in Octave but not Matlab:
|
602
|
+
(r'-=|!=|!|/=|--', Operator),
|
603
|
+
# operators:
|
604
|
+
(r'-|==|~=|<|>|<=|>=|&&|&|~|\|\|?', Operator),
|
605
|
+
# operators in Octave but not Matlab requiring escape for re:
|
606
|
+
(r'\*=|\+=|\^=|\/=|\\=|\*\*|\+\+|\.\*\*',Operator),
|
607
|
+
# operators requiring escape for re:
|
608
|
+
(r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),
|
609
|
+
|
610
|
+
|
611
|
+
# punctuation:
|
612
|
+
(r'\[|\]|\(|\)|\{|\}|:|@|\.|,', Punctuation),
|
613
|
+
(r'=|:|;', Punctuation),
|
614
|
+
|
615
|
+
(r'"[^"]*"', String),
|
616
|
+
|
617
|
+
# quote can be transpose, instead of string:
|
618
|
+
# (not great, but handles common cases...)
|
619
|
+
(r'(?<=[\w\)\]])\'', Operator),
|
620
|
+
(r'(?<![\w\)\]])\'', String, 'string'),
|
621
|
+
|
622
|
+
('[a-zA-Z_][a-zA-Z0-9_]*', Name),
|
623
|
+
(r'.', Text),
|
624
|
+
],
|
625
|
+
'string': [
|
626
|
+
(r"[^']*'", String, '#pop'),
|
627
|
+
],
|
628
|
+
'deffunc': [
|
629
|
+
(r'(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)',
|
630
|
+
bygroups(Text.Whitespace, Text, Text.Whitespace, Punctuation,
|
631
|
+
Text.Whitespace, Name.Function, Punctuation, Text,
|
632
|
+
Punctuation, Text.Whitespace), '#pop'),
|
633
|
+
],
|
634
|
+
}
|
635
|
+
|
636
|
+
def analyse_text(text):
|
637
|
+
if re.match('^\s*[%#]', text, re.M): #Comment
|
638
|
+
return 0.9
|
639
|
+
return 0.1
|
640
|
+
|
641
|
+
|
249
642
|
class NumPyLexer(PythonLexer):
|
250
|
-
|
643
|
+
"""
|
251
644
|
A Python lexer recognizing Numerical Python builtins.
|
252
645
|
|
253
646
|
*New in Pygments 0.10.*
|
254
|
-
|
647
|
+
"""
|
255
648
|
|
256
649
|
name = 'NumPy'
|
257
650
|
aliases = ['numpy']
|
@@ -12,7 +12,7 @@
|
|
12
12
|
import re
|
13
13
|
|
14
14
|
from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \
|
15
|
-
this, do_insertions
|
15
|
+
this, do_insertions, combined
|
16
16
|
from pygments.token import Error, Punctuation, Literal, Token, \
|
17
17
|
Text, Comment, Operator, Keyword, Name, String, Number, Generic
|
18
18
|
from pygments.util import shebang_matches
|
@@ -26,7 +26,8 @@ __all__ = ['SqlLexer', 'MySqlLexer', 'SqliteConsoleLexer', 'BrainfuckLexer',
|
|
26
26
|
'BashSessionLexer', 'ModelicaLexer', 'RebolLexer', 'ABAPLexer',
|
27
27
|
'NewspeakLexer', 'GherkinLexer', 'AsymptoteLexer',
|
28
28
|
'PostScriptLexer', 'AutohotkeyLexer', 'GoodDataCLLexer',
|
29
|
-
'MaqlLexer', 'ProtoBufLexer', 'HybrisLexer', 'AwkLexer'
|
29
|
+
'MaqlLexer', 'ProtoBufLexer', 'HybrisLexer', 'AwkLexer',
|
30
|
+
'Cfengine3Lexer']
|
30
31
|
|
31
32
|
line_re = re.compile('.*?\n')
|
32
33
|
|
@@ -2428,198 +2429,177 @@ class AutohotkeyLexer(RegexLexer):
|
|
2428
2429
|
filenames = ['*.ahk', '*.ahkl']
|
2429
2430
|
mimetypes = ['text/x-autohotkey']
|
2430
2431
|
|
2431
|
-
flags = re.IGNORECASE | re.DOTALL | re.MULTILINE
|
2432
|
-
|
2433
2432
|
tokens = {
|
2434
2433
|
'root': [
|
2435
|
-
|
2436
|
-
|
2437
|
-
|
2438
|
-
(r'
|
2439
|
-
|
2440
|
-
|
2441
|
-
(r'(
|
2442
|
-
|
2443
|
-
|
2444
|
-
include('directives'),
|
2445
|
-
include('labels'),
|
2434
|
+
(r'^(\s*)(/\*)', bygroups(Text, Comment.Multiline),
|
2435
|
+
'incomment'),
|
2436
|
+
(r'^(\s*)(\()', bygroups(Text, Generic), 'incontinuation'),
|
2437
|
+
(r'\s+;.*?$', Comment.Singleline),
|
2438
|
+
(r'^;.*?$', Comment.Singleline),
|
2439
|
+
(r'[]{}(),;[]', Punctuation),
|
2440
|
+
(r'(in|is|and|or|not)\b', Operator.Word),
|
2441
|
+
(r'\%[a-zA-Z_#@$][a-zA-Z0-9_#@$]*\%', Name.Variable),
|
2442
|
+
(r'!=|==|:=|\.=|<<|>>|[-~+/*%=<>&^|?:!.]', Operator),
|
2446
2443
|
include('commands'),
|
2447
|
-
include('
|
2444
|
+
include('labels'),
|
2445
|
+
include('builtInFunctions'),
|
2446
|
+
include('builtInVariables'),
|
2447
|
+
(r'"', String, combined('stringescape', 'dqs')),
|
2448
2448
|
include('numbers'),
|
2449
|
-
|
2450
|
-
|
2451
|
-
|
2449
|
+
(r'[a-zA-Z_#@$][a-zA-Z0-9_#@$]*', Name),
|
2450
|
+
(r'\\|\'', Text),
|
2451
|
+
(r'\`([\,\%\`abfnrtv\-\+;])', String.Escape),
|
2452
|
+
include('garbage'),
|
2452
2453
|
],
|
2453
|
-
'
|
2454
|
-
|
2455
|
-
|
2456
|
-
(r'
|
2457
|
-
(r'[^\n]*?(?=;*|$)', String, '#pop'),
|
2458
|
-
include('numbers'),
|
2459
|
-
include('literals'),
|
2454
|
+
'incomment': [
|
2455
|
+
(r'^\s*\*/', Comment.Multiline, '#pop'),
|
2456
|
+
(r'[^*/]', Comment.Multiline),
|
2457
|
+
(r'[*/]', Comment.Multiline)
|
2460
2458
|
],
|
2461
|
-
|
2462
|
-
|
2463
|
-
|
2464
|
-
|
2465
|
-
include('numbers'),
|
2466
|
-
include('literals'),
|
2467
|
-
(r'([]\w#@$?[]+)(\s*)(\()',
|
2468
|
-
bygroups(Name.Function, Text.Whitespace, Punctuation),
|
2469
|
-
'parameters'),
|
2470
|
-
(r'A_\w+', Name.Builtin),
|
2471
|
-
(r'%[]\w#@$?[]+?%', Name.Variable),
|
2472
|
-
# blocks: if, else, function definitions
|
2473
|
-
(r'{', Punctuation, 'block'),
|
2474
|
-
# parameters in function calls
|
2475
|
-
],
|
2476
|
-
'literals': [
|
2477
|
-
(r'"', String, 'string'),
|
2478
|
-
(r'A_\w+', Name.Builtin),
|
2479
|
-
(r'%[]\w#@$?[]+?%', Name.Variable),
|
2480
|
-
(r'[-~!%^&*+|?:<>/=]=?', Operator, 'expressions'),
|
2481
|
-
(r'==', Operator, 'expressions'),
|
2482
|
-
('[{()},.%#`;]', Punctuation),
|
2483
|
-
(r'\\', Punctuation),
|
2484
|
-
include('keywords'),
|
2485
|
-
(r'\w+', Text),
|
2486
|
-
],
|
2487
|
-
'string': [
|
2488
|
-
(r'"', String, '#pop'),
|
2489
|
-
(r'""|`.', String.Escape),
|
2490
|
-
(r'[^\`"\n]+', String), # all other characters
|
2459
|
+
'incontinuation': [
|
2460
|
+
(r'^\s*\)', Generic, '#pop'),
|
2461
|
+
(r'[^)]', Generic),
|
2462
|
+
(r'[)]', Generic),
|
2491
2463
|
],
|
2492
|
-
'
|
2493
|
-
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2464
|
+
'commands': [
|
2465
|
+
(r'(?i)^(\s*)(global|local|static|'
|
2466
|
+
r'#AllowSameLineComments|#ClipboardTimeout|#CommentFlag|'
|
2467
|
+
r'#ErrorStdOut|#EscapeChar|#HotkeyInterval|#HotkeyModifierTimeout|'
|
2468
|
+
r'#Hotstring|#IfWinActive|#IfWinExist|#IfWinNotActive|'
|
2469
|
+
r'#IfWinNotExist|#IncludeAgain|#Include|#InstallKeybdHook|'
|
2470
|
+
r'#InstallMouseHook|#KeyHistory|#LTrim|#MaxHotkeysPerInterval|'
|
2471
|
+
r'#MaxMem|#MaxThreads|#MaxThreadsBuffer|#MaxThreadsPerHotkey|'
|
2472
|
+
r'#NoEnv|#NoTrayIcon|#Persistent|#SingleInstance|#UseHook|'
|
2473
|
+
r'#WinActivateForce|AutoTrim|BlockInput|Break|Click|ClipWait|'
|
2474
|
+
r'Continue|Control|ControlClick|ControlFocus|ControlGetFocus|'
|
2475
|
+
r'ControlGetPos|ControlGetText|ControlGet|ControlMove|ControlSend|'
|
2476
|
+
r'ControlSendRaw|ControlSetText|CoordMode|Critical|'
|
2477
|
+
r'DetectHiddenText|DetectHiddenWindows|Drive|DriveGet|'
|
2478
|
+
r'DriveSpaceFree|Edit|Else|EnvAdd|EnvDiv|EnvGet|EnvMult|EnvSet|'
|
2479
|
+
r'EnvSub|EnvUpdate|Exit|ExitApp|FileAppend|'
|
2480
|
+
r'FileCopy|FileCopyDir|FileCreateDir|FileCreateShortcut|'
|
2481
|
+
r'FileDelete|FileGetAttrib|FileGetShortcut|FileGetSize|'
|
2482
|
+
r'FileGetTime|FileGetVersion|FileInstall|FileMove|FileMoveDir|'
|
2483
|
+
r'FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|'
|
2484
|
+
r'FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|'
|
2485
|
+
r'FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|'
|
2486
|
+
r'GroupAdd|GroupClose|GroupDeactivate|Gui|GuiControl|'
|
2487
|
+
r'GuiControlGet|Hotkey|IfEqual|IfExist|IfGreaterOrEqual|IfGreater|'
|
2488
|
+
r'IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|'
|
2489
|
+
r'IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|'
|
2490
|
+
r'IfWinNotExist|If |ImageSearch|IniDelete|IniRead|IniWrite|'
|
2491
|
+
r'InputBox|Input|KeyHistory|KeyWait|ListHotkeys|ListLines|'
|
2492
|
+
r'ListVars|Loop|Menu|MouseClickDrag|MouseClick|MouseGetPos|'
|
2493
|
+
r'MouseMove|MsgBox|OnExit|OutputDebug|Pause|PixelGetColor|'
|
2494
|
+
r'PixelSearch|PostMessage|Process|Progress|Random|RegDelete|'
|
2495
|
+
r'RegRead|RegWrite|Reload|Repeat|Return|RunAs|RunWait|Run|'
|
2496
|
+
r'SendEvent|SendInput|SendMessage|SendMode|SendPlay|SendRaw|Send|'
|
2497
|
+
r'SetBatchLines|SetCapslockState|SetControlDelay|'
|
2498
|
+
r'SetDefaultMouseSpeed|SetEnv|SetFormat|SetKeyDelay|'
|
2499
|
+
r'SetMouseDelay|SetNumlockState|SetScrollLockState|'
|
2500
|
+
r'SetStoreCapslockMode|SetTimer|SetTitleMatchMode|'
|
2501
|
+
r'SetWinDelay|SetWorkingDir|Shutdown|Sleep|Sort|SoundBeep|'
|
2502
|
+
r'SoundGet|SoundGetWaveVolume|SoundPlay|SoundSet|'
|
2503
|
+
r'SoundSetWaveVolume|SplashImage|SplashTextOff|SplashTextOn|'
|
2504
|
+
r'SplitPath|StatusBarGetText|StatusBarWait|StringCaseSense|'
|
2505
|
+
r'StringGetPos|StringLeft|StringLen|StringLower|StringMid|'
|
2506
|
+
r'StringReplace|StringRight|StringSplit|StringTrimLeft|'
|
2507
|
+
r'StringTrimRight|StringUpper|Suspend|SysGet|Thread|ToolTip|'
|
2508
|
+
r'Transform|TrayTip|URLDownloadToFile|While|WinActivate|'
|
2509
|
+
r'WinActivateBottom|WinClose|WinGetActiveStats|WinGetActiveTitle|'
|
2510
|
+
r'WinGetClass|WinGetPos|WinGetText|WinGetTitle|WinGet|WinHide|'
|
2511
|
+
r'WinKill|WinMaximize|WinMenuSelectItem|WinMinimizeAllUndo|'
|
2512
|
+
r'WinMinimizeAll|WinMinimize|WinMove|WinRestore|WinSetTitle|'
|
2513
|
+
r'WinSet|WinShow|WinWaitActive|WinWaitClose|WinWaitNotActive|'
|
2514
|
+
r'WinWait)\b', bygroups(Text, Name.Builtin)),
|
2515
|
+
],
|
2516
|
+
'builtInFunctions': [
|
2517
|
+
(r'(?i)(Abs|ACos|Asc|ASin|ATan|Ceil|Chr|Cos|DllCall|Exp|FileExist|'
|
2518
|
+
r'Floor|GetKeyState|IL_Add|IL_Create|IL_Destroy|InStr|IsFunc|'
|
2519
|
+
r'IsLabel|Ln|Log|LV_Add|LV_Delete|LV_DeleteCol|LV_GetCount|'
|
2520
|
+
r'LV_GetNext|LV_GetText|LV_Insert|LV_InsertCol|LV_Modify|'
|
2521
|
+
r'LV_ModifyCol|LV_SetImageList|Mod|NumGet|NumPut|OnMessage|'
|
2522
|
+
r'RegExMatch|RegExReplace|RegisterCallback|Round|SB_SetIcon|'
|
2523
|
+
r'SB_SetParts|SB_SetText|Sin|Sqrt|StrLen|SubStr|Tan|TV_Add|'
|
2524
|
+
r'TV_Delete|TV_GetChild|TV_GetCount|TV_GetNext|TV_Get|'
|
2525
|
+
r'TV_GetParent|TV_GetPrev|TV_GetSelection|TV_GetText|TV_Modify|'
|
2526
|
+
r'VarSetCapacity|WinActive|WinExist|Object|ComObjActive|'
|
2527
|
+
r'ComObjArray|ComObjEnwrap|ComObjUnwrap|ComObjParameter|'
|
2528
|
+
r'ComObjType|ComObjConnect|ComObjCreate|ComObjGet|ComObjError|'
|
2529
|
+
r'ComObjValue|Insert|MinIndex|MaxIndex|Remove|SetCapacity|'
|
2530
|
+
r'GetCapacity|GetAddress|_NewEnum|FileOpen|Read|Write|ReadLine|'
|
2531
|
+
r'WriteLine|ReadNumType|WriteNumType|RawRead|RawWrite|Seek|Tell|'
|
2532
|
+
r'Close|Next|IsObject|StrPut|StrGet|Trim|LTrim|RTrim)\b',
|
2533
|
+
Name.Function),
|
2534
|
+
],
|
2535
|
+
'builtInVariables': [
|
2536
|
+
(r'(?i)(A_AhkPath|A_AhkVersion|A_AppData|A_AppDataCommon|'
|
2537
|
+
r'A_AutoTrim|A_BatchLines|A_CaretX|A_CaretY|A_ComputerName|'
|
2538
|
+
r'A_ControlDelay|A_Cursor|A_DDDD|A_DDD|A_DD|A_DefaultMouseSpeed|'
|
2539
|
+
r'A_Desktop|A_DesktopCommon|A_DetectHiddenText|'
|
2540
|
+
r'A_DetectHiddenWindows|A_EndChar|A_EventInfo|A_ExitReason|'
|
2541
|
+
r'A_FormatFloat|A_FormatInteger|A_Gui|A_GuiEvent|A_GuiControl|'
|
2542
|
+
r'A_GuiControlEvent|A_GuiHeight|A_GuiWidth|A_GuiX|A_GuiY|A_Hour|'
|
2543
|
+
r'A_IconFile|A_IconHidden|A_IconNumber|A_IconTip|A_Index|'
|
2544
|
+
r'A_IPAddress1|A_IPAddress2|A_IPAddress3|A_IPAddress4|A_ISAdmin|'
|
2545
|
+
r'A_IsCompiled|A_IsCritical|A_IsPaused|A_IsSuspended|A_KeyDelay|'
|
2546
|
+
r'A_Language|A_LastError|A_LineFile|A_LineNumber|A_LoopField|'
|
2547
|
+
r'A_LoopFileAttrib|A_LoopFileDir|A_LoopFileExt|A_LoopFileFullPath|'
|
2548
|
+
r'A_LoopFileLongPath|A_LoopFileName|A_LoopFileShortName|'
|
2549
|
+
r'A_LoopFileShortPath|A_LoopFileSize|A_LoopFileSizeKB|'
|
2550
|
+
r'A_LoopFileSizeMB|A_LoopFileTimeAccessed|A_LoopFileTimeCreated|'
|
2551
|
+
r'A_LoopFileTimeModified|A_LoopReadLine|A_LoopRegKey|'
|
2552
|
+
r'A_LoopRegName|A_LoopRegSubkey|A_LoopRegTimeModified|'
|
2553
|
+
r'A_LoopRegType|A_MDAY|A_Min|A_MM|A_MMM|A_MMMM|A_Mon|A_MouseDelay|'
|
2554
|
+
r'A_MSec|A_MyDocuments|A_Now|A_NowUTC|A_NumBatchLines|A_OSType|'
|
2555
|
+
r'A_OSVersion|A_PriorHotkey|A_ProgramFiles|A_Programs|'
|
2556
|
+
r'A_ProgramsCommon|A_ScreenHeight|A_ScreenWidth|A_ScriptDir|'
|
2557
|
+
r'A_ScriptFullPath|A_ScriptName|A_Sec|A_Space|A_StartMenu|'
|
2558
|
+
r'A_StartMenuCommon|A_Startup|A_StartupCommon|A_StringCaseSense|'
|
2559
|
+
r'A_Tab|A_Temp|A_ThisFunc|A_ThisHotkey|A_ThisLabel|A_ThisMenu|'
|
2560
|
+
r'A_ThisMenuItem|A_ThisMenuItemPos|A_TickCount|A_TimeIdle|'
|
2561
|
+
r'A_TimeIdlePhysical|A_TimeSincePriorHotkey|A_TimeSinceThisHotkey|'
|
2562
|
+
r'A_TitleMatchMode|A_TitleMatchModeSpeed|A_UserName|A_WDay|'
|
2563
|
+
r'A_WinDelay|A_WinDir|A_WorkingDir|A_YDay|A_YEAR|A_YWeek|A_YYYY|'
|
2564
|
+
r'Clipboard|ClipboardAll|ComSpec|ErrorLevel|ProgramFiles|True|'
|
2565
|
+
r'False|A_IsUnicode|A_FileEncoding|A_OSVersion|A_PtrSize)\b',
|
2566
|
+
Name.Variable),
|
2503
2567
|
],
|
2504
|
-
'keywords': [
|
2505
|
-
(r'(static|global|local)\b', Keyword.Type),
|
2506
|
-
(r'(if|else|and|or)\b', Keyword.Reserved),
|
2507
|
-
],
|
2508
|
-
'directives': [
|
2509
|
-
(r'#\w+?\s', Keyword),
|
2510
|
-
],
|
2511
2568
|
'labels': [
|
2512
2569
|
# hotkeys and labels
|
2513
2570
|
# technically, hotkey names are limited to named keys and buttons
|
2514
|
-
(r'(^\s*)([^:\s]+?:{1,2})', bygroups(Text
|
2515
|
-
|
2516
|
-
|
2517
|
-
],
|
2518
|
-
'comments': [
|
2519
|
-
(r'^;+.*?$', Comment.Single), # beginning of line comments
|
2520
|
-
(r'(?<=\s);+.*?$', Comment.Single), # end of line comments
|
2521
|
-
(r'^/\*.*?\n\*/', Comment.Multiline),
|
2522
|
-
(r'(?<!\n)/\*.*?\n\*/', Error), # must be at start of line
|
2523
|
-
],
|
2524
|
-
'whitespace': [
|
2525
|
-
(r'[ \t]+', Text.Whitespace),
|
2526
|
-
],
|
2571
|
+
(r'(^\s*)([^:\s\(\"]+?:{1,2})', bygroups(Text, Name.Label)),
|
2572
|
+
(r'(^\s*)(::[^:\s]+?::)', bygroups(Text, Name.Label)),
|
2573
|
+
],
|
2527
2574
|
'numbers': [
|
2528
2575
|
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
|
2529
2576
|
(r'\d+[eE][+-]?[0-9]+', Number.Float),
|
2530
|
-
(r'0
|
2577
|
+
(r'0\d+', Number.Oct),
|
2531
2578
|
(r'0[xX][a-fA-F0-9]+', Number.Hex),
|
2532
2579
|
(r'\d+L', Number.Integer.Long),
|
2533
2580
|
(r'\d+', Number.Integer)
|
2534
2581
|
],
|
2535
|
-
'
|
2536
|
-
(r'\
|
2537
|
-
(r'\s[^\n\)]+', String),
|
2582
|
+
'stringescape': [
|
2583
|
+
(r'\"\"|\`([\,\%\`abfnrtv])', String.Escape),
|
2538
2584
|
],
|
2539
|
-
'
|
2540
|
-
(r'\
|
2585
|
+
'strings': [
|
2586
|
+
(r'[^"\n]+', String),
|
2541
2587
|
],
|
2542
|
-
'
|
2543
|
-
(r'
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2551
|
-
r'driveget|drivespacefree|'
|
2552
|
-
r'else|envadd|envdiv|'
|
2553
|
-
r'envget|envmult|envset|'
|
2554
|
-
r'envsub|envupdate|exit|'
|
2555
|
-
r'exitapp|fileappend|filecopy|'
|
2556
|
-
r'filecopydir|filecreatedir|filecreateshortcut|'
|
2557
|
-
r'filedelete|filegetattrib|filegetshortcut|'
|
2558
|
-
r'filegetsize|filegettime|filegetversion|'
|
2559
|
-
r'fileinstall|filemove|filemovedir|'
|
2560
|
-
r'fileread|filereadline|filerecycle|'
|
2561
|
-
r'filerecycleempty|fileremovedir|fileselectfile|'
|
2562
|
-
r'fileselectfolder|filesetattrib|filesettime|'
|
2563
|
-
r'formattime|gosub|'
|
2564
|
-
r'goto|groupactivate|groupadd|'
|
2565
|
-
r'groupclose|groupdeactivate|gui|'
|
2566
|
-
r'guicontrol|guicontrolget|hotkey|'
|
2567
|
-
r'ifexist|ifgreater|ifgreaterorequal|'
|
2568
|
-
r'ifinstring|ifless|iflessorequal|'
|
2569
|
-
r'ifmsgbox|ifnotequal|ifnotexist|'
|
2570
|
-
r'ifnotinstring|ifwinactive|ifwinexist|'
|
2571
|
-
r'ifwinnotactive|ifwinnotexist|imagesearch|'
|
2572
|
-
r'inidelete|iniread|iniwrite|'
|
2573
|
-
r'input|inputbox|keyhistory|'
|
2574
|
-
r'keywait|listhotkeys|listlines|'
|
2575
|
-
r'listvars|loop|'
|
2576
|
-
r'menu|mouseclick|mouseclickdrag|'
|
2577
|
-
r'mousegetpos|mousemove|msgbox|'
|
2578
|
-
r'onmessage|onexit|outputdebug|'
|
2579
|
-
r'pixelgetcolor|pixelsearch|postmessage|'
|
2580
|
-
r'process|progress|random|'
|
2581
|
-
r'regexmatch|regexreplace|registercallback|'
|
2582
|
-
r'regdelete|regread|regwrite|'
|
2583
|
-
r'reload|repeat|return|'
|
2584
|
-
r'run|runas|runwait|'
|
2585
|
-
r'send|sendevent|sendinput|'
|
2586
|
-
r'sendmessage|sendmode|sendplay|'
|
2587
|
-
r'sendraw|setbatchlines|setcapslockstate|'
|
2588
|
-
r'setcontroldelay|setdefaultmousespeed|setenv|'
|
2589
|
-
r'setformat|setkeydelay|setmousedelay|'
|
2590
|
-
r'setnumlockstate|setscrolllockstate|'
|
2591
|
-
r'setstorecapslockmode|'
|
2592
|
-
r'settimer|settitlematchmode|setwindelay|'
|
2593
|
-
r'setworkingdir|shutdown|sleep|'
|
2594
|
-
r'sort|soundbeep|soundget|'
|
2595
|
-
r'soundgetwavevolume|soundplay|soundset|'
|
2596
|
-
r'soundsetwavevolume|splashimage|splashtextoff|'
|
2597
|
-
r'splashtexton|splitpath|statusbargettext|'
|
2598
|
-
r'statusbarwait|stringcasesense|stringgetpos|'
|
2599
|
-
r'stringleft|stringlen|stringlower|'
|
2600
|
-
r'stringmid|stringreplace|stringright|'
|
2601
|
-
r'stringsplit|stringtrimleft|stringtrimright|'
|
2602
|
-
r'stringupper|suspend|sysget|'
|
2603
|
-
r'thread|tooltip|transform|'
|
2604
|
-
r'traytip|urldownloadtofile|while|'
|
2605
|
-
r'varsetcapacity|'
|
2606
|
-
r'winactivate|winactivatebottom|winclose|'
|
2607
|
-
r'winget|wingetactivestats|wingetactivetitle|'
|
2608
|
-
r'wingetclass|wingetpos|wingettext|'
|
2609
|
-
r'wingettitle|winhide|winkill|'
|
2610
|
-
r'winmaximize|winmenuselectitem|winminimize|'
|
2611
|
-
r'winminimizeall|winminimizeallundo|winmove|'
|
2612
|
-
r'winrestore|winset|winsettitle|'
|
2613
|
-
r'winshow|winwait|winwaitactive|'
|
2614
|
-
r'winwaitclose|winwaitnotactive'
|
2615
|
-
r'true|false|NULL)\b', Keyword, 'command'),
|
2616
|
-
],
|
2588
|
+
'dqs': [
|
2589
|
+
(r'"', String, '#pop'),
|
2590
|
+
include('strings')
|
2591
|
+
],
|
2592
|
+
'garbage': [
|
2593
|
+
(r'[^\S\n]', Text),
|
2594
|
+
# (r'.', Text), # no cheating
|
2595
|
+
],
|
2596
|
+
}
|
2617
2597
|
|
2618
|
-
}
|
2619
2598
|
|
2620
2599
|
class MaqlLexer(RegexLexer):
|
2621
2600
|
"""
|
2622
|
-
Lexer for `GoodData MAQL
|
2601
|
+
Lexer for `GoodData MAQL
|
2602
|
+
<https://secure.gooddata.com/docs/html/advanced.metric.tutorial.html>`_
|
2623
2603
|
scripts.
|
2624
2604
|
|
2625
2605
|
*New in Pygments 1.4.*
|
@@ -2904,3 +2884,63 @@ class AwkLexer(RegexLexer):
|
|
2904
2884
|
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
2905
2885
|
]
|
2906
2886
|
}
|
2887
|
+
|
2888
|
+
|
2889
|
+
class Cfengine3Lexer(RegexLexer):
|
2890
|
+
"""
|
2891
|
+
Lexer for `CFEngine3 <http://cfengine.org>`_ policy files.
|
2892
|
+
|
2893
|
+
*New in Pygments 1.5.*
|
2894
|
+
"""
|
2895
|
+
|
2896
|
+
name = 'CFEngine3'
|
2897
|
+
aliases = ['cfengine3', 'cf3']
|
2898
|
+
filenames = ['*.cf']
|
2899
|
+
mimetypes = []
|
2900
|
+
|
2901
|
+
tokens = {
|
2902
|
+
'root': [
|
2903
|
+
(r'#.*?\n', Comment),
|
2904
|
+
(r'(body)(\s+)(\S+)(\s+)(control)',
|
2905
|
+
bygroups(Keyword, Text, Keyword, Text, Keyword)),
|
2906
|
+
(r'(body|bundle)(\s+)(\S+)(\s+)(\w+)(\()',
|
2907
|
+
bygroups(Keyword, Text, Keyword, Text, Name.Function, Punctuation),
|
2908
|
+
'arglist'),
|
2909
|
+
(r'(body|bundle)(\s+)(\S+)(\s+)(\w+)',
|
2910
|
+
bygroups(Keyword, Text, Keyword, Text, Name.Function)),
|
2911
|
+
(r'(")([^"]+)(")(\s+)(string|slist|int|real)(\s*)(=>)(\s*)',
|
2912
|
+
bygroups(Punctuation,Name.Variable,Punctuation,
|
2913
|
+
Text,Keyword.Type,Text,Operator,Text)),
|
2914
|
+
(r'(\S+)(\s*)(=>)(\s*)',
|
2915
|
+
bygroups(Keyword.Reserved,Text,Operator,Text)),
|
2916
|
+
(r'"', String, 'string'),
|
2917
|
+
(r'(\w+)(\()', bygroups(Name.Function, Punctuation)),
|
2918
|
+
(r'([\w.!&|]+)(::)', bygroups(Name.Class, Punctuation)),
|
2919
|
+
(r'(\w+)(:)', bygroups(Keyword.Declaration,Punctuation)),
|
2920
|
+
(r'@[\{\(][^\)\}]+[\}\)]', Name.Variable),
|
2921
|
+
(r'[(){},;]', Punctuation),
|
2922
|
+
(r'=>', Operator),
|
2923
|
+
(r'\d+\.\d+', Number.Float),
|
2924
|
+
(r'\d+', Number.Integer),
|
2925
|
+
(r'\w+', Name.Function),
|
2926
|
+
(r'\s+', Text),
|
2927
|
+
],
|
2928
|
+
'string': [
|
2929
|
+
(r'\$[\{\(]', String.Interpol, 'interpol'),
|
2930
|
+
(r'\\.', String.Escape),
|
2931
|
+
(r'"', String, '#pop'),
|
2932
|
+
(r'\n', String),
|
2933
|
+
(r'.', String),
|
2934
|
+
],
|
2935
|
+
'interpol': [
|
2936
|
+
(r'\$[\{\(]', String.Interpol, '#push'),
|
2937
|
+
(r'[\}\)]', String.Interpol, '#pop'),
|
2938
|
+
(r'[^\$\{\(\)\}]+', String.Interpol),
|
2939
|
+
],
|
2940
|
+
'arglist': [
|
2941
|
+
(r'\)', Punctuation, '#pop'),
|
2942
|
+
(r',', Punctuation),
|
2943
|
+
(r'\w+', Name.Variable),
|
2944
|
+
(r'\s+', Text),
|
2945
|
+
],
|
2946
|
+
}
|