File: pscript.sl

package info (click to toggle)
jed 0.99.16-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,312 kB
  • ctags: 4,736
  • sloc: ansic: 36,879; sh: 8,660; makefile: 379
file content (96 lines) | stat: -rw-r--r-- 4,220 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
% This is a simple PostScript mode. It just implements a highlighting
% scheme.

% Note that PostScript considers any set of matched parentheses to be a
% valid string. This cannot easily be matched by DFA-based methods, so
% the highlighting scheme here simply deals with *one* set of inner
% parentheses. Hence (asd(df)df) is a valid string under these rules,
% but (sdf(df(sdf)sdf)sdf) contains more nested parentheses than we can
% cope with here.

$1 = "PostScript";

create_syntax_table ($1);

#ifdef HAS_DFA_SYNTAX
%%% DFA_CACHE_BEGIN %%%
static define setup_dfa_callback (name)
{
   dfa_enable_highlight_cache ("pscript.dfa", name);
   dfa_define_highlight_rule("%.*$", "comment", name);
   dfa_define_highlight_rule("[\\-\\+]?[0-9]*\\.?[0-9]+([Ee][\\-\\+]?[0-9]*)?",
			 "number", name);
   dfa_define_highlight_rule("[0-9]+#[0-9A-Za-z]*", "number", name);
   dfa_define_highlight_rule(strcat("\\((\\\\.|[^\\(\\)\\\\]|",
				"\\(([^\\\\\\(\\)]|\\\\.)*\\))*\\)"),
			 "string", name);
   dfa_define_highlight_rule(strcat("\\((\\\\.|[^\\(\\)\\\\]|\\(([^\\\\\\(\\)]|\\\\",
				".)*\\))*(\\(([^\\\\\\(\\)]|\\\\.)*)?\\\\?$"),
			 "string", name);
   dfa_define_highlight_rule(strcat("^(([^\\\\\\(\\)]|\\\\.)*\\))?(\\\\.|[^\\(\\)",
				"\\\\]|\\(([^\\\\\\(\\)]|\\\\.)*\\))*\\)"),
			 "string", name);
   dfa_define_highlight_rule("<[ \t0-9a-fA-F]*>", "string", name);
   dfa_define_highlight_rule("<[ \t0-9a-fA-F]*$", "string", name);
   dfa_define_highlight_rule("^[ \t0-9a-fA-F]*>", "Qstring", name);
   dfa_define_highlight_rule("<~[ \t!-u]*~>", "string", name);
   dfa_define_highlight_rule("<~[ \t!-u]*~?$", "string", name);
   dfa_define_highlight_rule("^[ \t!-u]*~>", "Qstring", name);
   dfa_define_highlight_rule("[!-\\$&'\\*-\\.0-;=\\?-Z\\\\\\^-z\\|~]+",
			 "Knormal", name);
   dfa_define_highlight_rule("//?[!-\\$&'\\*-\\.0-;=\\?-Z\\\\\\^-z\\|~]+",
			 "normal", name);
   dfa_define_highlight_rule("<<|>>|\\[|\\]|{|}", "Qdelimiter", name);
   dfa_define_highlight_rule(".", "normal", name);
   dfa_build_highlight_table (name);
}
dfa_set_init_callback (&setup_dfa_callback, "PostScript");
%%% DFA_CACHE_END %%%
#endif

% All words in PostScript are of course redefinable. So we will simply
% define as keywords the *really* basic ones. These are basic language
% operators.
define_keywords ($1, "=", 1);
define_keywords ($1, "==eqgegtiflelnltneor", 2);
define_keywords ($1, strcat("absaddandcoscvicvncvrcvscvxdefdivdupendexpfor",
			    "getlogmodmulnegnotpopputrunsinsrtsubxor"), 3);
define_keywords ($1, strcat("atancopycopycvrsdictexchexecexitfileidivload",
			    "loopmarkquitrandreadrollsavestoptruetype"), 4);
define_keywords ($1, strcat("aloadarraybeginclearcountcvlitfalsefloorindex",
			    "knownroundrrandsrandstackstoreundefwherewrite"),
		 5);
define_keywords ($1, "astoreforallgstateifelselengthpstackrepeatstring", 6);
define_keywords ($1, "ceilingrestore", 7);
define_keywords ($1, "truncate", 8);
define_keywords ($1, strcat("counttomarkcurrentfilegetintervalpackedarray",
			    "putinterval"), 11);

% And these are basic graphical operators.
define_keywords_n ($1, "arc", 3, 1);
define_keywords_n ($1, "arcnarctclipfillshow", 4, 1);
define_keywords_n ($1, "arctogsaveimagescale", 5, 1);
define_keywords_n ($1, "concateoclipeofilllinetomatrixmovetorotatestroke",
		   6, 1);
define_keywords_n ($1, "curvetonewpathrlinetormovetosetdashsetfontsetgray",
		   7, 1);
define_keywords_n ($1, "findfontgrestoremakefontrcurvetosetcolorshowpage",
		   8, 1);
define_keywords_n ($1, "closepathscalefontsetmatrixtransformtranslate", 9, 1);
define_keywords_n ($1, "definefontsetlinecapsetpattern", 10, 1);
define_keywords_n ($1, strcat("currentdashcurrentfontcurrentgraysethsbcolor",
			    "setlinejoinsetrgbcolor"), 11, 1);
define_keywords_n ($1, "currentcolorsetcmykcolorsetlinewidth", 12, 1);
define_keywords_n ($1, "currentmatrix", 13, 1);
define_keywords_n ($1, "currentlinecapcurrentpattern", 14, 1);
define_keywords_n ($1, "currenthsbcolorcurrentlinejoincurrentrgbcolor",
		   15, 1);
define_keywords_n ($1, "currentcmykcolorcurrentlinewidth", 16, 1);

define ps_mode ()
{
   variable ps = "PostScript";
   set_mode(ps, 0);
   use_syntax_table (ps);
   run_mode_hooks("ps_mode_hook");
}