viml/parser/expressions: Add support for ternary operator

This commit is contained in:
ZyX
2017-10-01 22:35:41 +03:00
parent 9e721031d5
commit 6144e26eb9
3 changed files with 705 additions and 39 deletions

View File

@@ -145,6 +145,7 @@ typedef enum {
kExprNodeMissing = 'X',
kExprNodeOpMissing = '_',
kExprNodeTernary = '?', ///< Ternary operator.
kExprNodeTernaryValue = 'C', ///< Ternary operator, colon.
kExprNodeRegister = '@', ///< Register.
kExprNodeSubscript = 's', ///< Subscript.
kExprNodeListLiteral = 'l', ///< List literal.
@@ -209,7 +210,10 @@ struct expr_ast_node {
/// Points to inside parser reader state.
const char *ident;
size_t ident_len; ///< Actual identifier length.
} var;
} var; ///< For kExprNodePlainIdentifier.
struct {
bool got_colon; ///< True if colon was seen.
} ter; ///< For kExprNodeTernaryValue.
} data;
};