aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-12-16 20:18:23 +0000
committerGinger Bill <bill@gingerbill.org>2016-12-16 20:18:23 +0000
commitd4457e9fa4cfb3a62beaf30e72bffcdea6a0c52b (patch)
treef4a700c969ec7b50943b31935d01e43c78102bed /src
parent9634b28b0723a42463ba6f2879ff533ea2c7cb14 (diff)
Minor changes
Diffstat (limited to 'src')
-rw-r--r--src/checker/checker.c6
-rw-r--r--src/parser.c9
-rw-r--r--src/tokenizer.c11
3 files changed, 16 insertions, 10 deletions
diff --git a/src/checker/checker.c b/src/checker/checker.c
index 12982f1ac..3e0606d6a 100644
--- a/src/checker/checker.c
+++ b/src/checker/checker.c
@@ -193,9 +193,9 @@ gb_global ImplicitValueInfo implicit_value_infos[ImplicitValue_Count] = {0};
typedef struct CheckerContext {
- Scope * scope;
- DeclInfo *decl;
- u32 stmt_state_flags;
+ Scope * scope;
+ DeclInfo * decl;
+ u32 stmt_state_flags;
} CheckerContext;
#define MAP_TYPE TypeAndValue
diff --git a/src/parser.c b/src/parser.c
index b075f79e6..b12da1feb 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -2070,7 +2070,7 @@ AstNode *parse_proc_type(AstFile *f) {
}
-AstNodeArray parse_parameter_list(AstFile *f) {
+AstNodeArray parse_parameter_list(AstFile *f, bool allow_using) {
AstNodeArray params = make_ast_node_array(f);
while (f->curr_token.kind == Token_Ident ||
@@ -2090,6 +2090,11 @@ AstNodeArray parse_parameter_list(AstFile *f) {
is_using = false;
}
+ if (!allow_using && is_using) {
+ syntax_error(f->curr_token, "`using` is not allowed within this parameter list");
+ is_using = false;
+ }
+
expect_token_after(f, Token_Colon, "parameter list");
AstNode *type = NULL;
@@ -2405,7 +2410,7 @@ Token parse_proc_signature(AstFile *f,
AstNodeArray *results) {
Token proc_token = expect_token(f, Token_proc);
expect_token(f, Token_OpenParen);
- *params = parse_parameter_list(f);
+ *params = parse_parameter_list(f, true);
expect_token_after(f, Token_CloseParen, "parameter list");
*results = parse_results(f);
return proc_token;
diff --git a/src/tokenizer.c b/src/tokenizer.c
index 1839abdc2..1e41b17f7 100644
--- a/src/tokenizer.c
+++ b/src/tokenizer.c
@@ -4,11 +4,11 @@
TOKEN_KIND(Token_Comment, "Comment"), \
\
TOKEN_KIND(Token__LiteralBegin, "_LiteralBegin"), \
- TOKEN_KIND(Token_Ident, "Identifier"), \
- TOKEN_KIND(Token_Integer, "Integer"), \
- TOKEN_KIND(Token_Float, "Float"), \
- TOKEN_KIND(Token_Rune, "Rune"), \
- TOKEN_KIND(Token_String, "String"), \
+ TOKEN_KIND(Token_Ident, "identifier"), \
+ TOKEN_KIND(Token_Integer, "integer"), \
+ TOKEN_KIND(Token_Float, "float"), \
+ TOKEN_KIND(Token_Rune, "rune"), \
+ TOKEN_KIND(Token_String, "string"), \
TOKEN_KIND(Token__LiteralEnd, "_LiteralEnd"), \
\
TOKEN_KIND(Token__OperatorBegin, "_OperatorBegin"), \
@@ -87,6 +87,7 @@ TOKEN_KIND(Token__KeywordBegin, "_KeywordBegin"), \
/* TOKEN_KIND(Token_import, "import"), */\
/* TOKEN_KIND(Token_include, "include"), */\
TOKEN_KIND(Token_proc, "proc"), \
+ TOKEN_KIND(Token_macro, "macro"), \
TOKEN_KIND(Token_match, "match"), \
TOKEN_KIND(Token_break, "break"), \
TOKEN_KIND(Token_continue, "continue"), \