rust-analyzer / rowan

Apache License 2.0
715 stars 61 forks source link

making use of logos instead of m_lexer in #examples #147

Closed dzmitry-lahoda closed 1 year ago

dzmitry-lahoda commented 1 year ago

because logos seems standard lexer in rust crates :)

so this makes examples more approachable for newcomers and more production ready

matklad commented 1 year ago

I’d rather avoid heavy deps here, my prefenrce would be to use either something super simple (m_lexer), or just to hand-write stuff.

dzmitry-lahoda commented 1 year ago

logos is simple. i mean it is simplier then m_regex for me. easy to read. less code. no need to learn m_regex to understand rowan. and heavy dep is heavy in example, not in release.

matklad commented 1 year ago

Logos is a proc macro, I want to avoid that.

dzmitry-lahoda commented 1 year ago

i was thinking about some kind of flow, one may want to parse new language. it goes to logos, then to rowan, then to whatever integration on top. so example of starting from logos to rowan to be here. unlikely people will use m_lexer. so this pr saves some time of this process.

sure, could use logos without macro or use nightly rust to hack const and recursive types instead of doing enums+macro. but for what?

imho macroses are good here. DSL is selfspeacking.