OILS / _devbuild / help / ysh-expr-lang View on Github | oilshell.org

49 lines, 46 significant
1
2 Expression Language and Assignments <a class="group-link" href="chap-expr-lang.html">expr-lang</a>
3
4
5 [Assignment] assign =
6 aug-assign += -= *= /= **= //= %=
7 &= |= ^= <<= >>=
8 [Literals] atom-literal true false null
9 int-literal 42 65_536 0xFF 0o755 0b10
10 float-lit 3.14 1.5e-10
11 char-literal \\ \t \" \y00 \u{3bc}
12 X num-suffix 42 K Ki M Mi G Gi T Ti / ms us
13 ysh-string "x is $x" $"x is $x" r'[a-z]\n'
14 u'line\n' b'byte \yff'
15 triple-quoted """ $""" r''' u''' b'''
16 str-template ^"$a and $b" for Str::replace()
17 list-literal ['one', 'two', 3] :| unquoted words |
18 dict-literal {name: 'bob'} {a, b}
19 range 1 .. n+1
20 block-expr ^(echo $PWD)
21 expr-literal ^[1 + 2*3]
22 X expr-sub $[myobj]
23 X expr-splice @[myobj]
24 [Operators] op-precedence Like Python
25 concat s1 ++ s2, L1 ++ L2
26 ysh-equals === !== ~== is, is not
27 ysh-in in, not in
28 ysh-compare < <= > >= (numbers only)
29 ysh-logical not and or
30 ysh-arith + - * / // % **
31 ysh-bitwise ~ & | ^ << >>
32 ysh-ternary '+' if x >= 0 else '-'
33 ysh-index s[0] mylist[3] mydict['key']
34 ysh-attr mydict.key
35 ysh-slice a[1:-1] s[1:-1]
36 func-call f(x, y; ...named)
37 thin-arrow mylist->pop()
38 fat-arrow mystr => startsWith('prefix')
39 match-ops ~ !~ ~~ !~~
40 [Eggex] re-literal / d+ ; re-flags ; ERE /
41 re-primitive %zero 'sq'
42 class-literal [c a-z 'abc' @str_var \\ \xFF \u{3bc}]
43 named-class dot digit space word d s w
44 re-repeat d? d* d+ d{3} d{2,4}
45 re-compound seq1 seq2 alt1|alt2 (expr1 expr2)
46 re-capture <capture d+ as name: int>
47 re-splice Subpattern @subpattern
48 re-flags reg_icase reg_newline
49 X re-multiline ///