xref: /vim-8.2.3635/runtime/syntax/gretl.vim (revision cf2d8dee)
1" Vim syntax file
2" Language:	gretl (http://gretl.sf.net)
3" Maintainer:	Vaidotas Zemlys <[email protected]>
4" Last Change:  2006 Apr 30
5" Filenames:	*.inp *.gretl
6" URL:	http://uosis.mif.vu.lt/~zemlys/vim-syntax/gretl.vim
7" For version 5.x: Clear all syntax items
8" For version 6.x: Quit when a syntax file was already loaded
9
10if version < 600
11  syntax clear
12elseif exists("b:current_syntax")
13  finish
14endif
15
16if version >= 600
17  setlocal iskeyword=@,48-57,_,.
18else
19  set iskeyword=@,48-57,_,.
20endif
21
22syn case match
23
24" Constant
25" string enclosed in double quotes
26syn region gString start=/"/ skip=/\\\\\|\\"/ end=/"/
27" number with no fractional part or exponent
28syn match gNumber /\d\+/
29" floating point number with integer and fractional parts and optional exponent
30syn match gFloat /\d\+\.\d*\([Ee][-+]\=\d\+\)\=/
31" floating point number with no integer part and optional exponent
32syn match gFloat /\.\d\+\([Ee][-+]\=\d\+\)\=/
33" floating point number with no fractional part and optional exponent
34syn match gFloat /\d\+[Ee][-+]\=\d\+/
35
36" Gretl commands
37syn keyword gCommands add addobs addto adf append ar arch arma break boxplot chow coeffsum coint coint2 corc corr corrgm criteria critical cusum data delete diff else end endif endloop eqnprint equation estimate fcast fcasterr fit freq function funcerr garch genr gnuplot graph hausman hccm help hilu hsk hurst if import include info kpss label labels lad lags ldiff leverage lmtest logistic logit logs loop mahal meantest mle modeltab mpols multiply nls nulldata ols omit omitfrom open outfile panel pca pergm plot poisson pooled print printf probit pvalue pwe quit remember rename reset restrict rhodiff rmplot run runs scatters sdiff set setobs setmiss shell sim smpl spearman square store summary system tabprint testuhat tobit transpos tsls var varlist vartest vecm vif wls
38
39"Gretl genr functions
40syn keyword gGenrFunc log exp sin cos tan atan diff ldiff sdiff mean sd min max sort int ln coeff abs rho sqrt sum nobs firstobs lastobs normal uniform stderr cum missing ok misszero corr vcv var sst cov median zeromiss pvalue critical obsnum mpow dnorm cnorm gamma lngamma resample hpfilt bkfilt fracdiff varnum isvector islist nelem
41
42" Identifier
43" identifier with leading letter and optional following keyword characters
44syn match gIdentifier /\a\k*/
45
46"  Variable with leading $
47syn match gVariable /\$\k*/
48" Arrow
49syn match gArrow /<-/
50
51" Special
52syn match gDelimiter /[,;:]/
53
54" Error
55syn region gRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError,gBCstart,gBCend
56syn region gRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError
57syn region gRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError
58syn match gError      /[)\]}]/
59syn match gBraceError /[)}]/ contained
60syn match gCurlyError /[)\]]/ contained
61syn match gParenError /[\]}]/ contained
62
63" Comment
64syn match gComment /#.*/
65syn match gBCstart /(\*/
66syn match gBCend /\*)/
67
68syn region gBlockComment matchgroup=gCommentStart start="(\*" end="\*)"
69
70" Define the default highlighting.
71" For version 5.7 and earlier: only when not done already
72" For version 5.8 and later: only when an item doesn't have highlighting yet
73if version >= 508 || !exists("did_r_syn_inits")
74  if version < 508
75    let did_r_syn_inits = 1
76    command -nargs=+ HiLink hi link <args>
77  else
78    command -nargs=+ HiLink hi def link <args>
79  endif
80  HiLink gComment      Comment
81  HiLink gCommentStart Comment
82  HiLink gBlockComment Comment
83  HiLink gString       String
84  HiLink gNumber       Number
85  HiLink gBoolean      Boolean
86  HiLink gFloat        Float
87  HiLink gCommands     Repeat
88  HiLink gGenrFunc     Type
89  HiLink gDelimiter    Delimiter
90  HiLink gError        Error
91  HiLink gBraceError   Error
92  HiLink gCurlyError   Error
93  HiLink gParenError   Error
94  HiLink gIdentifier   Normal
95  HiLink gVariable     Identifier
96  HiLink gArrow	       Repeat
97  delcommand HiLink
98endif
99
100let b:current_syntax="gretl"
101
102" vim: ts=8 sw=2
103