rouge 2.0.7 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -9
  3. data/lib/rouge.rb +1 -0
  4. data/lib/rouge/cli.rb +20 -0
  5. data/lib/rouge/demos/awk +4 -0
  6. data/lib/rouge/demos/console +6 -0
  7. data/lib/rouge/demos/digdag +19 -0
  8. data/lib/rouge/demos/dot +5 -0
  9. data/lib/rouge/demos/graphql +17 -0
  10. data/lib/rouge/demos/hylang +10 -0
  11. data/lib/rouge/demos/igorpro +9 -0
  12. data/lib/rouge/demos/irb +4 -0
  13. data/lib/rouge/demos/irb_output +2 -0
  14. data/lib/rouge/demos/lasso +12 -0
  15. data/lib/rouge/demos/mosel +10 -0
  16. data/lib/rouge/demos/plist +142 -0
  17. data/lib/rouge/demos/pony +17 -0
  18. data/lib/rouge/demos/q +2 -0
  19. data/lib/rouge/demos/sieve +10 -0
  20. data/lib/rouge/demos/tsx +17 -0
  21. data/lib/rouge/demos/turtle +0 -0
  22. data/lib/rouge/demos/wollok +11 -0
  23. data/lib/rouge/formatters/html_inline.rb +9 -1
  24. data/lib/rouge/formatters/html_pygments.rb +2 -2
  25. data/lib/rouge/formatters/html_table.rb +1 -1
  26. data/lib/rouge/formatters/terminal256.rb +1 -1
  27. data/lib/rouge/lexer.rb +124 -37
  28. data/lib/rouge/lexers/abap.rb +2 -2
  29. data/lib/rouge/lexers/apache.rb +1 -1
  30. data/lib/rouge/lexers/awk.rb +161 -0
  31. data/lib/rouge/lexers/clojure.rb +2 -2
  32. data/lib/rouge/lexers/coffeescript.rb +1 -1
  33. data/lib/rouge/lexers/console.rb +136 -0
  34. data/lib/rouge/lexers/csharp.rb +26 -7
  35. data/lib/rouge/lexers/digdag.rb +72 -0
  36. data/lib/rouge/lexers/docker.rb +1 -1
  37. data/lib/rouge/lexers/dot.rb +68 -0
  38. data/lib/rouge/lexers/elixir.rb +52 -27
  39. data/lib/rouge/lexers/fortran.rb +56 -28
  40. data/lib/rouge/lexers/fsharp.rb +1 -1
  41. data/lib/rouge/lexers/gherkin/keywords.rb +4 -4
  42. data/lib/rouge/lexers/graphql.rb +243 -0
  43. data/lib/rouge/lexers/groovy.rb +5 -1
  44. data/lib/rouge/lexers/haml.rb +19 -24
  45. data/lib/rouge/lexers/html.rb +48 -4
  46. data/lib/rouge/lexers/hylang.rb +93 -0
  47. data/lib/rouge/lexers/igorpro.rb +407 -0
  48. data/lib/rouge/lexers/irb.rb +66 -0
  49. data/lib/rouge/lexers/javascript.rb +21 -10
  50. data/lib/rouge/lexers/json.rb +3 -2
  51. data/lib/rouge/lexers/json_doc.rb +6 -0
  52. data/lib/rouge/lexers/jsx.rb +2 -1
  53. data/lib/rouge/lexers/lasso.rb +217 -0
  54. data/lib/rouge/lexers/lasso/keywords.yml +446 -0
  55. data/lib/rouge/lexers/lua.rb +3 -0
  56. data/lib/rouge/lexers/lua/builtins.rb +1 -1
  57. data/lib/rouge/lexers/markdown.rb +2 -3
  58. data/lib/rouge/lexers/matlab/builtins.rb +1 -1
  59. data/lib/rouge/lexers/moonscript.rb +8 -4
  60. data/lib/rouge/lexers/mosel.rb +231 -0
  61. data/lib/rouge/lexers/ocaml.rb +9 -20
  62. data/lib/rouge/lexers/php.rb +40 -20
  63. data/lib/rouge/lexers/php/builtins.rb +27 -37
  64. data/lib/rouge/lexers/plain_text.rb +4 -3
  65. data/lib/rouge/lexers/plist.rb +49 -0
  66. data/lib/rouge/lexers/pony.rb +93 -0
  67. data/lib/rouge/lexers/powershell.rb +36 -0
  68. data/lib/rouge/lexers/properties.rb +2 -2
  69. data/lib/rouge/lexers/q.rb +124 -0
  70. data/lib/rouge/lexers/r.rb +2 -2
  71. data/lib/rouge/lexers/ruby.rb +26 -13
  72. data/lib/rouge/lexers/rust.rb +7 -5
  73. data/lib/rouge/lexers/sed.rb +4 -2
  74. data/lib/rouge/lexers/shell.rb +38 -16
  75. data/lib/rouge/lexers/sieve.rb +96 -0
  76. data/lib/rouge/lexers/sml.rb +3 -2
  77. data/lib/rouge/lexers/tsx.rb +19 -0
  78. data/lib/rouge/lexers/turtle.rb +0 -0
  79. data/lib/rouge/lexers/typescript.rb +3 -27
  80. data/lib/rouge/lexers/typescript/common.rb +33 -0
  81. data/lib/rouge/lexers/viml/keywords.rb +2 -2
  82. data/lib/rouge/lexers/wollok.rb +107 -0
  83. data/lib/rouge/lexers/xml.rb +1 -1
  84. data/lib/rouge/lexers/yaml.rb +4 -1
  85. data/lib/rouge/regex_lexer.rb +1 -0
  86. data/lib/rouge/template_lexer.rb +3 -5
  87. data/lib/rouge/theme.rb +14 -4
  88. data/lib/rouge/themes/igor_pro.rb +20 -0
  89. data/lib/rouge/themes/pastie.rb +69 -0
  90. data/lib/rouge/themes/thankful_eyes.rb +8 -5
  91. data/lib/rouge/version.rb +1 -1
  92. metadata +40 -6
  93. data/lib/rouge/demos/shell_session +0 -10
  94. data/lib/rouge/lexers/shell_session.rb +0 -29
@@ -14,6 +14,11 @@ module Rouge
14
14
  return 1 if text =~ /<\s*html\b/
15
15
  end
16
16
 
17
+ start do
18
+ @javascript = Javascript.new(options)
19
+ @css = CSS.new(options)
20
+ end
21
+
17
22
  state :root do
18
23
  rule /[^<&]+/m, Text
19
24
  rule /&\S*?;/, Name::Entity
@@ -24,20 +29,49 @@ module Rouge
24
29
 
25
30
  rule /<\s*script\s*/m do
26
31
  token Name::Tag
32
+ @javascript.reset!
27
33
  push :script_content
28
34
  push :tag
29
35
  end
30
36
 
31
37
  rule /<\s*style\s*/m do
32
38
  token Name::Tag
39
+ @css.reset!
33
40
  push :style_content
34
41
  push :tag
35
42
  end
36
43
 
44
+ rule /<\//, Name::Tag, :tag_end
45
+ rule /</, Name::Tag, :tag_start
46
+
37
47
  rule %r(<\s*[a-zA-Z0-9:-]+), Name::Tag, :tag # opening tags
38
48
  rule %r(<\s*/\s*[a-zA-Z0-9:-]+\s*>), Name::Tag # closing tags
39
49
  end
40
50
 
51
+ state :tag_end do
52
+ mixin :tag_end_end
53
+ rule /[a-zA-Z0-9:-]+/ do
54
+ token Name::Tag
55
+ goto :tag_end_end
56
+ end
57
+ end
58
+
59
+ state :tag_end_end do
60
+ rule /\s+/, Text
61
+ rule />/, Name::Tag, :pop!
62
+ end
63
+
64
+ state :tag_start do
65
+ rule /\s+/, Text
66
+
67
+ rule /[a-zA-Z0-9:-]+/ do
68
+ token Name::Tag
69
+ goto :tag
70
+ end
71
+
72
+ rule(//) { goto :tag }
73
+ end
74
+
41
75
  state :comment do
42
76
  rule /[^-]+/, Comment
43
77
  rule /-->/, Comment, :pop!
@@ -77,16 +111,26 @@ module Rouge
77
111
  end
78
112
 
79
113
  state :script_content do
114
+ rule %r([^<]+) do
115
+ delegate @javascript
116
+ end
117
+
80
118
  rule %r(<\s*/\s*script\s*>)m, Name::Tag, :pop!
81
- rule %r(.*?(?=<\s*/\s*script\s*>))m do
82
- delegate Javascript
119
+
120
+ rule %r(<) do
121
+ delegate @javascript
83
122
  end
84
123
  end
85
124
 
86
125
  state :style_content do
126
+ rule /[^<]+/ do
127
+ delegate @css
128
+ end
129
+
87
130
  rule %r(<\s*/\s*style\s*>)m, Name::Tag, :pop!
88
- rule %r(.*?(?=<\s*/\s*style\s*>))m do
89
- delegate CSS
131
+
132
+ rule /</ do
133
+ delegate @css
90
134
  end
91
135
  end
92
136
  end
@@ -0,0 +1,93 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class HyLang < RegexLexer
6
+ title "HyLang"
7
+ desc "The HyLang programming language (hylang.org)"
8
+
9
+ tag 'hylang'
10
+ aliases 'hy'
11
+
12
+ filenames '*.hy'
13
+
14
+ mimetypes 'text/x-hy', 'application/x-hy'
15
+
16
+ def self.keywords
17
+ @keywords ||= Set.new %w(
18
+ False None True and as assert break class continue def
19
+ del elif else except finally for from global if import
20
+ in is lambda nonlocal not or pass raise return try
21
+ )
22
+ end
23
+
24
+ def self.builtins
25
+ @builtins ||= Set.new %w(
26
+ != % %= & &= * ** **= *= *map
27
+ + += , - -= -> ->> . / //
28
+ //= /= < << <<= <= = > >= >>
29
+ >>= @ @= ^ ^= accumulate apply as-> assoc butlast
30
+ calling-module-name car cdr chain coll? combinations comp complement compress cond
31
+ cons cons? constantly count cut cycle dec defclass defmacro defmacro!
32
+ defmacro/g! defmain defn defreader dict-comp disassemble dispatch-reader-macro distinct do doto
33
+ drop drop-last drop-while empty? eval eval-and-compile eval-when-compile even? every? filter
34
+ first flatten float? fn for* fraction genexpr gensym get group-by
35
+ identity if* if-not if-python2 inc input instance? integer integer-char? integer?
36
+ interleave interpose islice iterable? iterate iterator? juxt keyword keyword? last
37
+ let lif lif-not list* list-comp macro-error macroexpand macroexpand-1 map merge-with
38
+ multicombinations name neg? none? not-in not? nth numeric? odd? partition
39
+ permutations pos? product quasiquote quote range read read-str reduce remove
40
+ repeat repeatedly require rest second set-comp setv some string string?
41
+ symbol? take take-nth take-while tee unless unquote unquote-splicing when with*
42
+ with-decorator with-gensyms xor yield-from zero? zip zip-longest | |= ~
43
+ )
44
+ end
45
+
46
+ identifier = %r([\w!$%*+,<=>?/.-]+)
47
+ keyword = %r([\w!\#$%*+,<=>?/.-]+)
48
+
49
+ def name_token(name)
50
+ return Keyword if self.class.keywords.include?(name)
51
+ return Name::Builtin if self.class.builtins.include?(name)
52
+ nil
53
+ end
54
+
55
+ state :root do
56
+ rule /;.*?$/, Comment::Single
57
+ rule /\s+/m, Text::Whitespace
58
+
59
+ rule /-?\d+\.\d+/, Num::Float
60
+ rule /-?\d+/, Num::Integer
61
+ rule /0x-?[0-9a-fA-F]+/, Num::Hex
62
+
63
+ rule /"(\\.|[^"])*"/, Str
64
+ rule /'#{keyword}/, Str::Symbol
65
+ rule /::?#{keyword}/, Name::Constant
66
+ rule /\\(.|[a-z]+)/i, Str::Char
67
+
68
+
69
+ rule /~@|[`\'#^~&@]/, Operator
70
+
71
+ rule /(\()(\s*)(#{identifier})/m do |m|
72
+ token Punctuation, m[1]
73
+ token Text::Whitespace, m[2]
74
+ token(name_token(m[3]) || Name::Function, m[3])
75
+ end
76
+
77
+ rule identifier do |m|
78
+ token name_token(m[0]) || Name
79
+ end
80
+
81
+ # vectors
82
+ rule /[\[\]]/, Punctuation
83
+
84
+ # maps
85
+ rule /[{}]/, Punctuation
86
+
87
+ # parentheses
88
+ rule /[()]/, Punctuation
89
+ end
90
+ end
91
+ end
92
+ end
93
+
@@ -0,0 +1,407 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class IgorPro < RegexLexer
6
+ tag 'igorpro'
7
+ filenames '*.ipf'
8
+ mimetypes 'text/x-igorpro'
9
+
10
+ title "IgorPro"
11
+ desc "WaveMetrics Igor Pro"
12
+
13
+ def self.keywords
14
+ @keywords ||= Set.new %w(
15
+ structure endstructure
16
+ threadsafe static
17
+ macro proc window menu function end
18
+ if else elseif endif switch strswitch endswitch
19
+ break return continue
20
+ for endfor do while
21
+ case default
22
+ abortonrte
23
+ )
24
+ end
25
+
26
+ def self.preprocessor
27
+ @preprocessor ||= Set.new %w(
28
+ pragma include
29
+ define ifdef ifndef undef
30
+ if elif else endif
31
+ )
32
+ end
33
+
34
+ def self.igorDeclarations
35
+ @igorDeclarations ||= Set.new %w(
36
+ variable string wave strconstant constant
37
+ nvar svar dfref funcref struct
38
+ char uchar int16 uint16 int32 uint32 int64 uint64 float double
39
+ )
40
+ end
41
+
42
+ def self.igorConstants
43
+ @igorConstants ||= Set.new %w(
44
+ nan inf
45
+ )
46
+ end
47
+
48
+ def self.igorFunction
49
+ @igorFunction ||= Set.new %w(
50
+ axontelegraphsettimeoutms axontelegraphgettimeoutms
51
+ axontelegraphgetdatanum axontelegraphagetdatanum
52
+ axontelegraphgetdatastring axontelegraphagetdatastring
53
+ axontelegraphgetdatastruct axontelegraphagetdatastruct hdf5datasetinfo
54
+ hdf5attributeinfo hdf5typeinfo hdf5libraryinfo
55
+ mpfxgausspeak mpfxlorenzianpeak mpfxvoigtpeak mpfxemgpeak mpfxexpconvexppeak
56
+ abs acos acosh airya airyad airyb airybd
57
+ alog area areaxy asin asinh atan atan2 atanh axisvalfrompixel besseli
58
+ besselj besselk bessely beta betai binarysearch binarysearchinterp
59
+ binomial binomialln binomialnoise cabs capturehistorystart ceil cequal
60
+ char2num chebyshev chebyshevu checkname cmplx cmpstr conj contourz cos
61
+ cosh cosintegral cot coth countobjects countobjectsdfr cpowi
62
+ creationdate csc csch datafolderexists datafolderrefsequal
63
+ datafolderrefstatus date2secs datetime datetojulian dawson defined
64
+ deltax digamma dilogarithm dimdelta dimoffset dimsize ei enoise
65
+ equalwaves erf erfc erfcw exists exp expint expintegrale1 expnoise
66
+ factorial fakedata faverage faveragexy finddimlabel findlistitem floor
67
+ fontsizeheight fontsizestringwidth fresnelcos fresnelsin gamma
68
+ gammaeuler gammainc gammanoise gammln gammp gammq gauss gauss1d gauss2d
69
+ gcd getbrowserline getdefaultfontsize getdefaultfontstyle getkeystate
70
+ getrterror getrtlocation gizmoinfo gizmoscale gnoise grepstring hcsr
71
+ hermite hermitegauss hyperg0f1 hyperg1f1 hyperg2f1 hypergnoise hypergpfq
72
+ igorversion imag indextoscale integrate1d interp interp2d interp3d
73
+ inverseerf inverseerfc itemsinlist jacobicn jacobisn laguerre laguerrea
74
+ laguerregauss lambertw leftx legendrea limit ln log lognormalnoise
75
+ lorentziannoise magsqr mandelbrotpoint marcumq matrixcondition matrixdet
76
+ matrixdot matrixrank matrixtrace max mean median min mod moddate
77
+ norm numberbykey numpnts numtype numvarordefault nvar_exists p2rect
78
+ panelresolution paramisdefault pcsr pi pixelfromaxisval pnt2x
79
+ poissonnoise poly poly2d polygonarea qcsr r2polar real rightx round
80
+ sawtooth scaletoindex screenresolution sec sech selectnumber
81
+ setenvironmentvariable sign sin sinc sinh sinintegral sphericalbessj
82
+ sphericalbessjd sphericalbessy sphericalbessyd sphericalharmonics sqrt
83
+ startmstimer statsbetacdf statsbetapdf statsbinomialcdf statsbinomialpdf
84
+ statscauchycdf statscauchypdf statschicdf statschipdf statscmssdcdf
85
+ statscorrelation statsdexpcdf statsdexppdf statserlangcdf statserlangpdf
86
+ statserrorpdf statsevaluecdf statsevaluepdf statsexpcdf statsexppdf
87
+ statsfcdf statsfpdf statsfriedmancdf statsgammacdf statsgammapdf
88
+ statsgeometriccdf statsgeometricpdf statsgevcdf statsgevpdf
89
+ statshypergcdf statshypergpdf statsinvbetacdf statsinvbinomialcdf
90
+ statsinvcauchycdf statsinvchicdf statsinvcmssdcdf statsinvdexpcdf
91
+ statsinvevaluecdf statsinvexpcdf statsinvfcdf statsinvfriedmancdf
92
+ statsinvgammacdf statsinvgeometriccdf statsinvkuipercdf
93
+ statsinvlogisticcdf statsinvlognormalcdf statsinvmaxwellcdf
94
+ statsinvmoorecdf statsinvnbinomialcdf statsinvncchicdf statsinvncfcdf
95
+ statsinvnormalcdf statsinvparetocdf statsinvpoissoncdf statsinvpowercdf
96
+ statsinvqcdf statsinvqpcdf statsinvrayleighcdf statsinvrectangularcdf
97
+ statsinvspearmancdf statsinvstudentcdf statsinvtopdowncdf
98
+ statsinvtriangularcdf statsinvusquaredcdf statsinvvonmisescdf
99
+ statsinvweibullcdf statskuipercdf statslogisticcdf statslogisticpdf
100
+ statslognormalcdf statslognormalpdf statsmaxwellcdf statsmaxwellpdf
101
+ statsmedian statsmoorecdf statsnbinomialcdf statsnbinomialpdf
102
+ statsncchicdf statsncchipdf statsncfcdf statsncfpdf statsnctcdf
103
+ statsnctpdf statsnormalcdf statsnormalpdf statsparetocdf statsparetopdf
104
+ statspermute statspoissoncdf statspoissonpdf statspowercdf
105
+ statspowernoise statspowerpdf statsqcdf statsqpcdf statsrayleighcdf
106
+ statsrayleighpdf statsrectangularcdf statsrectangularpdf statsrunscdf
107
+ statsspearmanrhocdf statsstudentcdf statsstudentpdf statstopdowncdf
108
+ statstriangularcdf statstriangularpdf statstrimmedmean statsusquaredcdf
109
+ statsvonmisescdf statsvonmisesnoise statsvonmisespdf statswaldcdf
110
+ statswaldpdf statsweibullcdf statsweibullpdf stopmstimer str2num
111
+ stringcrc stringmatch strlen strsearch studenta studentt sum svar_exists
112
+ tagval tan tanh textencodingcode threadgroupcreate threadgrouprelease
113
+ threadgroupwait threadprocessorcount threadreturnvalue ticks trunc
114
+ unsetenvironmentvariable variance vcsr voigtfunc wavecrc wavedims
115
+ waveexists wavemax wavemin waverefsequal wavetextencoding wavetype
116
+ whichlistitem wintype wnoise x2pnt xcsr zcsr zerniker zeta addlistitem
117
+ annotationinfo annotationlist axisinfo axislist base64_decode
118
+ base64_encode capturehistory childwindowlist cleanupname contourinfo
119
+ contournamelist controlnamelist converttextencoding csrinfo csrwave
120
+ csrxwave ctablist datafolderdir date fetchurl fontlist funcrefinfo
121
+ functioninfo functionlist functionpath getbrowserselection getdatafolder
122
+ getdefaultfont getdimlabel getenvironmentvariable geterrmessage
123
+ getformula getindependentmodulename getindexedobjname
124
+ getindexedobjnamedfr getrterrmessage getrtlocinfo getrtstackinfo
125
+ getscraptext getuserdata getwavesdatafolder greplist guideinfo
126
+ guidenamelist hash igorinfo imageinfo imagenamelist
127
+ independentmodulelist indexeddir indexedfile juliantodate layoutinfo
128
+ listmatch lowerstr macrolist nameofwave normalizeunicode note num2char
129
+ num2istr num2str operationlist padstring parsefilepath pathlist pictinfo
130
+ pictlist possiblyquotename proceduretext removebykey removeending
131
+ removefromlist removelistitem replacenumberbykey replacestring
132
+ replacestringbykey secs2date secs2time selectstring sortlist
133
+ specialcharacterinfo specialcharacterlist specialdirpath stringbykey
134
+ stringfromlist stringlist strvarordefault tableinfo textencodingname
135
+ textfile threadgroupgetdf time tracefrompixel traceinfo tracenamelist
136
+ trimstring uniquename unpadstring upperstr urldecode urlencode
137
+ variablelist waveinfo wavelist wavename waverefwavetolist waveunits
138
+ winlist winname winrecreation wmfindwholeword xwavename
139
+ contournametowaveref csrwaveref csrxwaveref imagenametowaveref
140
+ listtotextwave listtowaverefwave newfreewave tagwaveref
141
+ tracenametowaveref waverefindexed waverefindexeddfr xwavereffromtrace
142
+ getdatafolderdfr getwavesdatafolderdfr newfreedatafolder
143
+ )
144
+ end
145
+
146
+ def self.igorOperation
147
+ @igorOperation ||= Set.new %w(
148
+ abort addfifodata addfifovectdata addmovieaudio addmovieframe adoptfiles
149
+ apmath append appendimage appendlayoutobject appendmatrixcontour
150
+ appendtext appendtogizmo appendtograph appendtolayout appendtotable
151
+ appendxyzcontour autopositionwindow backgroundinfo beep boundingball
152
+ browseurl buildmenu button cd chart checkbox checkdisplayed choosecolor
153
+ close closehelp closemovie closeproc colorscale colortab2wave
154
+ concatenate controlbar controlinfo controlupdate
155
+ convertglobalstringtextencoding convexhull convolve copyfile copyfolder
156
+ copyscales correlate createaliasshortcut createbrowser cross
157
+ ctrlbackground ctrlfifo ctrlnamedbackground cursor curvefit
158
+ customcontrol cwt debugger debuggeroptions defaultfont
159
+ defaultguicontrols defaultguifont defaulttextencoding defineguide
160
+ delayupdate deleteannotations deletefile deletefolder deletepoints
161
+ differentiate dir display displayhelptopic displayprocedure doalert
162
+ doigormenu doupdate dowindow doxopidle dpss drawaction drawarc
163
+ drawbezier drawline drawoval drawpict drawpoly drawrect drawrrect
164
+ drawtext drawusershape dspdetrend dspperiodogram duplicate
165
+ duplicatedatafolder dwt edgestats edit errorbars execute
166
+ executescripttext experimentmodified exportgizmo extract
167
+ fastgausstransform fastop fbinread fbinwrite fft fgetpos fifo2wave
168
+ fifostatus filterfir filteriir findcontour findduplicates findlevel
169
+ findlevels findpeak findpointsinpoly findroots findsequence findvalue
170
+ fpclustering fprintf freadline fsetpos fstatus ftpcreatedirectory
171
+ ftpdelete ftpdownload ftpupload funcfit funcfitmd gbloadwave getaxis
172
+ getcamera getfilefolderinfo getgizmo getlastusermenuinfo getmarquee
173
+ getmouse getselection getwindow graphnormal graphwavedraw graphwaveedit
174
+ grep groupbox hanning hideigormenus hideinfo hideprocedures hidetools
175
+ hilberttransform histogram ica ifft imageanalyzeparticles imageblend
176
+ imageboundarytomask imageedgedetection imagefileinfo imagefilter
177
+ imagefocus imagefromxyz imagegenerateroimask imageglcm
178
+ imagehistmodification imagehistogram imageinterpolate imagelineprofile
179
+ imageload imagemorphology imageregistration imageremovebackground
180
+ imagerestore imagerotate imagesave imageseedfill imageskeleton3d
181
+ imagesnake imagestats imagethreshold imagetransform imageunwrapphase
182
+ imagewindow indexsort insertpoints integrate integrate2d integrateode
183
+ interp3dpath interpolate2 interpolate3d jcamploadwave jointhistogram
184
+ killbackground killcontrol killdatafolder killfifo killfreeaxis killpath
185
+ killpicts killstrings killvariables killwaves killwindow kmeans label
186
+ layout layoutpageaction layoutslideshow legend
187
+ linearfeedbackshiftregister listbox loaddata loadpackagepreferences
188
+ loadpict loadwave loess lombperiodogram make makeindex markperftesttime
189
+ matrixconvolve matrixcorr matrixeigenv matrixfilter matrixgaussj
190
+ matrixglm matrixinverse matrixlinearsolve matrixlinearsolvetd matrixlls
191
+ matrixlubksub matrixlud matrixludtd matrixmultiply matrixop matrixschur
192
+ matrixsolve matrixsvbksub matrixsvd matrixtranspose measurestyledtext
193
+ mlloadwave modify modifybrowser modifycamera modifycontour modifycontrol
194
+ modifycontrollist modifyfreeaxis modifygizmo modifygraph modifyimage
195
+ modifylayout modifypanel modifytable modifywaterfall movedatafolder
196
+ movefile movefolder movestring movesubwindow movevariable movewave
197
+ movewindow multitaperpsd multithreadingcontrol neuralnetworkrun
198
+ neuralnetworktrain newcamera newdatafolder newfifo newfifochan
199
+ newfreeaxis newgizmo newimage newlayout newmovie newnotebook newpanel
200
+ newpath newwaterfall note notebook notebookaction open openhelp
201
+ opennotebook optimize parseoperationtemplate pathinfo pauseforuser
202
+ pauseupdate pca playmovie playmovieaction playsound popupcontextualmenu
203
+ popupmenu preferences primefactors print printf printgraphs printlayout
204
+ printnotebook printsettings printtable project pulsestats putscraptext
205
+ pwd quit ratiofromnumber redimension remove removecontour
206
+ removefromgizmo removefromgraph removefromlayout removefromtable
207
+ removeimage removelayoutobjects removepath rename renamedatafolder
208
+ renamepath renamepict renamewindow reorderimages reordertraces
209
+ replacetext replacewave resample resumeupdate reverse rotate save
210
+ savedata saveexperiment savegraphcopy savenotebook
211
+ savepackagepreferences savepict savetablecopy setactivesubwindow setaxis
212
+ setbackground setdashpattern setdatafolder setdimlabel setdrawenv
213
+ setdrawlayer setfilefolderinfo setformula setigorhook setigormenumode
214
+ setigoroption setmarquee setprocesssleep setrandomseed setscale
215
+ setvariable setwavelock setwavetextencoding setwindow showigormenus
216
+ showinfo showtools silent sleep slider smooth smoothcustom sort
217
+ sortcolumns soundinrecord soundinset soundinstartchart soundinstatus
218
+ soundinstopchart soundloadwave soundsavewave sphericalinterpolate
219
+ sphericaltriangulate splitstring splitwave sprintf sscanf stack
220
+ stackwindows statsangulardistancetest statsanova1test statsanova2nrtest
221
+ statsanova2rmtest statsanova2test statschitest
222
+ statscircularcorrelationtest statscircularmeans statscircularmoments
223
+ statscirculartwosampletest statscochrantest statscontingencytable
224
+ statsdiptest statsdunnetttest statsfriedmantest statsftest
225
+ statshodgesajnetest statsjbtest statskde statskendalltautest statskstest
226
+ statskwtest statslinearcorrelationtest statslinearregression
227
+ statsmulticorrelationtest statsnpmctest statsnpnominalsrtest
228
+ statsquantiles statsrankcorrelationtest statsresample statssample
229
+ statsscheffetest statsshapirowilktest statssigntest statssrtest
230
+ statsttest statstukeytest statsvariancestest statswatsonusquaredtest
231
+ statswatsonwilliamstest statswheelerwatsontest statswilcoxonranktest
232
+ statswrcorrelationtest structget structput sumdimension sumseries
233
+ tabcontrol tag textbox threadgroupputdf threadstart tile tilewindows
234
+ titlebox tocommandline toolsgrid triangulate3d unwrap urlrequest
235
+ valdisplay waveclear wavemeanstdv wavestats wavetransform wfprintf
236
+ )
237
+ end
238
+
239
+ def self.hdf5Operation
240
+ @hdf5Operation ||= Set.new %w(
241
+ hdf5createfile hdf5openfile hdf5closefile hdf5creategroup hdf5opengroup
242
+ hdf5listgroup hdf5closegroup hdf5listattributes hdf5attributeinfo hdf5datasetinfo
243
+ hdf5loaddata hdf5loadimage hdf5loadgroup hdf5savedata hdf5saveimage hdf5savegroup
244
+ hdf5typeinfo hdf5createlink hdf5unlinkobject hdf5libraryinfo
245
+ hdf5dumpstate hdf5dump hdf5dumperrors
246
+ )
247
+ end
248
+
249
+ def self.object_name
250
+ /[a-z][a-z0-9_]*\b/i
251
+ end
252
+
253
+ object = self.object_name
254
+ whitespace = /[\s\r]+/
255
+ noLineBreak = /[ \t]+/
256
+ operator = %r([\#$~!%^&*+=\|?:<>/-])
257
+ punctuation = /[{}()\[\],.;]/
258
+ number_float= /0x[a-f0-9]+/i
259
+ number_hex = /\d+\.\d+(e[\+\-]?\d+)?/
260
+ number_int = /[\d]+(?:_\d+)*/
261
+
262
+ state :root do
263
+ rule %r(//), Comment, :comments
264
+
265
+ rule /\b#{object}/ do |m|
266
+ if m[0].downcase.match /function/
267
+ token Keyword::Declaration
268
+ push :parse_function
269
+ elsif self.class.igorDeclarations.include? m[0].downcase
270
+ token Keyword::Declaration
271
+ push :parse_variables
272
+ elsif self.class.keywords.include? m[0].downcase
273
+ token Keyword
274
+ elsif self.class.igorConstants.include? m[0].downcase
275
+ token Keyword::Constant
276
+ elsif self.class.igorFunction.include? m[0].downcase
277
+ token Name::Builtin
278
+ elsif self.class.igorOperation.include? m[0].downcase
279
+ token Keyword::Reserved
280
+ push :operationFlags
281
+ elsif self.class.hdf5Operation.include? m[0].downcase
282
+ token Keyword::Reserved
283
+ push :operationFlags
284
+ elsif m[0].downcase.match /(v|s|w)_[a-z]+[a-z0-9]*/
285
+ token Name::Builtin
286
+ else
287
+ token Name
288
+ end
289
+ end
290
+
291
+ mixin :preprocessor
292
+ mixin :waveFlag
293
+
294
+ mixin :characters
295
+ mixin :numbers
296
+ end
297
+
298
+ state :preprocessor do
299
+ rule %r((\#)(#{object})) do |m|
300
+ if self.class.preprocessor.include? m[2].downcase
301
+ token Comment::Preproc
302
+ else
303
+ token Punctuation, m[1] #i.e. ModuleFunctions
304
+ token Name, m[2]
305
+ end
306
+
307
+
308
+ end
309
+ end
310
+
311
+ state :assignment do
312
+ mixin :whitespace
313
+ rule /\"/, Punctuation, :string1
314
+ mixin :string2
315
+ rule /#{number_float}/, Literal::Number::Float, :pop!
316
+ rule /#{number_int}/, Literal::Number::Integer, :pop!
317
+ rule /[\(\[\{][^\)\]\}]+[\)\]\}]/, Generic, :pop!
318
+ rule /[^\s\/\(]+/, Generic, :pop!
319
+ rule(//) { pop! }
320
+ end
321
+
322
+ state :parse_variables do
323
+ mixin :whitespace
324
+ rule /[=]/, Punctuation, :assignment
325
+ rule %r([/][a-z]+)i, Keyword::Pseudo, :parse_variables
326
+ rule object, Name::Variable
327
+ rule /[\[\]]/, Punctuation # optional variables in functions
328
+ rule /[,]/, Punctuation, :parse_variables
329
+ rule /\)/, Punctuation, :pop! # end of function
330
+ rule(//) { pop! }
331
+ end
332
+
333
+ state :parse_function do
334
+ rule %r([/][a-z]+)i, Keyword::Pseudo # only one flag
335
+ mixin :whitespace
336
+ rule object, Name::Function
337
+ rule /[\(]/, Punctuation, :parse_variables
338
+ rule(//) { pop! }
339
+ end
340
+
341
+ state :operationFlags do
342
+ rule /#{noLineBreak}/, Text
343
+ rule /[=]/, Punctuation, :assignment
344
+ rule %r([/][a-z]+)i, Keyword::Pseudo, :operationFlags
345
+ rule /(as)(\s*)(#{object})/i do
346
+ groups Keyword::Type, Text, Name::Label
347
+ end
348
+ rule(//) { pop! }
349
+ end
350
+
351
+ # inline variable assignments (i.e. for Make) with strict syntax
352
+ state :waveFlag do
353
+ rule %r(
354
+ (/(?:wave|X|Y))
355
+ (\s*)(=)(\s*)
356
+ (#{object})
357
+ )ix do |m|
358
+ token Keyword::Pseudo, m[1]
359
+ token Text, m[2]
360
+ token Punctuation, m[3]
361
+ token Text, m[4]
362
+ token Name::Variable, m[5]
363
+ end
364
+ end
365
+
366
+ state :characters do
367
+ rule /\s/, Text
368
+ rule /#{operator}/, Operator
369
+ rule /#{punctuation}/, Punctuation
370
+ rule /\"/, Punctuation, :string1
371
+ mixin :string2
372
+ end
373
+
374
+ state :numbers do
375
+ rule /#{number_float}/, Literal::Number::Float
376
+ rule /#{number_hex}/, Literal::Number::Hex
377
+ rule /#{number_int}/, Literal::Number::Integer
378
+ end
379
+
380
+ state :whitespace do
381
+ rule /#{noLineBreak}/, Text
382
+ end
383
+
384
+ state :string1 do
385
+ rule /%\w\b/, Literal::String::Other
386
+ rule /\\\\/, Literal::String::Escape
387
+ rule /\\\"/, Literal::String::Escape
388
+ rule /\\/, Literal::String::Escape
389
+ rule /[^"]/, Literal::String
390
+ rule /\"/, Punctuation, :pop!
391
+ end
392
+
393
+ state :string2 do
394
+ rule /\'[^']*\'/, Literal::String::Single
395
+ end
396
+
397
+ state :comments do
398
+ rule %r{([/]\s*)([@]\w+\b)}i do
399
+ # doxygen comments
400
+ groups Comment, Comment::Special
401
+ end
402
+ rule /[^\r\n]/, Comment
403
+ rule(//) { pop! }
404
+ end
405
+ end
406
+ end
407
+ end