Re: How to select the regex that matches the first token of a string?

2021-07-03 Thread vnr via Digitalmars-d-learn
On Saturday, 3 July 2021 at 09:28:32 UTC, user1234 wrote: On Saturday, 3 July 2021 at 09:05:28 UTC, vnr wrote: Hello, I am trying to make a small generic lexer that bases its token analysis on regular expressions. The principle I have in mind is to define a token type table with its correspon

Re: How to select the regex that matches the first token of a string?

2021-07-03 Thread user1234 via Digitalmars-d-learn
On Saturday, 3 July 2021 at 09:05:28 UTC, vnr wrote: Hello, I am trying to make a small generic lexer that bases its token analysis on regular expressions. The principle I have in mind is to define a token type table with its corresponding regular expression, here is the code I currently have

How to select the regex that matches the first token of a string?

2021-07-03 Thread vnr via Digitalmars-d-learn
Hello, I am trying to make a small generic lexer that bases its token analysis on regular expressions. The principle I have in mind is to define a token type table with its corresponding regular expression, here is the code I currently have: ```d import std.regex; /// ditto struct Token {