Module macro.lexer

A Lua lexical scanner using LPeg.

= CREDITS Written by Peter Odding, 2007/4/4

= THANKS TO - the Lua authors for a wonderful language; - Roberto for LPeg; - caffeine for keeping me awake :)

= LICENSE Shamelessly ripped from the SQLite[3] project:

The author disclaims copyright to this source code. In place of a legal notice, here is a blessing:

  May you do good and not evil.
  May you find forgiveness for yourself and forgive others.
  May you share freely, never taking more than you give.

Functions

scan_lua (input, name) get a token iterator from a source containing Lua code.


Functions

scan_lua (input, name)
get a token iterator from a source containing Lua code. Note that this token iterator includes spaces and comments, and does not convert string and number tokens - so e.g. a string token is quoted and a number token is an unconverted string.

Parameters:

  • input: the source - can be a string or a file-like object (i.e. read() returns line)
  • name: for the source