aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/viml/parser/expressions.h
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-09-28 00:40:25 +0300
committerZyX <kp-pav@yandex.ru>2017-10-08 22:25:08 +0300
commit9fa8f7fc0a24371f7956450d840bdae8a2fc9a51 (patch)
treec561ac7b67b68a811873834fafa4fa5f423fd384 /src/nvim/viml/parser/expressions.h
parent0987d3b10f36202e9f0289b50298e69aaf2fa4d2 (diff)
downloadrneovim-9fa8f7fc0a24371f7956450d840bdae8a2fc9a51.tar.gz
rneovim-9fa8f7fc0a24371f7956450d840bdae8a2fc9a51.tar.bz2
rneovim-9fa8f7fc0a24371f7956450d840bdae8a2fc9a51.zip
viml/parser/expressions: Add a way to adjust lexer
It also adds support for kExprLexOr which for some reason was forgotten. It was only made sure that KLEE test compiles in non-KLEE mode, not that something works or that KLEE is able to run tests.
Diffstat (limited to 'src/nvim/viml/parser/expressions.h')
-rw-r--r--src/nvim/viml/parser/expressions.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/nvim/viml/parser/expressions.h b/src/nvim/viml/parser/expressions.h
index 13640ec137..64abab9e41 100644
--- a/src/nvim/viml/parser/expressions.h
+++ b/src/nvim/viml/parser/expressions.h
@@ -109,9 +109,37 @@ typedef struct {
LexExprTokenType type; ///< Suggested type for parsing incorrect code.
const char *msg; ///< Error message.
} err; ///< For kExprLexInvalid
+
+ struct {
+ bool is_float; ///< True if number is a floating-point.
+ } num; ///< For kExprLexNumber
} data; ///< Additional data, if needed.
} LexExprToken;
+typedef enum {
+ /// If set, “pointer” to the current byte in pstate will not be shifted
+ kELFlagPeek = (1 << 0),
+ /// Determines whether scope is allowed to come before the identifier
+ kELFlagForbidScope = (1 << 1),
+ /// Determines whether floating-point numbers are allowed
+ ///
+ /// I.e. whether dot is a decimal point separator or is not a part of
+ /// a number at all.
+ kELFlagAllowFloat = (1 << 2),
+ /// Determines whether `is` and `isnot` are seen as comparison operators
+ ///
+ /// If set they are supposed to be just regular identifiers.
+ kELFlagIsNotCmp = (1 << 3),
+ /// Determines whether EOC tokens are allowed
+ ///
+ /// If set then it will yield Invalid token with E15 in place of EOC one if
+ /// “EOC” is something like "|". It is fine with emitting EOC at the end of
+ /// string still, with or without this flag set.
+ kELFlagForbidEOC = (1 << 4),
+ // WARNING: whenever you add a new flag, alter klee_assume() statement in
+ // viml_expressions_lexer.c.
+} LexExprFlags;
+
/// Expression AST node type
typedef enum {
kExprNodeMissing = 'X',