lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


You can start by learning LPeg and LPegRex.
LPegRex contains a grammar for parsing Lua:

  https://github.com/edubart/lpegrex/blob/main/parsers/lua.lua

and it defines the syntax for comments - long and short - here:

  https://github.com/edubart/lpegrex/blob/main/parsers/lua.lua#L113

Cheers,
  Eduardo Ochs
  http://anggtwu.net/luaforth.html
  https://emacsconf.org/2023/talks/repl/


On Mon, 2 Oct 2023 at 06:25, Claudio Grondi <claudio.grondi@freenet.de> wrote:

Lua provides support for multi-line string literals invoked by `[[` and
finalized with `]]` and for multi-line comments invoked with `--[[`,
`--[=[`, ...

I have searched Lua C-code for `--[[`, `--[=` and `[[` but failed to
find this patterns which I would like to replace for custom purposes
with another ones.

Any hints towards where to look and what to change?