rouge 3.16.0 → 3.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5342709cd08d6095557fbe22c79544c6be522f2343ed53360ab57f96bb37c077
4
- data.tar.gz: 25e1d81909ad22cece899eaf4d6c32ec1e0931611031f3ac8a37b6be3bceb497
3
+ metadata.gz: 1353759e9c75e7413608191e1fc9f670c4ac4f9db4cb3bc82c9c64d11ae54470
4
+ data.tar.gz: ae8d26b4295c1089d10c6567c3c5796613be6222e5dd22553f5f62fc238b2765
5
5
  SHA512:
6
- metadata.gz: e1244771613b6d0ec7523c834084974c4c9e6145a06d237e1bf937ffced73af0a7f7c4bf5efbf397b5bf943df7a66d4614cc601c82721f6b2d03425dc9118ecc
7
- data.tar.gz: ba9ecdc95aae8f45745820720b167ac102c1ac6d9af431024090cb79dd7805fb2ba981207de97c052339388b2886d2eb79e036b9aa60aaa8b6bc869bef9b5468
6
+ metadata.gz: ed188bc8fafde40a70384fc5bfb63a179ad23f4bab7c2616811e8260641b7a16fc2843b78c49543a4c45b8f790e47f68508f4979c9a10155ba4de94756c49382
7
+ data.tar.gz: f88c70213003b8235e275cca3d3776bb48abca5bd6cfdc52f7ef6ef398195028b7201b07c020ebaf5f509683cc7785a2bf93c6e0527a4c51a77f1ef8ca5eece9
@@ -0,0 +1,18 @@
1
+ /*
2
+ Example code - use without restriction.
3
+ */
4
+ Layout_Person := RECORD
5
+ UNSIGNED1 PersonID;
6
+ STRING15 FirstName;
7
+ STRING25 LastName;
8
+ END;
9
+
10
+ allPeople := DATASET([ {1,'Fred','Smith'},
11
+ {2,'Joe','Blow'},
12
+ {3,'Jane','Smith'}],Layout_Person);
13
+
14
+ somePeople := allPeople(LastName = 'Smith');
15
+
16
+ // Outputs ---
17
+ somePeople;
18
+
@@ -0,0 +1,12 @@
1
+ vcl 4.0;
2
+
3
+ backend server1 {
4
+ .host = "server1.example.com";
5
+ .probe = {
6
+ .url = "/";
7
+ .timeout = 1s;
8
+ .interval = 5s;
9
+ .window = 5;
10
+ .threshold = 3;
11
+ }
12
+ }
@@ -49,33 +49,54 @@ module Rouge
49
49
 
50
50
  id = /[$a-zA-Z_][a-zA-Z0-9_]*/
51
51
 
52
- state :comments_and_whitespace do
53
- rule %r/\s+/m, Text
52
+ state :comments do
54
53
  rule %r/###[^#].*?###/m, Comment::Multiline
55
54
  rule %r/#.*$/, Comment::Single
56
55
  end
57
56
 
58
- state :multiline_regex do
59
- # this order is important, so that #{ isn't interpreted
60
- # as a comment
61
- mixin :has_interpolation
62
- mixin :comments_and_whitespace
57
+ state :whitespace do
58
+ rule %r/\s+/m, Text
59
+ end
63
60
 
64
- rule %r(///([gim]+\b|\B)), Str::Regex, :pop!
65
- rule %r(/), Str::Regex
66
- rule %r([^/#]+), Str::Regex
61
+ state :regex_comment do
62
+ rule %r/^#(?!\{).*$/, Comment::Single
63
+ rule %r/(\s+)(#(?!\{).*)$/ do
64
+ groups Text, Comment::Single
65
+ end
67
66
  end
68
67
 
69
- state :slash_starts_regex do
70
- mixin :comments_and_whitespace
68
+ state :multiline_regex_begin do
71
69
  rule %r(///) do
72
70
  token Str::Regex
73
71
  goto :multiline_regex
74
72
  end
73
+ end
74
+
75
+ state :multiline_regex_end do
76
+ rule %r(///([gimy]+\b|\B)), Str::Regex, :pop!
77
+ end
78
+
79
+ state :multiline_regex do
80
+ mixin :multiline_regex_end
81
+ mixin :regex_comment
82
+ mixin :has_interpolation
83
+ mixin :comments
84
+ mixin :whitespace
85
+ mixin :code_escape
86
+
87
+ rule %r/\\\D/, Str::Escape
88
+ rule %r/\\\d+/, Name::Variable
89
+ rule %r/./m, Str::Regex
90
+ end
91
+
92
+ state :slash_starts_regex do
93
+ mixin :comments
94
+ mixin :whitespace
95
+ mixin :multiline_regex_begin
75
96
 
76
97
  rule %r(
77
98
  /(\\.|[^\[/\\\n]|\[(\\.|[^\]\\\n])*\])+/ # a regex
78
- ([gim]+\b|\B)
99
+ ([gimy]+\b|\B)
79
100
  )x, Str::Regex, :pop!
80
101
 
81
102
  rule(//) { pop! }
@@ -83,7 +104,9 @@ module Rouge
83
104
 
84
105
  state :root do
85
106
  rule(%r(^(?=\s|/|<!--))) { push :slash_starts_regex }
86
- mixin :comments_and_whitespace
107
+ mixin :comments
108
+ mixin :whitespace
109
+
87
110
  rule %r(
88
111
  [+][+]|--|~|&&|\band\b|\bor\b|\bis\b|\bisnt\b|\bnot\b|\bin\b|\bof\b|
89
112
  [?]|:|=|[|][|]|\\(?=\n)|(<<|>>>?|==?|!=?|[-<>+*`%&|^/])=?
@@ -129,10 +152,19 @@ module Rouge
129
152
  rule %r/'/, Str, :sqs
130
153
  end
131
154
 
155
+ state :code_escape do
156
+ rule %r(\\(
157
+ c[A-Z]|
158
+ x[0-9a-fA-F]{2}|
159
+ u[0-9a-fA-F]{4}|
160
+ u\{[0-9a-fA-F]{4}\}
161
+ ))x, Str::Escape
162
+ end
163
+
132
164
  state :strings do
133
165
  # all coffeescript strings are multi-line
134
166
  rule %r/[^#\\'"]+/m, Str
135
-
167
+ mixin :code_escape
136
168
  rule %r/\\./, Str::Escape
137
169
  rule %r/#/, Str
138
170
  end
@@ -0,0 +1,175 @@
1
+ # -*- codding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ module Rouge
5
+ module Lexers
6
+ class ECL < RegexLexer
7
+ tag 'ecl'
8
+ filenames '*.ecl'
9
+ mimetypes 'application/x-ecl'
10
+
11
+ title "ECL"
12
+ desc "Enterprise Control Language (hpccsystems.com)"
13
+
14
+ id = /(#?)\b([a-z_][\w]*?)(\d*)\b/i
15
+
16
+ def self.class_first
17
+ @class_first ||= Set.new %w(
18
+ file date str math metaphone metaphone3 uni audit blas system
19
+ )
20
+ end
21
+
22
+ def self.class_second
23
+ @class_second ||= Set.new %w(
24
+ debug email job log thorlib util workunit
25
+ )
26
+ end
27
+
28
+ def self.functions
29
+ @functions ||= Set.new %w(
30
+ abs acos aggregate allnodes apply ascii asin asstring atan _token ave
31
+ case catch choose choosen choosesets clustersize combine correlation
32
+ cos cosh count covariance cron dataset dedup define denormalize
33
+ dictionary distribute distributed distribution ebcdic enth error
34
+ evaluate event eventextra eventname exists exp failcode failmessage
35
+ fetch fromunicode fromxml getenv getisvalid global graph group hash
36
+ hashcrc having httpcall httpheader if iff index intformat isvalid
37
+ iterate join keyunicode length library limit ln local log loop map
38
+ matched matchlength matchposition matchtext matchunicode max merge
39
+ mergejoin min nofold nolocal nonempty normalize parse pipe power
40
+ preload process project pull random range rank ranked realformat
41
+ recordof regexfind regexreplace regroup rejected rollup round roundup
42
+ row rowdiff sample set sin sinh sizeof soapcall sort sorted sqrt
43
+ stepped stored sum table tan tanh thisnode topn tounicode toxml
44
+ transfer transform trim truncate typeof ungroup unicodeorder variance
45
+ which workunit xmldecode xmlencode xmltext xmlunicode apply assert
46
+ build buildindex evaluate fail keydiff keypatch loadxml nothor notify
47
+ output parallel sequential soapcall wait
48
+ )
49
+ end
50
+
51
+ def self.keywords
52
+ @keywords ||= Set.new %w(
53
+ and or in not all any as from atmost before best between case const
54
+ counter csv descend encrypt end endmacro enum except exclusive expire
55
+ export extend fail few first flat full function functionmacro group
56
+ heading hole ifblock import joined keep keyed last left limit load
57
+ local locale lookup many maxcount maxlength _token module interface
58
+ named nocase noroot noscan nosort of only opt outer overwrite packed
59
+ partition penalty physicallength pipe quote record repeat return
60
+ right rows scan self separator service shared skew skip sql store
61
+ terminator thor threshold token transform trim type unicodeorder
62
+ unsorted validate virtual whole wild within xml xpath after cluster
63
+ compressed compression default encoding escape fileposition forward
64
+ grouped inner internal linkcounted literal lzw mofn multiple
65
+ namespace wnotrim noxpath onfail prefetch retry rowset scope smart
66
+ soapaction stable timelimit timeout unordered unstable update use
67
+ width
68
+ )
69
+ end
70
+
71
+ def self.template
72
+ @template ||= Set.new %w(
73
+ append apply break constant debug declare demangle else elseif end
74
+ endregion error expand export exportxml for forall getdatatype if
75
+ ifdefined inmodule isdefined isvalid line link loop mangle onwarning
76
+ option region set stored text trace uniquename warning webservice
77
+ workunit loadxml
78
+ )
79
+ end
80
+
81
+ def self.type
82
+ @type ||= Set.new %w(
83
+ ascii big_endian boolean data decimal ebcdic grouped integer
84
+ linkcounted pattern qstring real record rule set of streamed string
85
+ token udecimal unicode utf8 unsigned varstring varunicode
86
+ )
87
+ end
88
+
89
+ def self.typed
90
+ @typed ||= Set.new %w(
91
+ data string qstring varstring varunicode unicode utf8
92
+ )
93
+ end
94
+
95
+ state :single_quote do
96
+ rule %r([xDQUV]?'([^'\\]*(?:\\.[^'\\]*)*)'), Str::Single
97
+ rule %r/\\(x\\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)/, Text
98
+ end
99
+
100
+ state :inline_whitespace do
101
+ rule %r/[ \t\r]+/, Text
102
+ rule %r/\\\n/, Text # line continuation
103
+ rule %r(/[*].*?[*]/)m, Comment::Multiline
104
+ end
105
+
106
+ state :whitespace do
107
+ rule %r/\n+/m, Text
108
+ rule %r(//.*), Comment::Single
109
+ mixin :inline_whitespace
110
+ end
111
+
112
+ state :root do
113
+ mixin :whitespace
114
+ mixin :single_quote
115
+
116
+ rule %r(\b(?i:(and|not|or|in))\b), Operator::Word
117
+ rule %r([:=|>|<|<>|/|\\|\+|-|=]), Operator
118
+ rule %r([\[\]{}();,\&,\.,\%]), Punctuation
119
+
120
+ rule %r(\b(?i:(beginc\+\+.*?endc\+\+)))m, Str::Single
121
+ rule %r(\b(?i:(embed.*?endembed)))m, Str::Single
122
+
123
+ rule %r(\b(\w+)\.(\w+)\.(\w+)) do |m|
124
+ if m[1] == "std" &&
125
+ self.class.class_first.include?(m[2]) &&
126
+ self.class.class_second.include?(m[3])
127
+ token Name::Class
128
+ else
129
+ token Name::Variable
130
+ end
131
+ end
132
+
133
+ rule %r(\b(?i:(u)?decimal)(\d+(_\d+)?)\b), Keyword::Type
134
+
135
+ rule %r/\d+\.\d+(e[\+\-]?\d+)?/i, Num::Float
136
+ rule %r/x[0-9a-f]+/i, Num::Hex
137
+
138
+ rule %r/0x[0-9a-f]+/i, Num::Hex
139
+ rule %r/0[0-9a-f]+x/i, Num::Hex
140
+ rule %r(0[bB][01]+), Num::Bin
141
+ rule %r([01]+[bB]), Num::Bin
142
+ rule %r(\d+), Num::Integer
143
+
144
+ rule id do |m|
145
+ name_only = m[2].downcase
146
+ name = name_only + m[3]
147
+ number = (m[3] == "") ? nil : m[3].to_i
148
+ if m[1] == "#"
149
+ if self.class.template.include? name
150
+ token Keyword::Type
151
+ else
152
+ token Error
153
+ end
154
+ elsif self.class.typed.include?(name_only) && number != nil
155
+ token Keyword::Type
156
+ elsif self.class.type.include? name
157
+ token Keyword::Type
158
+ elsif self.class.keywords.include? name
159
+ token Keyword
160
+ elsif self.class.functions.include? name
161
+ token Name::Function
162
+ elsif ["integer", "unsigned"].include?(name_only) && (1..8).cover?(number)
163
+ token Keyword::Type
164
+ elsif name_only == "real" && [4, 8].include?(number)
165
+ token Keyword::Type
166
+ elsif ["true", "false"].include? name
167
+ token Keyword::Constant
168
+ else
169
+ token Name::Other
170
+ end
171
+ end
172
+ end
173
+ end
174
+ end
175
+ end
@@ -32,7 +32,7 @@ module Rouge
32
32
  rule %r/^#(?=[^#]).*?$/, Generic::Heading
33
33
  rule %r/^##*.*?$/, Generic::Subheading
34
34
 
35
- rule %r/^([ \t]*)(```|~~~)([^\n]*\n)((.*?)(\2))?/m do |m|
35
+ rule %r/^([ \t]*)(`{3,}|~{3,})([^\n]*\n)((.*?)(\n\1)(\2))?/m do |m|
36
36
  name = m[3].strip
37
37
  sublexer =
38
38
  begin
@@ -51,8 +51,10 @@ module Rouge
51
51
  delegate sublexer, m[5]
52
52
  end
53
53
 
54
- if m[6]
55
- token Punctuation, m[6]
54
+ token Text, m[6]
55
+
56
+ if m[7]
57
+ token Punctuation, m[7]
56
58
  else
57
59
  push do
58
60
  rule %r/^([ \t]*)(#{m[2]})/ do |mb|
@@ -100,7 +102,7 @@ module Rouge
100
102
  end
101
103
 
102
104
  # links and images
103
- rule %r/(!?\[)(#{edot}*?)(\])/ do
105
+ rule %r/(!?\[)(#{edot}*?)(\])(?=[\[(])/ do
104
106
  groups Punctuation, Name::Variable, Punctuation
105
107
  push :link
106
108
  end
@@ -115,7 +117,6 @@ module Rouge
115
117
  rule %r/<.*?@.+[.].+>/, Name::Variable
116
118
  rule %r[<(https?|mailto|ftp)://#{edot}*?>], Name::Variable
117
119
 
118
-
119
120
  rule %r/[^\\`\[*\n&<]+/, Text
120
121
 
121
122
  # inline html
@@ -123,6 +124,9 @@ module Rouge
123
124
  rule(/<#{edot}*?>/) { delegate html }
124
125
  rule %r/[&<]/, Text
125
126
 
127
+ # An opening square bracket that is not a link
128
+ rule %r/\[/, Text
129
+
126
130
  rule %r/\n/, Text
127
131
  end
128
132
 
@@ -1,197 +1,71 @@
1
1
  # -*- coding: utf-8 -*- #
2
2
  # frozen_string_literal: true
3
3
 
4
+ # Based on Chroma's NASM lexer implementation
5
+ # https://github.com/alecthomas/chroma/blob/498eaa690f5ac6ab0e3d6f46237e547a8935cdc7/lexers/n/nasm.go
4
6
  module Rouge
5
7
  module Lexers
6
8
  class Nasm < RegexLexer
7
- tag 'nasm'
8
- filenames '*.asm'
9
- #mimetypes 'text/x-chdr', 'text/x-csrc'
10
-
11
9
  title "Nasm"
12
10
  desc "Netwide Assembler"
13
11
 
14
- id = /[a-zA-Z_][a-zA-Z0-9_]*/
15
-
16
- #todo: pull more instructions from: http://www.nasm.us/doc/nasmdocb.html
17
- #so far, we have sections 1.1 and 1.2
18
-
19
- def self.keywords
20
- @keywords ||= Set.new %w(
21
- aaa aad aam aas adc add and arpl bb0_reset bb1_reset bound bsf bsr bswap bt btc btr bts
22
- call cbw cdq cdqe clc cld cli clts cmc cmp cmpsb cmpsd cmpsq cmpsw cmpxchg
23
- cmpxchg16b cmpxchg486 cmpxchg8b cpuid cpu_read cpu_write cqo cwd cwde daa das dec div
24
- dmint emms enter equ f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove
25
- fcmovnb fcmovnbe fcmovne fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp
26
- fdisi fdiv fdivp fdivr fdivrp femms feni ffree ffreep fiadd ficom ficomp fidiv fidivr
27
- fild fimul fincstp finit fist fistp fisttp fisub fisubr fld fld1 fldcw fldenv fldl2e
28
- fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave fnstcw
29
- fnstenv fnstsw fpatan fprem fprem1 fptan frndint frstor fsave fscale fsetpm fsin fsincos
30
- fsqrt fst fstcw fstenv fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomi fucomip
31
- fucomp fucompp fwait fxam fxch fxtract fyl2x fyl2xp1 hlt ibts icebp idiv imul in inc
32
- incbin insb insd insw int int01 int03 int1 int3 into invd invlpg invlpga invpcid iret
33
- iretd iretq iretw jcxz jecxz jmp jmpe jrcxz lahf lar lds lea leave les lfence lfs
34
- lgdt lgs lidt lldt lmsw loadall loadall286 lodsb lodsd lodsq lodsw loop loope loopne
35
- loopnz loopz lsl lss ltr mfence monitor monitorx mov movd movq movsb movsd movsq movsw
36
- movsx movsxd movzx mul mwait mwaitx neg nop not or out outsb outsd outsw packssdw
37
- packsswb packuswb paddb paddd paddsb paddsiw paddsw paddusb paddusw paddw pand pandn
38
- pause paveb pavgusb pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pdistib pf2id pfacc
39
- pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt
40
- pfsub pfsubr pi2fd pmachriw pmaddwd pmagw pmulhriw pmulhrwa pmulhrwc pmulhw pmullw
41
- pmvgezb pmvlzb pmvnzb pmvzb pop popa popad popaw popf popfd popfq popfw por prefetch
42
- prefetchw pslld psllq psllw psrad psraw psrld psrlq psrlw psubb psubd psubsb psubsiw
43
- psubsw psubusb psubusw psubw punpckhbw punpckhdq punpckhwd punpcklbw punpckldq punpcklwd
44
- push pusha pushad pushaw pushf pushfd pushfq pushfw pxor rcl rcr rdm rdmsr rdpmc rdshr
45
- rdtsc rdtscp ret retf retn rol ror rsdc rsldt rsm rsts sahf sal salc sar sbb scasb scasd
46
- scasq scasw sfence sgdt shl shld shr shrd sidt skinit sldt smi smint smintold smsw
47
- stc std sti stosb stosd stosq stosw str sub svdc svldt svts swapgs syscall sysenter
48
- sysexit sysret test ud0 ud1 ud2 ud2a ud2b umov verr verw wbinvd wrmsr wrshr xadd xbts
49
- xchg xlat xlatb xor
50
-
51
- cmova cmovae cmovb cmovbe cmovc cmove cmovg cmovge cmovl cmovle cmovna cmovnae cmovnb cmovnbe cmovnc cmovne cmovng cmovnge cmovnl cmovnle cmovno cmovnp cmovns cmovnz cmovo cmovp cmovpe cmovpo cmovs cmovz
52
-
53
- ja jae jb jbe jc jcxz jecxz je jg jge jl jle jna jnae jnb jnbe jnc jne jng jnge jnl jnle jno jnp jns jnz jo jp jpe jpo js jz
54
-
55
- seta setae setb setbe setc sete setg setge setl setle setna setnae setnb setnbe setnc setne setng setnge setnl setnle setno setnp setns setnz seto setp setpe setpo sets setz
56
-
57
- AAA AAD AAM AAS ADC ADD AND ARPL BB0_RESET BB1_RESET BOUND BSF BSR BSWAP BT BTC BTR BTS
58
- CALL CBW CDQ CDQE CLC CLD CLI CLTS CMC CMP CMPSB CMPSD CMPSQ CMPSW CMPXCHG
59
- CMPXCHG16B CMPXCHG486 CMPXCHG8B CPUID CPU_READ CPU_WRITE CQO CWD CWDE DAA DAS DEC DIV
60
- DMINT EMMS ENTER EQU F2XM1 FABS FADD FADDP FBLD FBSTP FCHS FCLEX FCMOVB FCMOVBE FCMOVE
61
- FCMOVNB FCMOVNBE FCMOVNE FCMOVNU FCMOVU FCOM FCOMI FCOMIP FCOMP FCOMPP FCOS FDECSTP
62
- FDISI FDIV FDIVP FDIVR FDIVRP FEMMS FENI FFREE FFREEP FIADD FICOM FICOMP FIDIV FIDIVR
63
- FILD FIMUL FINCSTP FINIT FIST FISTP FISTTP FISUB FISUBR FLD FLD1 FLDCW FLDENV FLDL2E
64
- FLDL2T FLDLG2 FLDLN2 FLDPI FLDZ FMUL FMULP FNCLEX FNDISI FNENI FNINIT FNOP FNSAVE FNSTCW
65
- FNSTENV FNSTSW FPATAN FPREM FPREM1 FPTAN FRNDINT FRSTOR FSAVE FSCALE FSETPM FSIN FSINCOS
66
- FSQRT FST FSTCW FSTENV FSTP FSTSW FSUB FSUBP FSUBR FSUBRP FTST FUCOM FUCOMI FUCOMIP
67
- FUCOMP FUCOMPP FWAIT FXAM FXCH FXTRACT FYL2X FYL2XP1 HLT IBTS ICEBP IDIV IMUL IN INC
68
- INCBIN INSB INSD INSW INT INT01 INT03 INT1 INT3 INTO INVD INVLPG INVLPGA INVPCID IRET
69
- IRETD IRETQ IRETW JCXZ JECXZ JMP JMPE JRCXZ LAHF LAR LDS LEA LEAVE LES LFENCE LFS
70
- LGDT LGS LIDT LLDT LMSW LOADALL LOADALL286 LODSB LODSD LODSQ LODSW LOOP LOOPE LOOPNE
71
- LOOPNZ LOOPZ LSL LSS LTR MFENCE MONITOR MONITORX MOV MOVD MOVQ MOVSB MOVSD MOVSQ MOVSW
72
- MOVSX MOVSXD MOVZX MUL MWAIT MWAITX NEG NOP NOT OR OUT OUTSB OUTSD OUTSW PACKSSDW
73
- PACKSSWB PACKUSWB PADDB PADDD PADDSB PADDSIW PADDSW PADDUSB PADDUSW PADDW PAND PANDN
74
- PAUSE PAVEB PAVGUSB PCMPEQB PCMPEQD PCMPEQW PCMPGTB PCMPGTD PCMPGTW PDISTIB PF2ID PFACC
75
- PFADD PFCMPEQ PFCMPGE PFCMPGT PFMAX PFMIN PFMUL PFRCP PFRCPIT1 PFRCPIT2 PFRSQIT1 PFRSQRT
76
- PFSUB PFSUBR PI2FD PMACHRIW PMADDWD PMAGW PMULHRIW PMULHRWA PMULHRWC PMULHW PMULLW
77
- PMVGEZB PMVLZB PMVNZB PMVZB POP POPA POPAD POPAW POPF POPFD POPFQ POPFW POR PREFETCH
78
- PREFETCHW PSLLD PSLLQ PSLLW PSRAD PSRAW PSRLD PSRLQ PSRLW PSUBB PSUBD PSUBSB PSUBSIW
79
- PSUBSW PSUBUSB PSUBUSW PSUBW PUNPCKHBW PUNPCKHDQ PUNPCKHWD PUNPCKLBW PUNPCKLDQ PUNPCKLWD
80
- PUSH PUSHA PUSHAD PUSHAW PUSHF PUSHFD PUSHFQ PUSHFW PXOR RCL RCR RDM RDMSR RDPMC RDSHR
81
- RDTSC RDTSCP RET RETF RETN ROL ROR RSDC RSLDT RSM RSTS SAHF SAL SALC SAR SBB SCASB SCASD
82
- SCASQ SCASW SFENCE SGDT SHL SHLD SHR SHRD SIDT SKINIT SLDT SMI SMINT SMINTOLD SMSW
83
- STC STD STI STOSB STOSD STOSQ STOSW STR SUB SVDC SVLDT SVTS SWAPGS SYSCALL SYSENTER
84
- SYSEXIT SYSRET TEST UD0 UD1 UD2 UD2A UD2B UMOV VERR VERW WBINVD WRMSR WRSHR XADD XBTS
85
- XCHG XLAT XLATB XOR
86
-
87
- CMOVA CMOVAE CMOVB CMOVBE CMOVC CMOVE CMOVG CMOVGE CMOVL CMOVLE CMOVNA CMOVNAE CMOVNB CMOVNBE CMOVNC CMOVNE CMOVNG CMOVNGE CMOVNL CMOVNLE CMOVNO CMOVNP CMOVNS CMOVNZ CMOVO CMOVP CMOVPE CMOVPO CMOVS CMOVZ
12
+ tag 'nasm'
13
+ filenames '*.asm'
14
+ mimetypes 'text/x-nasm'
88
15
 
89
- JA JAE JB JBE JC JCXZ JECXZ JE JG JGE JL JLE JNA JNAE JNB JNBE JNC JNE JNG JNGE JNL JNLE JNO JNP JNS JNZ JO JP JPE JPO JS JZ
16
+ state :root do
17
+ rule %r/^\s*%/, Comment::Preproc, :preproc
90
18
 
91
- SETA SETAE SETB SETBE SETC SETE SETG SETGE SETL SETLE SETNA SETNAE SETNB SETNBE SETNC SETNE SETNG SETNGE SETNL SETNLE SETNO SETNP SETNS SETNZ SETO SETP SETPE SETPO SETS SETZ
92
- )
93
- end
19
+ mixin :whitespace
94
20
 
95
- def self.keywords_type
96
- @keywords_type ||= Set.new %w(
97
- DB DW DD DQ DT DO DY DZ RESB RESW RESD RESQ REST RESO RESY RESZ
98
- db dq dd dq dt do dy dz resb resw resd resq rest reso resy resz
99
- )
100
- end
21
+ rule %r/[a-z$._?][\w$.?#@~]*:/i, Name::Label
101
22
 
102
- def self.reserved
103
- @reserved ||= Set.new %w(
104
- global extern macro endmacro assign rep endrep section
105
- GLOBAL EXTERN MACRO ENDMACRO ASSIGN REP ENDREP SECTION
106
- )
107
- end
23
+ rule %r/([a-z$._?][\w$.?#@~]*)(\s+)(equ)/i do
24
+ groups Name::Constant, Keyword::Declaration, Keyword::Declaration
25
+ push :instruction_args
26
+ end
27
+ rule %r/BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|ORG|ALIGN|STRUC|ENDSTRUC|COMMON|CPU|GROUP|UPPERCASE|IMPORT|EXPORT|LIBRARY|MODULE/, Keyword, :instruction_args
28
+ rule %r/(?:res|d)[bwdqt]|times/i, Keyword::Declaration, :instruction_args
29
+ rule %r/[a-z$._?][\w$.?#@~]*/i, Name::Function, :instruction_args
108
30
 
109
- def self.builtins
110
- @builtins ||= []
31
+ rule %r/[\r\n]+/, Text
111
32
  end
112
33
 
113
- start { push :expr_bol }
114
-
115
- state :expr_bol do
116
- mixin :inline_whitespace
117
- rule(//) { pop! }
118
- end
34
+ state :instruction_args do
35
+ rule %r/"(\\\\"|[^"\\n])*"|'(\\\\'|[^'\\n])*'|`(\\\\`|[^`\\n])*`/, Str
36
+ rule %r/(?:0x[\da-f]+|$0[\da-f]*|\d+[\da-f]*h)/i, Num::Hex
37
+ rule %r/[0-7]+q/i, Num::Oct
38
+ rule %r/[01]+b/i, Num::Bin
39
+ rule %r/\d+\.e?\d+/i, Num::Float
40
+ rule %r/\d+/, Num::Integer
119
41
 
120
- state :inline_whitespace do
121
- rule %r/[ \t\r]+/, Text
122
- end
42
+ mixin :punctuation
123
43
 
124
- state :whitespace do
125
- rule %r/\n+/m, Text, :expr_bol
126
- rule %r(//(\\.|.)*?\n), Comment::Single, :expr_bol
127
- mixin :inline_whitespace
128
- end
44
+ rule %r/r\d[0-5]?[bwd]|[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7]/i, Name::Builtin
45
+ rule %r/[a-z$._?][\w$.?#@~]*/i, Name::Variable
46
+ rule %r/[\r\n]+/, Text, :pop!
129
47
 
130
- state :expr_whitespace do
131
- rule %r/\n+/m, Text, :expr_bol
132
48
  mixin :whitespace
133
49
  end
134
50
 
135
- state :root do
136
- mixin :expr_whitespace
137
- rule(//) { push :statement }
138
- rule %r/^%[a-zA-Z0-9]+/, Comment::Preproc, :statement
139
-
140
- rule(
141
- %r(&=|[*]=|/=|\\=|\^=|\+=|-=|<<=|>>=|<<|>>|:=|<=|>=|<>|[-&*/\\^+=<>.]),
142
- Operator
143
- )
144
- rule %r/;.*/, Comment, :statement
145
- rule %r/^[a-zA-Z]+[a-zA-Z0-9]*:/, Name::Function
146
- rule %r/;.*/, Comment
51
+ state :preproc do
52
+ rule %r/[^;\n]+/, Comment::Preproc
53
+ rule %r/;.*?\n/, Comment::Single, :pop!
54
+ rule %r/\n/, Comment::Preproc, :pop!
147
55
  end
148
56
 
149
- state :statement do
150
- mixin :expr_whitespace
151
- mixin :statements
152
- rule %r/;.*/, Comment
153
- rule %r/^%[a-zA-Z0-9]+/, Comment::Preproc
154
- rule %r/[a-zA-Z]+%[0-9]+:/, Name::Function
155
- end
156
-
157
- state :statements do
158
- mixin :whitespace
159
- rule %r/L?"/, Str, :string
160
- rule %r/[a-zA-Z]+%[0-9]+:/, Name::Function #labels/subroutines/functions
161
- rule %r(L?'(\\.|\\[0-7]{1,3}|\\x[a-f0-9]{1,2}|[^\\'\n])')i, Str::Char
162
- rule %r/0x[0-9a-f]+[lu]*/i, Num::Hex
163
- rule %r/\d+[lu]*/i, Num::Integer
164
- rule %r(\*/), Error
165
- rule %r([~&*+=\|?:<>/-]), Operator
166
- rule %r/[(),.]/, Punctuation
167
- rule %r/\[[a-zA-Z0-9]*\]/, Punctuation
168
- rule %r/%[0-9]+/, Keyword::Reserved
169
- rule %r/[a-zA-Z]+%[0-9]+/, Name::Function #labels/subroutines/functions
170
-
171
- #rule %r/(?<!\.)#{id}/ do |m|
172
- rule id do |m|
173
- name = m[0]
174
-
175
- if self.class.keywords.include? name
176
- token Keyword
177
- elsif self.class.keywords_type.include? name
178
- token Keyword::Type
179
- elsif self.class.reserved.include? name
180
- token Keyword::Reserved
181
- elsif self.class.builtins.include? name
182
- token Name::Builtin
183
- else
184
- token Name
185
- end
186
- end
57
+ state :whitespace do
58
+ rule %r/\n/, Text
59
+ rule %r/[ \t]+/, Text
60
+ rule %r/;.*/, Comment::Single
187
61
  end
188
62
 
189
- state :string do
190
- rule %r/"/, Str, :pop!
191
- rule %r/\\([\\abfnrtv"']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})/, Str::Escape
192
- rule %r/[^\\"\n]+/, Str
193
- rule %r/\\\n/, Str
194
- rule %r/\\/, Str # stray backslash
63
+ state :punctuation do
64
+ rule %r/[,():\[\]]+/, Punctuation
65
+ rule %r/[&|^<>+*\/%~-]+/, Operator
66
+ rule %r/\$+/, Keyword::Constant
67
+ rule %r/seg|wrt|strict/i, Operator::Word
68
+ rule %r/byte|[dq]?word/i, Keyword::Type
195
69
  end
196
70
  end
197
71
  end
@@ -170,8 +170,11 @@ module Rouge
170
170
  rule %r/0_?[0-7]+(?:_[0-7]+)*/, Num::Oct
171
171
  rule %r/0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*/, Num::Hex
172
172
  rule %r/0b[01]+(?:_[01]+)*/, Num::Bin
173
- rule %r/\d+\.\d+(e[\+\-]?\d+)?/, Num::Float
174
- rule %r/[\d]+(?:_\d+)*/, Num::Integer
173
+
174
+ decimal = %r/[\d]+(?:_\d+)*/
175
+ exp = %r/e[+-]?\d+/i
176
+ rule %r/#{decimal}(?:\.#{decimal}#{exp}?|#{exp})/, Num::Float
177
+ rule decimal, Num::Integer
175
178
 
176
179
  # names
177
180
  rule %r/@@[a-z_]\w*/i, Name::Variable::Class
@@ -40,7 +40,7 @@ module Rouge
40
40
  groups Keyword, Text
41
41
  push :class
42
42
  end
43
- rule %r/'#{idrest}[^']/, Str::Symbol
43
+ rule %r/'#{idrest}(?!')/, Str::Symbol
44
44
  rule %r/[^\S\n]+/, Text
45
45
 
46
46
  rule %r(//.*), Comment::Single
@@ -4,16 +4,14 @@
4
4
  module Rouge
5
5
  module Lexers
6
6
  class Varnish < RegexLexer
7
- title 'Varnish'
8
- desc 'The Varnish (high-performance web accelerator) configuration language'
7
+ title 'VCL: Varnish Configuration Language'
8
+ desc 'The configuration language for Varnish HTTP Cache (varnish-cache.org)'
9
9
 
10
- tag 'varnish'
11
- aliases 'varnishconf', 'VCL'
10
+ tag 'vcl'
11
+ aliases 'varnishconf', 'varnish'
12
12
  filenames '*.vcl'
13
- mimetypes 'text/x-varnish'
13
+ mimetypes 'text/x-varnish', 'text/x-vcl'
14
14
 
15
- LNUM = '[0-9]+'
16
- DNUM = '([0-9]*"."[0-9]+)|([0-9]+"."[0-9]*)'
17
15
  SPACE = '[ \f\n\r\t\v]+'
18
16
 
19
17
  # backend acl
@@ -21,6 +19,9 @@ module Rouge
21
19
  @keywords ||= Set.new %w[
22
20
  vcl set unset include import if else elseif elif elsif director probe
23
21
  backend acl
22
+
23
+ declare local
24
+ BOOL FLOAT INTEGER IP RTIME STRING TIME
24
25
  ]
25
26
  end
26
27
 
@@ -65,6 +66,9 @@ module Rouge
65
66
  # long strings ({" ... "})
66
67
  rule %r/\{".*?"}/m, Str::Single
67
68
 
69
+ # heredoc style long strings ({xyz"..."xyz})
70
+ rule %r/\{(\w+)".*?"(\1)\}/m, Str::Single
71
+
68
72
  # comments
69
73
  rule %r'/\*.*?\*/'m, Comment::Multiline
70
74
  rule %r'(?://|#).*', Comment::Single
@@ -72,7 +76,13 @@ module Rouge
72
76
  rule %r/true|false/, Keyword::Constant
73
77
 
74
78
  # "wildcard variables"
75
- rule %r/(?:(?:be)?re(?:sp|q)|obj)\.http\.[\w.-]+/ do
79
+ var_prefix = Regexp.union(%w(beresp bereq resp req obj))
80
+ rule %r/(?:#{var_prefix})\.http\.[\w.-]+/ do
81
+ token Name::Variable
82
+ end
83
+
84
+ # local variables (var.*)
85
+ rule %r/(?:var)\.[\w.-]+/ do
76
86
  token Name::Variable
77
87
  end
78
88
 
@@ -86,20 +96,47 @@ module Rouge
86
96
  push :inline_c
87
97
  end
88
98
 
89
- rule %r/[a-z_.-]+/i do |m|
99
+ rule %r/\.?[a-z_][\w.-]*/i do |m|
90
100
  next token Keyword if self.class.keywords.include? m[0]
91
101
  next token Name::Function if self.class.functions.include? m[0]
92
102
  next token Name::Variable if self.class.variables.include? m[0]
93
103
  token Text
94
104
  end
95
105
 
96
- # duration
97
- rule %r/(?:#{LNUM}|#{DNUM})(?:ms|[smhdwy])/, Num::Other
98
- # size in bytes
99
- rule %r/#{LNUM}[KMGT]?B/, Num::Other
100
- # literal numeric values (integer/float)
101
- rule %r/#{LNUM}/, Num::Integer
102
- rule %r/#{DNUM}/, Num::Float
106
+ ## for number literals
107
+
108
+ decimal = %r/[0-9]+/
109
+ hex = %r/[0-9a-f]+/i
110
+
111
+ numeric = %r{
112
+ (?:
113
+ 0x#{hex}
114
+ (?:\.#{hex})?
115
+ (?:p[+-]?#{hex})?
116
+ )
117
+ |
118
+ (?:
119
+ #{decimal}
120
+ (?:\.#{decimal})?
121
+ (?:e[+-]?#{decimal})?
122
+ )
123
+ }xi
124
+
125
+ # duration literals
126
+ duration_suffix = Regexp.union(%w(ms s m h d w y))
127
+ rule %r/#{numeric}#{duration_suffix}/, Num::Other
128
+
129
+ # numeric literals (integer / float)
130
+ rule numeric do |m|
131
+ case m[0]
132
+ when /^#{decimal}$/
133
+ token Num::Integer
134
+ when /^0x#{hex}$/
135
+ token Num::Integer
136
+ else
137
+ token Num::Float
138
+ end
139
+ end
103
140
 
104
141
  # standard strings
105
142
  rule %r/"/, Str::Double, :string
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Rouge
5
5
  def self.version
6
- "3.16.0"
6
+ "3.17.0"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rouge
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.16.0
4
+ version: 3.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeanine Adkisson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-11 00:00:00.000000000 Z
11
+ date: 2020-03-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rouge aims to a be a simple, easy-to-extend drop-in replacement for pygments.
14
14
  email:
@@ -63,6 +63,7 @@ files:
63
63
  - lib/rouge/demos/digdag
64
64
  - lib/rouge/demos/docker
65
65
  - lib/rouge/demos/dot
66
+ - lib/rouge/demos/ecl
66
67
  - lib/rouge/demos/eex
67
68
  - lib/rouge/demos/eiffel
68
69
  - lib/rouge/demos/elixir
@@ -193,8 +194,8 @@ files:
193
194
  - lib/rouge/demos/twig
194
195
  - lib/rouge/demos/typescript
195
196
  - lib/rouge/demos/vala
196
- - lib/rouge/demos/varnish
197
197
  - lib/rouge/demos/vb
198
+ - lib/rouge/demos/vcl
198
199
  - lib/rouge/demos/verilog
199
200
  - lib/rouge/demos/vhdl
200
201
  - lib/rouge/demos/viml
@@ -267,6 +268,7 @@ files:
267
268
  - lib/rouge/lexers/digdag.rb
268
269
  - lib/rouge/lexers/docker.rb
269
270
  - lib/rouge/lexers/dot.rb
271
+ - lib/rouge/lexers/ecl.rb
270
272
  - lib/rouge/lexers/eex.rb
271
273
  - lib/rouge/lexers/eiffel.rb
272
274
  - lib/rouge/lexers/elixir.rb
@@ -1,55 +0,0 @@
1
- vcl 4.0;
2
-
3
- backend server1 {
4
- .host = "server1.example.com";
5
- .probe = {
6
- .url = "/";
7
- .timeout = 1s;
8
- .interval = 5s;
9
- .window = 5;
10
- .threshold = 3;
11
- }
12
- }
13
-
14
- sub vcl_hit {
15
- # Called when a cache lookup is successful.
16
-
17
- if (obj.ttl >= 0s) {
18
- # A pure unadultered hit, deliver it
19
- return (deliver);
20
- }
21
-
22
- # https://www.varnish-cache.org/docs/trunk/users-guide/vcl-grace.html
23
- # When several clients are requesting the same page Varnish will send one request to the backend and place the others on hold while fetching one copy from the backend. In some products this is called request coalescing and Varnish does this automatically.
24
- # If you are serving thousands of hits per second the queue of waiting requests can get huge. There are two potential problems - one is a thundering herd problem - suddenly releasing a thousand threads to serve content might send the load sky high. Secondly - nobody likes to wait. To deal with this we can instruct Varnish to keep the objects in cache beyond their TTL and to serve the waiting requests somewhat stale content.
25
-
26
- # if (!std.healthy(req.backend_hint) && (obj.ttl + obj.grace > 0s)) {
27
- # return (deliver);
28
- # } else {
29
- # return (fetch);
30
- # }
31
-
32
- # We have no fresh fish. Lets look at the stale ones.
33
- if (std.healthy(req.backend_hint)) {
34
- # Backend is healthy. Limit age to 10s.
35
- if (obj.ttl + 10s > 0s) {
36
- #set req.http.grace = "normal(limited)";
37
- return (deliver);
38
- } else {
39
- # No candidate for grace. Fetch a fresh object.
40
- return(fetch);
41
- }
42
- } else {
43
- # backend is sick - use full grace
44
- if (obj.ttl + obj.grace > 0s) {
45
- #set req.http.grace = "full";
46
- return (deliver);
47
- } else {
48
- # no graced object.
49
- return (fetch);
50
- }
51
- }
52
-
53
- # fetch & deliver once we get the result
54
- return (fetch); # Dead code, keep as a safeguard
55
- }