Re: Structure initializer VS lambda function

2023-02-19 Thread realhet via Digitalmars-d-learn
Hi again and thanks for the suggestions. I ended up checking every {} block with the following program: It works on a string where all the nested blocks are reduced to a single symbol. For example: '{', '"', '[' And all the comments and whitespaces are reduced to ' ' space. ``` enum CurlyBlock

Re: Structure initializer VS lambda function

2022-12-12 Thread Tim via Digitalmars-d-learn
On Monday, 12 December 2022 at 08:54:33 UTC, realhet wrote: 1. checking inside (on the first hierarchy level inside {}) , => must be a struct initializer ; => must be a lambda no , and no ; => check it from the outside Some statements don't end in a semicolon, so you would also ne

Re: Structure initializer VS lambda function

2022-12-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/12/22 3:54 AM, realhet wrote: Hi, I'm writing a DLang parser and got confused of this. What is a good way to distinguish lambda functions and structure initialization blocks. Both of them are {} blocks. I'm thinking of something like this: 1. checking inside (on the first hierarchy le