notepad-plus-plus/lexilla/test/examples/bash/Nested.bsh

78 lines
1.0 KiB
Plaintext
Raw Normal View History

Update: Scintilla 5.3.5 Lexilla 5.2.5 update to Scinitlla Release 5.3.5 (https://www.scintilla.org/scintilla535.zip) Released 31 May 2023. On Win32, implement IME context sensitivity with IMR_DOCUMENTFEED. Feature #1310. On Win32 remove dependence on MSIMG32.DLL by replacing AlphaBlend by GdiAlphaBlend. Bug #1923. On Qt, stop movement of IME candidate box. On Qt, report correct caret position within paragraph for IME retrieve surrounding text. On Qt for Cocoa, fix crash in entry of multi-character strings with IME. and Lexilla Release 5.2.5 (https://www.scintilla.org/lexilla525.zip) Released 31 May 2023. Add CharacterSetArray constructor without setBase initial argument for common case where this is setNone and the initialSet argument completely defines the characters. This shortens and clarifies use of CharacterSetArray. Bash: implement highlighting inside quoted elements and here-docs. Controlled with properties lexer.bash.styling.inside.string, lexer.bash.styling.inside.backticks, lexer.bash.styling.inside.parameter, and lexer.bash.styling.inside.heredoc. Issue #154, Issue #153, Feature #1033. Bash: add property lexer.bash.command.substitution to choose how to style command substitutions. 0 → SCE_SH_BACKTICKS; 1 → surrounding "$(" and ")" as operators and contents styled as bash code; 2 → use distinct styles (base style + 64) for contents. Choice (2) is a provisional feature and details may change before it is finalized. Issue #153. Bash: fix nesting of parameters (SCE_SH_PARAM) like ${var/$sub/"${rep}}"}. Issue #154. Bash: fix single character special parameters like $? by limiting style. Issue #154. Bash: treat "$$" as special parameter and end scalars before "$". Issue #154. Bash: treat "<<" in arithmetic contexts as left bitwise shift operator instead of here-doc. Issue #137. Batch: style SCE_BAT_AFTER_LABEL used for rest of line after label which is not executed. Issue #148. F#: Lex interpolated verbatim strings as verbatim. Issue #156. VB: allow multiline strings when lexer.vb.strings.multiline set. Issue #151. Close #13729
2023-05-31 23:11:12 +00:00
# Nested elements and other complex cases
# String with backtick inclusion
"x`ls`"
# Nested string
"x`ls "*.c"`"
# Not terminated at first "
"x`ls" # "`" #
# String with command inclusion
"x$(ls)"
# Nested command
$(ls -la$(ls *.c))
# Check strings and backticks in command
echo $('ls' "." `ls` $'.' $".")
# $( not terminated by ) if contains unterminated string
$('x) # ') #
$("x) # ") #
$(`x) # `) # Bash doesn't like this
$($'x) # ') #
$($"x) # ") #
# Parameter expansion
var=abcdef
sub=abc
rep='& '
echo ${var/$sub/"${rep}}"} #
# '$' in variable
echo $$PID
echo $var${var}
# Here-doc with internal elements
cat <<EOF
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
EOF
# Quoted delimiter treats here-doc as simple string
cat <<"EOF"
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
EOF
# Escaped same as quoted
cat <<\EOF
$scalar
EOF
# Nesting
echo "$((1 + 2))" #
echo "$[1 + 2]" #
# Multiple nesting levels
$(ls -la$(ls $(c) $'*.c' ` $(${s})`))
# Multi-line
$(ls |
more)
$(
`x`
"x"
`ls`
$'x'
$"x"
)
#end -- checks termination of previous