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

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