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

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