OILS / frontend / types.asdl View on Github | oilshell.org

61 lines, 29 significant
1# Types that don't depend on Id. (To break dependency)
2
3module types {
4 bool_arg_type = Undefined | Path | Int | Str | Other
5 redir_arg_type = Path | Desc | Here
6
7 opt_group = StrictAll | YshUpgrade | YshAll
8 generate [integers]
9
10 # Fifteen lexer modes for OSH
11
12 lex_mode =
13 Undefined
14 | Comment
15
16 # ShCommandFakeBrack (no regex list) is for lazy arg list []
17 | ShCommand | ShCommandFakeBrack
18
19 | Backtick # preprocessing before Outer
20 | DBracket
21
22 | SQ_Raw | DQ | SQ_C | J8_Str
23
24 | Arith
25 | ExtGlob
26 | VSub_1 | VSub_2 | VSub_ArgUnquoted | VSub_ArgDQ | VSub_Zsh
27
28 # BashRegexFakeInner (no regex list) is for parens in patterns
29 # [[ s =~ (< >) ]]
30 # the WordParser does a translation from BashRegex
31 | BashRegex | BashRegexFakeInner
32
33 | FuncParens # for Id.LookAhead_FuncParens
34
35 # Two for printf builtin
36 | PrintfOuter | PrintfPercent
37
38 # YSH/eggex both use Expr
39 | Expr # var x = 1 + 2 * 3; echo $f(a, b + 1)
40
41 # Unused. TODO: consider this representation
42 word_mode =
43 ShCommand # These three correspond to lex_mode
44 | ShCommandBrack # for lazy arg list assert [42 === x]
45
46 | DBracket
47 | BashRegex
48
49
50 # More possibilities
51 # - printf formatting ${x %05d}. I think that is mostly in expression mode
52 # like ${x|html} or ${x|title}
53
54 # CommandParser context
55 # Note: cmd_mode_e.Hay is better done with CommandParser.hay_attrs_stack,
56 # which is nested
57 cmd_mode =
58 Shell # Top level, and inside shell-style functions
59 | Func # Inside a func, return (x) is required
60 | Proc # Inside proc { } -- shell assignments are disallowed
61}