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

56 lines, 30 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 | ShCommand
17 | ShCommandBrack # pseudo lexer mode for lazy arg list
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
27 | BashRegex | BashRegexChars
28 | FuncParens # for Id.LookAhead_FuncParens
29
30 # Two for printf builtin
31 | PrintfOuter | PrintfPercent
32
33 # YSH/eggex both use Expr
34 | Expr # var x = 1 + 2 * 3; echo $f(a, b + 1)
35
36 # Unused. TODO: consider this representation
37 word_mode =
38 ShCommand # These three correspond to lex_mode
39 | ShCommandBrack # for lazy arg list assert [42 === x]
40
41 | DBracket
42 | BashRegex
43
44
45 # More possibilities
46 # - printf formatting ${x %05d}. I think that is mostly in expression mode
47 # like ${x|html} or ${x|title}
48
49 # CommandParser context
50 # Note: cmd_mode_e.Hay is better done with CommandParser.hay_attrs_stack,
51 # which is nested
52 cmd_mode =
53 Shell # Top level, and inside shell-style functions
54 | Func # Inside a func, return (x) is required
55 | Proc # Inside proc { } -- shell assignments are disallowed
56}