11// @ts -nocheck
22bash . displayName = 'bash'
3- bash . aliases = [ 'shell' ]
3+ bash . aliases = [ 'sh' , ' shell']
44
55/** @type {import('../core.js').Syntax } */
66export default function bash ( Prism ) {
@@ -108,7 +108,7 @@ export default function bash(Prism) {
108108 // Highlight variable names as variables in the left-hand part
109109 // of assignments (“=” and “+=”).
110110 'assign-left' : {
111- pattern : / ( ^ | [ \s ; | & ] | [ < > ] \( ) \w + (? = \+ ? = ) / ,
111+ pattern : / ( ^ | [ \s ; | & ] | [ < > ] \( ) \w + (?: \. \w + ) * (? = \+ ? = ) / ,
112112 inside : {
113113 environment : {
114114 pattern : RegExp ( '(^|[\\s;|&]|[<>]\\()' + envVars ) ,
@@ -119,6 +119,12 @@ export default function bash(Prism) {
119119 alias : 'variable' ,
120120 lookbehind : true
121121 } ,
122+ // Highlight parameter names as variables
123+ parameter : {
124+ pattern : / ( ^ | \s ) - { 1 , 2 } (?: \w + : [ + - ] ? ) ? \w + (?: \. \w + ) * (? = [ = \s ] | $ ) / ,
125+ alias : 'variable' ,
126+ lookbehind : true
127+ } ,
122128 string : [
123129 // Support for Here-documents https://en.wikipedia.org/wiki/Here_document
124130 {
@@ -166,7 +172,7 @@ export default function bash(Prism) {
166172 variable : insideString . variable ,
167173 function : {
168174 pattern :
169- / ( ^ | [ \s ; | & ] | [ < > ] \( ) (?: a d d | a p r o p o s | a p t | a p t - c a c h e | a p t - g e t | a p t i t u d e | a s p e l l | a u t o m y s q l b a c k u p | a w k | b a s e n a m e | b a s h | b c | b c o n s o l e | b g | b z i p 2 | c a l | c a t | c f d i s k | c h g r p | c h k c o n f i g | c h m o d | c h o w n | c h r o o t | c k s u m | c l e a r | c m p | c o l u m n | c o m m | c o m p o s e r | c p | c r o n | c r o n t a b | c s p l i t | c u r l | c u t | d a t e | d c | d d | d d r e s c u e | d e b o o t s t r a p | d f | d i f f | d i f f 3 | d i g | d i r | d i r c o l o r s | d i r n a m e | d i r s | d m e s g | d o c k e r | d o c k e r - c o m p o s e | d u | e g r e p | e j e c t | e n v | e t h t o o l | e x p a n d | e x p e c t | e x p r | f d f o r m a t | f d i s k | f g | f g r e p | f i l e | f i n d | f m t | f o l d | f o r m a t | f r e e | f s c k | f t p | f u s e r | g a w k | g i t | g p a r t e d | g r e p | g r o u p a d d | g r o u p d e l | g r o u p m o d | g r o u p s | g r u b - m k c o n f i g | g z i p | h a l t | h e a d | h g | h i s t o r y | h o s t | h o s t n a m e | h t o p | i c o n v | i d | i f c o n f i g | i f d o w n | i f u p | i m p o r t | i n s t a l l | i p | j o b s | j o i n | k i l l | k i l l a l l | l e s s | l i n k | l n | l o c a t e | l o g n a m e | l o g r o t a t e | l o o k | l p c | l p r | l p r i n t | l p r i n t d | l p r i n t q | l p r m | l s | l s o f | l y n x | m a k e | m a n | m c | m d a d m | m k c o n f i g | m k d i r | m k e 2 f s | m k f i f o | m k f s | m k i s o f s | m k n o d | m k s w a p | m m v | m o r e | m o s t | m o u n t | m t o o l s | m t r | m u t t | m v | n a n o | n c | n e t s t a t | n i c e | n l | n o d e | n o h u p | n o t i f y - s e n d | n p m | n s l o o k u p | o p | o p e n | p a r t e d | p a s s w d | p a s t e | p a t h c h k | p i n g | p k i l l | p n p m | p o d m a n | p o d m a n - c o m p o s e | p o p d | p r | p r i n t c a p | p r i n t e n v | p s | p u s h d | p v | q u o t a | q u o t a c h e c k | q u o t a c t l | r a m | r a r | r c p | r e b o o t | r e m s y n c | r e n a m e | r e n i c e | r e v | r m | r m d i r | r p m | r s y n c | s c p | s c r e e n | s d i f f | s e d | s e n d m a i l | s e q | s e r v i c e | s f t p | s h | s h e l l c h e c k | s h u f | s h u t d o w n | s l e e p | s l o c a t e | s o r t | s p l i t | s s h | s t a t | s t r a c e | s u | s u d o | s u m | s u s p e n d | s w a p o n | s y n c | t a c | t a i l | t a r | t e e | t i m e | t i m e o u t | t o p | t o u c h | t r | t r a c e r o u t e | t s o r t | t t y | u m o u n t | u n a m e | u n e x p a n d | u n i q | u n i t s | u n r a r | u n s h a r | u n z i p | u p d a t e - g r u b | u p t i m e | u s e r a d d | u s e r d e l | u s e r m o d | u s e r s | u u d e c o d e | u u e n c o d e | v | v c p k g | v d i r | v i | v i m | v i r s h | v m s t a t | w a i t | w a t c h | w c | w g e t | w h e r e i s | w h i c h | w h o | w h o a m i | w r i t e | x a r g s | x d g - o p e n | y a r n | y e s | z e n i t y | z i p | z s h | z y p p e r ) (? = $ | [ ) \s ; | & ] ) / ,
175+ / ( ^ | [ \s ; | & ] | [ < > ] \( ) (?: a d d | a p r o p o s | a p t | a p t - c a c h e | a p t - g e t | a p t i t u d e | a s p e l l | a u t o m y s q l b a c k u p | a w k | b a s e n a m e | b a s h | b c | b c o n s o l e | b g | b z i p 2 | c a l | c a r g o | c a t | c f d i s k | c h g r p | c h k c o n f i g | c h m o d | c h o w n | c h r o o t | c k s u m | c l e a r | c m p | c o l u m n | c o m m | c o m p o s e r | c p | c r o n | c r o n t a b | c s p l i t | c u r l | c u t | d a t e | d c | d d | d d r e s c u e | d e b o o t s t r a p | d f | d i f f | d i f f 3 | d i g | d i r | d i r c o l o r s | d i r n a m e | d i r s | d m e s g | d o c k e r | d o c k e r - c o m p o s e | d u | e g r e p | e j e c t | e n v | e t h t o o l | e x p a n d | e x p e c t | e x p r | f d f o r m a t | f d i s k | f g | f g r e p | f i l e | f i n d | f m t | f o l d | f o r m a t | f r e e | f s c k | f t p | f u s e r | g a w k | g i t | g p a r t e d | g r e p | g r o u p a d d | g r o u p d e l | g r o u p m o d | g r o u p s | g r u b - m k c o n f i g | g z i p | h a l t | h e a d | h g | h i s t o r y | h o s t | h o s t n a m e | h t o p | i c o n v | i d | i f c o n f i g | i f d o w n | i f u p | i m p o r t | i n s t a l l | i p | j a v a | j o b s | j o i n | k i l l | k i l l a l l | l e s s | l i n k | l n | l o c a t e | l o g n a m e | l o g r o t a t e | l o o k | l p c | l p r | l p r i n t | l p r i n t d | l p r i n t q | l p r m | l s | l s o f | l y n x | m a k e | m a n | m c | m d a d m | m k c o n f i g | m k d i r | m k e 2 f s | m k f i f o | m k f s | m k i s o f s | m k n o d | m k s w a p | m m v | m o r e | m o s t | m o u n t | m t o o l s | m t r | m u t t | m v | n a n o | n c | n e t s t a t | n i c e | n l | n o d e | n o h u p | n o t i f y - s e n d | n p m | n s l o o k u p | o p | o p e n | p a r t e d | p a s s w d | p a s t e | p a t h c h k | p i n g | p k i l l | p n p m | p o d m a n | p o d m a n - c o m p o s e | p o p d | p r | p r i n t c a p | p r i n t e n v | p s | p u s h d | p v | q u o t a | q u o t a c h e c k | q u o t a c t l | r a m | r a r | r c p | r e b o o t | r e m s y n c | r e n a m e | r e n i c e | r e v | r m | r m d i r | r p m | r s y n c | s c p | s c r e e n | s d i f f | s e d | s e n d m a i l | s e q | s e r v i c e | s f t p | s h | s h e l l c h e c k | s h u f | s h u t d o w n | s l e e p | s l o c a t e | s o r t | s p l i t | s s h | s t a t | s t r a c e | s u | s u d o | s u m | s u s p e n d | s w a p o n | s y n c | s y s c t l | t a c | t a i l | t a r | t e e | t i m e | t i m e o u t | t o p | t o u c h | t r | t r a c e r o u t e | t s o r t | t t y | u m o u n t | u n a m e | u n e x p a n d | u n i q | u n i t s | u n r a r | u n s h a r | u n z i p | u p d a t e - g r u b | u p t i m e | u s e r a d d | u s e r d e l | u s e r m o d | u s e r s | u u d e c o d e | u u e n c o d e | v | v c p k g | v d i r | v i | v i m | v i r s h | v m s t a t | w a i t | w a t c h | w c | w g e t | w h e r e i s | w h i c h | w h o | w h o a m i | w r i t e | x a r g s | x d g - o p e n | y a r n | y e s | z e n i t y | z i p | z s h | z y p p e r ) (? = $ | [ ) \s ; | & ] ) / ,
170176 lookbehind : true
171177 } ,
172178 keyword : {
@@ -215,6 +221,7 @@ export default function bash(Prism) {
215221 'function-name' ,
216222 'for-or-select' ,
217223 'assign-left' ,
224+ 'parameter' ,
218225 'string' ,
219226 'environment' ,
220227 'function' ,
@@ -232,6 +239,7 @@ export default function bash(Prism) {
232239 inside [ toBeCopied [ i ] ] = Prism . languages . bash [ toBeCopied [ i ] ]
233240 }
234241
242+ Prism . languages . sh = Prism . languages . bash
235243 Prism . languages . shell = Prism . languages . bash
236244 } ) ( Prism )
237245}
0 commit comments