(file) Return to inf.st CVS log (file) (dir) Up to [RizwankCVS] / testProject / share / enscript / hl

  1 rizwank 1.1 /**
  2              * Name: inf
  3              * Description: GUI INF Script language
  4              * Author: Markku Rossi <mtr@iki.fi>
  5              */
  6             
  7             state inf_string extends Highlight
  8             {
  9               /\"\"/ {
 10                 /* A quoted '"' character. */
 11                 language_print($0);
 12               }
 13               /\"/ {
 14                 /* End of the string. */
 15                 language_print($0);
 16                 return;
 17               }
 18             }
 19             
 20             
 21             state inf extends HighlightEntry
 22 rizwank 1.1 {
 23               /* Comments. */
 24               /;/ {
 25                 comment_face(true);
 26                 language_print($0);
 27                 call(eat_one_line);
 28                 comment_face(false);
 29               }
 30             
 31               /* Section names. */
 32               /^(\[)([^\]]+)(\][ \t]*)/ {
 33                 language_print($1);
 34             
 35                 function_name_face(true);
 36                 language_print($2);
 37                 function_name_face(false);
 38             
 39                 language_print($3);
 40               }
 41             
 42               /* String constants. */
 43 rizwank 1.1   /\"\"\"/ {
 44                 /* A string starting with a '"' character. */
 45                 string_face(true);
 46                 language_print($0);
 47                 call(inf_string);
 48                 string_face(false);
 49               }
 50               /\"\"/ {
 51                 /* An empty string. */
 52                 string_face(true);
 53                 language_print($0);
 54                 string_face(false);
 55               }
 56               /\"/ {
 57                 /* Start of a string. */
 58                 string_face(true);
 59                 language_print($0);
 60                 call(inf_string);
 61                 string_face(false);
 62               }
 63             
 64 rizwank 1.1   /* Labels. */
 65               /^([a-zA-Z_][a-zA-Z_0-9]*)([ \t]*=[ \t]*\+)/ {
 66                 reference_face(true);
 67                 language_print($1);
 68                 reference_face(false);
 69                 language_print($2);
 70               }
 71               /* Goto statements and its target. */
 72               /(goto)([ \t]*)([a-zA-Z_][a-zA-Z_0-9]*)/ {
 73                 keyword_face(true);
 74                 language_print($1);
 75                 keyword_face(false);
 76             
 77                 language_print($2);
 78             
 79                 reference_face(true);
 80                 language_print($3);
 81                 reference_face(false);
 82               }
 83             
 84               /* Shell section calls. */
 85 rizwank 1.1   /\bshell\b/i {
 86                 builtin_face(true);
 87                 language_print($0);
 88                 builtin_face(false);
 89               }
 90             
 91               /* The read-syms, install, and detect calls. */
 92               /^([ \t]*)(read-syms|detect|install)([ \t]+)([a-zA-Z_][a-zA-Z_0-9]*)/i {
 93                 language_print($1);
 94             
 95                 builtin_face(true);
 96                 language_print($2);
 97                 builtin_face(false);
 98             
 99                 language_print($3);
100             
101                 reference_face(true);
102                 language_print($4);
103                 reference_face(false);
104               }
105             
106 rizwank 1.1   /* The read-syms, detect, and install in other contexts. */
107               /^([ \t]*)(read-syms|detect|install)\b/i {
108                 language_print($1);
109             
110                 builtin_face(true);
111                 language_print($2);
112                 builtin_face(false);
113               }
114             
115               /* Variable / constant definitions.  We catch these here so we won't
116                  conflict with any keywords, etc. */
117               /([a-zA-Z_][a-zA-Z_0-9]*[ \t]*=)/ {
118                 language_print($0);
119               }
120             
121               /* Keywords, sort of.
122             
123                  (build-re '(return read-syms ifstr ifint ifcontains else
124                  else-ifstr else-ifint elseif-contains endif forlistdo
125                  endforlistdo goto set set-subst set-add set-sub set-mul set-div
126                  set-or set-hextodec set-dectohex exit))
127 rizwank 1.1 
128               */
129               /\b(e(lse(|-if(int|str)|if-contains)|nd(forlistdo|if)|xit)|forlistdo|goto\
130             |if(contains|int|str)|re(ad-syms|turn)\
131             |set(|-(add|d(ectohex|iv)|hextodec|mul|or|sub(|st))))\b(\(i\))?/i {
132                 keyword_face(true);
133                 language_print($0);
134                 keyword_face(false);
135               }
136             
137             
138             
139             }
140             
141             
142             /*
143             Local variables:
144             mode: c
145             End:
146             */

Rizwan Kassim
Powered by
ViewCVS 0.9.2