re2d lexer generator

Ulya skvadrik at gmail.com
Mon Nov 25 21:33:35 UTC 2024


On Monday, 25 November 2024 at 19:18:40 UTC, Sergey wrote:
> On Monday, 25 November 2024 at 16:01:54 UTC, Ulya wrote:
>> a special kind of deterministic finite automata: [lookahead 
>> TDFA](http://re2c.org/2022_borsotti_trofimovich_a_closer_look_at_tdfa.pdf). These automata are as fast as ordinary DFA, but they are also capable of performing submatch extraction with minimal overhead.
>>
>> There is a [detailed user 
>> guide](http://re2c.org/manual/manual_d.html) an [online 
>> playground](http://re2c.org/playground/?example=d/01_basic.re) 
>> with many examples.
>
> Hi Ulya. I don't have an account on LOR so glad you wrote here 
> :)
>
> Based on some examples from the playground it seems re2c is 
> inserting `#line` directives.
> I think it is not supported by D lang.
>
> I've checked for example 'reuse.re'

Hi Sergey :)

I believe `#line` directives are supported, as described here: 
https://dlang.org/spec/lex.html#special-token-sequence.

All examples are compiled with `dmd -g -wi` and tested that they 
produce the expected output: 
https://github.com/skvadrik/re2c/blob/master/examples/d/__run_all.sh#L26.

It is possible to disable line directives for an individual file 
using `-i`, or disable them globally with [this setting in syntax 
file](https://github.com/skvadrik/re2c/blob/master/include/syntax/d#L31).


More information about the Digitalmars-d-announce mailing list