Re: stripping comments
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: stripping comments
- From: Samuel <javalikescript@...>
- Date: 2023年7月25日 08:18:20 +0200
I've been thinking about the problem of stripping comments (including
long/block comments) from a string containing Lua code. Is there some
way to do this that is shorter than an imperative byte-by-byte state
machine? I've considered Lua's patterns and also the Lpeg library, but
without success.
Hello,
You could use an AST parser to strip comments such as DumbLuaParser[1].
Have a good day,
Samuel
[1] https://github.com/ReFreezed/DumbLuaParser