1/**
2 * Name: vba
3 * Description: Visual Basic (for Applications)
4 * Author: Kevin Grover <grover@wizard.com>
5 */
6
7/* To Do
8 * - ?Get parser to work for X.X.X.X and not hilight separate Xs
9 * - ?recognize type declaration characters ($,%,@, etc.. on variables)
10 * - ?Look for line numbers/labels (for Goto's)  /^\s*[0-9A-Za-z]+:/
11 */
12
13state vba extends HighlightEntry
14{
15  /* Comments. */
16  /[\']|^\s*Rem/ {
17    comment_face (true);
18    language_print ($0);
19    call (eat_one_line);
20    comment_face (false);
21  }
22
23  /* String constants. */
24  /\".*\"/ {
25    string_face (true);
26    language_print ($0);
27    string_face (false);
28  }
29
30  /* Keywords. From:
31	       Excel for Windows 95 Power Programming with VGA
32	       2nd Ed, John Walkenbach, pg 160
33
34     (build-re '(
35     Abs And Any As Boolean ByRef ByVal Call Case CBool CCur CDate
36     CDbl CDecl CInt Circle CLng Close Const CSng CStr CurDirrase
37     Currency CVar CVDate CVErr Date Debug Declare
38
39     DefBool DefCur DefDate DefDbl DefInt DefLng DefObj DefSng DefStr
40     DefVar Dim Dir Do Double Each Else ElsIf Empty End EndIf Eqv Erase
41     Error Exit False Fix For Format FreeFile
42
43     Function Get Global GoSub GoTo If Imp In Input InputB Instr InstrB Int
44     Integer Is LBound Len LenB Let Like Line Load Local Lock Long Loop
45     LSet Me Mid
46
47     MidB Mod Name New Next Not Nothing Null Object On Open Option Optional
48     Or Point Preserve Print Private Property PSet Public Put ReDim Rem
49     Resume Return RSet Scale Seek
50
51     Select Set Sgn Shared Single Spc Static Stop StrComp String Sub Tab
52     Then TO True Type TypeOf UBound Unload Unlock Until Variant Wend While
53     Width With Write Xor))
54  */
55  /\b(A(bs|n(d|y)|s)|B(oolean|y(Ref|Val))\
56|C(Bool|Cur|D(ate|bl|ecl)|Int|Lng|S(ng|tr)|V(Date|Err|ar)|a(ll|se)|ircle\
57|lose|onst|ur(Dirrase|rency))\
58|D(ate|e(bug|clare|f(Bool|Cur|D(ate|bl)|Int|Lng|Obj|S(ng|tr)|Var))\
59|i(m|r)|o(|uble))\
60|E(ach|ls(If|e)|mpty|nd(|If)|qv|r(ase|ror)|xit)\
61|F(alse|ix|or(|mat)|reeFile|unction)|G(et|lobal|o(Sub|To))\
62|I(f|mp|n(|put(|B)|str(|B)|t(|eger))|s)\
63|L(Bound|Set|e(n(|B)|t)|i(ke|ne)|o(ad|c(al|k)|ng|op))|M(e|id(|B)|od)\
64|N(ame|e(w|xt)|ot(|hing)|ull)|O(bject|n|p(en|tion(|al))|r)\
65|P(Set|oint|r(eserve|i(nt|vate)|operty)|u(blic|t))\
66|R(Set|e(Dim|m|sume|turn))\
67|S(cale|e(ek|lect|t)|gn|hared|ingle|pc|t(atic|op|r(Comp|ing))|ub)\
68|T(O|ab|hen|rue|ype(|Of))|U(Bound|n(lo(ad|ck)|til))|Variant\
69|W(end|hile|i(dth|th)|rite)|Xor)\b/ {
70    keyword_face (true);
71    language_print ($0);
72    keyword_face (false);
73  }
74}
75
76
77/*
78Local variables:
79mode: c
80End:
81*/
82