mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Hard limit of 127 characters for identifiers.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
- Typedefs and structs with inline types supporting lengthof would not work with lengthof #2641.
|
||||
- `$defined(foo())` now correctly errors if `foo()` would require a path.
|
||||
- `@if($defined((char*){}.foo()))` does not error if `foo` is missing.
|
||||
- Hard limit of 127 characters for identifiers.
|
||||
|
||||
### Stdlib changes
|
||||
- Add `ThreadPool` join function to wait for all threads to finish in the pool without destroying the threads.
|
||||
|
||||
@@ -52,6 +52,7 @@ typedef uint16_t FileId;
|
||||
#define MAX_GLOBAL_DECL_STACK (65536)
|
||||
#define MAX_MODULE_NAME 31
|
||||
#define MAX_MODULE_PATH 63
|
||||
#define MAX_IDENTIFIER_LENGTH 127
|
||||
#define MAX_MACRO_RECURSION_DEPTH 128
|
||||
#define MEMCMP_INLINE_REGS 8
|
||||
#define UINT128_MAX ((Int128) { UINT64_MAX, UINT64_MAX })
|
||||
|
||||
@@ -349,6 +349,10 @@ EXIT:;
|
||||
}
|
||||
return add_error_token(lexer, "An identifier may not consist of only '_' characters.");
|
||||
}
|
||||
if (len > MAX_IDENTIFIER_LENGTH)
|
||||
{
|
||||
return add_error_token(lexer, "An identifier cannot be longer than %d characters, but this one was %u characters long.", MAX_IDENTIFIER_LENGTH, len);
|
||||
}
|
||||
const char* interned_string = symtab_add(lexer->lexing_start, len, hash, &type);
|
||||
switch (type)
|
||||
{
|
||||
|
||||
8
test/test_suite/lexing/too_long_ident.c3
Normal file
8
test/test_suite/lexing/too_long_ident.c3
Normal file
@@ -0,0 +1,8 @@
|
||||
module test;
|
||||
import std;
|
||||
fn int main()
|
||||
{
|
||||
int iodeofjoiewjfojfoiejfewjfijewfijewifjoiewjfioewjfioewjfioewjfiojewfiojewfiojeofjeiowfjioewjfioewjfioewjfijweifefefeffefefeeefef = 0;
|
||||
int iodeofjoiewjfojfoiejfewjfijewfijewifjoiewjfioewjfioewjfioewjfiojewfiojewfiojeofjeiowfjioewjfioewjfioewjfijweifefefeffefefeeefef1 = 0; // #error: okfeokfe
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user