aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-01-22 19:51:37 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-01-22 19:51:37 -0500
commit47cf8520adb245dbd34ad60fc9206b7eaab5e0be (patch)
treee2859d84e1dbf803b63bd3ac11014f7b3709f467 /src/parser.cpp
parent6a5e61acd117277eb2f943f5bc02ff7043542d4b (diff)
downloadzig-47cf8520adb245dbd34ad60fc9206b7eaab5e0be.tar.gz
zig-47cf8520adb245dbd34ad60fc9206b7eaab5e0be.zip
use comptime instead of inline for var and params
See #221
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index b0f909dc5d..569a23d130 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -250,7 +250,7 @@ static AstNode *ast_parse_type_expr(ParseContext *pc, size_t *token_index, bool
}
/*
-ParamDecl = option("noalias" | "inline") option("Symbol" ":") TypeExpr | "..."
+ParamDecl = option("noalias" | "comptime") option(Symbol ":") TypeExpr | "..."
*/
static AstNode *ast_parse_param_decl(ParseContext *pc, size_t *token_index) {
Token *token = &pc->tokens->at(*token_index);
@@ -266,7 +266,7 @@ static AstNode *ast_parse_param_decl(ParseContext *pc, size_t *token_index) {
node->data.param_decl.is_noalias = true;
*token_index += 1;
token = &pc->tokens->at(*token_index);
- } else if (token->id == TokenIdKeywordInline) {
+ } else if (token->id == TokenIdKeywordCompTime) {
node->data.param_decl.is_inline = true;
*token_index += 1;
token = &pc->tokens->at(*token_index);
@@ -1492,7 +1492,7 @@ static AstNode *ast_parse_defer_expr(ParseContext *pc, size_t *token_index) {
}
/*
-VariableDeclaration = option("inline") ("var" | "const") Symbol option(":" TypeExpr) "=" Expression
+VariableDeclaration = option("comptime") ("var" | "const") Symbol option(":" TypeExpr) "=" Expression
*/
static AstNode *ast_parse_variable_declaration_expr(ParseContext *pc, size_t *token_index, bool mandatory,
VisibMod visib_mod)
@@ -1501,9 +1501,9 @@ static AstNode *ast_parse_variable_declaration_expr(ParseContext *pc, size_t *to
Token *var_token;
bool is_const;
- bool is_inline;
- if (first_token->id == TokenIdKeywordInline) {
- is_inline = true;
+ bool is_comptime;
+ if (first_token->id == TokenIdKeywordCompTime) {
+ is_comptime = true;
var_token = &pc->tokens->at(*token_index + 1);
if (var_token->id == TokenIdKeywordVar) {
@@ -1518,12 +1518,12 @@ static AstNode *ast_parse_variable_declaration_expr(ParseContext *pc, size_t *to
*token_index += 2;
} else if (first_token->id == TokenIdKeywordVar) {
- is_inline = false;
+ is_comptime = false;
is_const = false;
var_token = first_token;
*token_index += 1;
} else if (first_token->id == TokenIdKeywordConst) {
- is_inline = false;
+ is_comptime = false;
is_const = true;
var_token = first_token;
*token_index += 1;
@@ -1535,7 +1535,7 @@ static AstNode *ast_parse_variable_declaration_expr(ParseContext *pc, size_t *to
AstNode *node = ast_create_node(pc, NodeTypeVariableDeclaration, var_token);
- node->data.variable_declaration.is_inline = is_inline;
+ node->data.variable_declaration.is_inline = is_comptime;
node->data.variable_declaration.is_const = is_const;
node->data.variable_declaration.visib_mod = visib_mod;