Krzesimir Nowak
7320f10de6
Fix tokenizer init
2026-03-08 12:09:12 +01:00
Krzesimir Nowak
8bdf82ac8d
Fix separating of diverging procedure types from block statements
...
To avoid creating a procedure literal from a procedure type and a
following block statement, one can insert a semicolon or an empty line
between the two:
// procedure literals
p1 :: proc() {…}
p2 :: proc()
{…}
// procedure type followed by a block statement
p3 :: proc()
{…}
The empty line as a separator did not work if the procedure type had a
diverging result:
// all of these are procedure literals
p4 :: proc() -> ! {…}
p5 :: proc() -> !
{…}
p6 :: proc() -> !
{…}
The least annoying fix I came up with is to insert implicit semicolon
after the "not" token. I only needed to make sure that the inserted
implicit semicolon is being skipped when the "not" token is a part of
unary expression to avoid breaking an oddly-formatted code like:
b := get_some_bool()
if !
b {…}
One small side-effect of this change is that in code like below:
Proc_Type :: proc() -> !
// Some comment
Some_Other_Type :: enum byte {…}
The "// Some comment" is not associated with "Proc_Type" anymore. In
Odin's standard library this only happens in one place, in
`base/runtime/core.odin`:
Assertion_Failure_Proc :: #type proc(prefix, message: string, loc: Source_Code_Location) -> !
// Allocation Stuff
Allocator_Mode :: enum byte {
Alloc,
…,
}
2026-03-01 14:49:24 +01:00
Feoramund
3c1201fb2c
Error on unterminated multi-line comment
2025-05-29 18:28:54 -04:00
Karl Zylinski
f9de8fdaba
Documentation typo fix in tokenizer.
2024-09-09 21:51:34 +02:00
Karl Zylinski
dc767da12b
Make tags use #+ syntax instead of //+ syntax so it no longer looks like a comment. Old style still works but is deprecated with a warning. Using unknown tags is now an error instead of a warning. There is a new token for #+ which consumes the whole line (or until it hits a comment). The tags are parsed like before. There are errors to tell you if you use something invalid in the pre-package-line block.
2024-09-08 01:50:56 +02:00
gingerBill
fb0b95bcad
Merge pull request #3760 from Feoramund/refactor-show-error-on-line
...
Refactor `show_error_on_line`
2024-07-01 11:03:29 +01:00
gingerBill
35651cfc17
Improve tokenization for false integer literals but not effect possible float literals
2024-06-28 09:24:34 +01:00
gingerBill
dde7cb6e7f
Improve error message for #3754
2024-06-28 09:21:33 +01:00
gingerBill
862a04376f
Improve tokenizing wrong number literals
2024-06-28 09:16:01 +01:00
Feoramund
582154f20d
Remove unused code from tokenizer
2024-06-14 15:44:50 -04:00
Feoramund
29987c20c0
Fix invalid rune literal reported twice
...
The tokenizer and the parser were reporting it in different positions.
This way, they'll report in the same spot.
2024-04-28 07:02:21 -04:00
gingerBill
46b9bd8c0e
Improve error messages for switch and for r-values with a suggestion
2024-04-12 13:35:14 +01:00
gingerBill
213b2fd0f8
Add bit_field as a keyword
2024-02-22 14:01:23 +00:00
gingerBill
648b83d6ea
Add or_break and or_continue constructs
2023-09-30 15:04:17 +01:00
gingerBill
69e1f42aed
Replace a lot of warnings with errors; remove deprecated stuff
2023-08-01 11:11:15 +01:00
gingerBill
8bf32ac697
Minor change to handling of propagation of errors with --- as a value
2023-05-22 12:53:29 +01:00
gingerBill
ac5f5a33e9
gb_internal a lot
2022-12-18 21:17:07 +00:00
gingerBill
081a5a52a6
Add ODIN_ERROR_POS_STYLE environment variable
...
Allowing for two different error message styles:
default or odin
path(line:column) message
unix
path:line:column: message
2022-01-26 16:09:22 +00:00
gingerBill
6f3e450c50
Move error handling code to a separate file
2022-01-10 14:03:36 +00:00
gingerBill
5e2280a787
Fix set_file_path_string and thread_safe_set_ast_file_from_id
2021-11-24 16:20:01 +00:00
gingerBill
e814a3693f
Improve usage of file_id
2021-11-15 17:26:01 +00:00
gingerBill
1556fad65a
Change syntax for matrices to matrix[R, C]T
2021-10-19 11:31:11 +01:00
gingerBill
2ad6aa7886
Copying file contents rather than memory mapping
2021-10-12 11:06:39 +01:00
gingerBill
05ac2002e0
Force file copy on odin strip-semicolon
2021-09-18 12:52:43 +01:00
gingerBill
3713f11461
Refactor init_tokenizer_with_data to file memory mapping (Windows only currently)
2021-09-18 11:58:27 +01:00
gingerBill
042dbda47f
Replace many uses of heap_allocator() with permanent_allocator()
2021-09-13 01:30:30 +01:00
gingerBill
0434281f73
Strip semicolons; Make odin strip-semicolon replace .. with ..= if used as a binary operator
2021-09-06 20:15:59 +01:00
gingerBill
1fff96e088
Make -insert-semicolon the default now
2021-08-31 21:13:53 +01:00
gingerBill
b88e945268
ERROR_BLOCK() any usages of "Did you mean?" like behaviour whilst iterating across a scope entry map
2021-08-27 12:14:51 +01:00
gingerBill
da79124e5d
Use local mutex for each AstFile.arena
2021-08-26 23:10:15 +01:00
gingerBill
bd86993035
Remove the old inline and no_inline tokens
2021-08-23 12:37:42 +01:00
gingerBill
35026000bb
Fix deadlock caused by typo
2021-08-19 11:40:26 +01:00
gingerBill
b8661e0ae0
Update semi-colon insertion rules for or_return
2021-08-15 17:16:37 +01:00
gingerBill
21cbac755e
Make or_else and or_return operators (binary and suffix respectively)
2021-08-15 17:14:35 +01:00
gingerBill
799a56bbcb
Fix column in tokenizer (due to removed line)
2021-08-13 10:50:05 +01:00
gingerBill
5fd64f48ee
Minor procedure rename
2021-08-08 12:48:44 +01:00
gingerBill
a3b7126875
Simplify init_tokenizer_with_data
2021-08-08 12:47:45 +01:00
gingerBill
000bda8419
Reduce superfluous error messages for return statements expecting not-1 return values
2021-08-07 16:29:00 +01:00
gingerBill
545b345eea
Remove optimizations in tokenizer and default to older code (same logic) (optimize later)
2021-08-03 13:33:01 +01:00
gingerBill
b0e64ca7e8
Prepare tokenizer for optimizations
2021-08-02 16:47:32 +01:00
gingerBill
7f3d4cb504
Remove the literal conversion logic to the parser from the tokenizer
2021-08-02 00:53:45 +01:00
gingerBill
97be36d18a
Replace line with column_minus_one in Tokenizer; Remove dead code
2021-08-02 00:26:54 +01:00
gingerBill
be76da2c90
Begin optimizing tokenizer; Replace gb_utf8_decode with utf8_decode (CC but easier to change later)
2021-08-01 23:56:17 +01:00
gingerBill
b1a8357f50
Clean up a bit of the tokenizer code so that the semicolon insertion rules are in one place
2021-08-01 22:41:00 +01:00
gingerBill
700624119b
Give begin_error_block its own recursive mutex
2021-07-29 12:35:11 +01:00
gingerBill
a5d6fda433
Define which mutexes are blocking and recursive explicitly
2021-07-27 23:14:01 +01:00
gingerBill
a98eee145d
Remove try; Replace try x else y with or_else(x, y)
2021-07-05 16:23:13 +01:00
gingerBill
4b831dbddd
Try try and or_else built-in procedures with operators try and try else
2021-07-04 12:37:21 +01:00
gingerBill
11c565e199
Fix semicolon insertion rule for ---
2021-06-26 22:47:12 +01:00
gingerBill
9c54ed5792
Add range-based error messages to -verbose-errors
...
Example:
Cannot convert '(1 + 2)' to 'untyped bool' from 'untyped integer'
x := (1 + 2) * true;
^~~~~~^
2021-05-19 14:15:57 +01:00