nixd
Loading...
Searching...
No Matches
TokenKinds.inc
Go to the documentation of this file.
1/// TokenKinds.inc, token names.
2
3/// provides: TOK(NAME), for all tokens.
4
5/// note: keyword tokens will be prefixed with kw_ and they are declared in
6/// TokenKeywords.inc
7
8// Keywords goes here, they are special identifiers.
9#ifdef TOK_KEYWORD
10
12TOK_KEYWORD(then)
13TOK_KEYWORD(else)
14TOK_KEYWORD(assert)
15TOK_KEYWORD(with)
16TOK_KEYWORD(let)
18TOK_KEYWORD(rec)
19TOK_KEYWORD(inherit)
21
22#endif // TOK_KEYWORD
23
24#ifdef TOK
25TOK(eof)
26
27// Identifier.
28TOK(id)
29
30// Numbers.
31TOK(int)
32TOK(float)
33
34// Strings.
35TOK(dquote)
36TOK(string_part)
37TOK(string_escape) // escaped string, e.g. \r \n \x \"
38
39TOK(quote2) // ''
40
41// Path.
42TOK(path_fragment)
43
44// <path>
45TOK(spath)
46
47// URI.
48TOK(uri)
49
50// Interpolation.
51TOK(r_curly) // {
52TOK(dollar_curly) // ${
53
54TOK(ellipsis) // ...
55TOK(comma) // ,
56TOK(dot) // .
57TOK(semi_colon) // ;
58TOK(eq) // =
59TOK(l_curly) // {
60TOK(l_paren) // (
61TOK(r_paren) // )
62TOK(l_bracket) // [
63TOK(r_bracket) // ]
64
65TOK(question) // ?
66TOK(at) // @
67TOK(colon) // :
68
69TOK(unknown)
70
71TOK(path_end) // emtpy token, notifies the parser it should exit parsing path.
72
73TOK(op_not) // !
74
75#endif // TOK
76
77// Binary Ops
78#ifdef TOK_BIN_OP
79
80TOK_BIN_OP(impl) // ->
81TOK_BIN_OP(or) // ||
82TOK_BIN_OP(and) // &&
83TOK_BIN_OP(eq) // ==
84TOK_BIN_OP(neq) // !=
85TOK_BIN_OP(lt) // <
86TOK_BIN_OP(gt) // >
87TOK_BIN_OP(le) // <=
88TOK_BIN_OP(ge) // >=
89TOK_BIN_OP(update) // //
90TOK_BIN_OP(add) // +
91TOK_BIN_OP(negate) // -
92TOK_BIN_OP(mul) // *
93TOK_BIN_OP(div) // /
94TOK_BIN_OP(concat) // ++
95
96// [RFC 0418 Pipe operator](https://github.com/NixOS/rfcs/pull/148)
97TOK_BIN_OP(pipe_into) // |>
98TOK_BIN_OP(pipe_from) // <|
99
100#endif // TOK_BIN_OP
#define TOK_KEYWORD(NAME)
#define TOK_BIN_OP(NAME)
#define TOK(NAME)
Definition TokenKinds.h:6