lex

(function from pyomo.tpl.ply.lex)

pyomo.tpl.ply.lex.lex(module=None, debug=False, optimize=False, lextab='lextab', reflags=64, nowarn=False, outputdir=None, debuglog=None, errorlog=None)[source]

Generate and return a Lexer (tokenizer) object

Parameters:
  • module (types.ModuleType | None) – The module defining the lexer grammar. If None, then the calling context is assumed to contain the grammar.

  • debug (bool) – If True, generate a debug log and send it to debuglog

  • optimize (bool) – If True, generate “optimized” lexer (with less debugging / error checking).

  • lextab (types.ModuleType | str | None) – If lextab is a module, then assume it is a cached tokenizer. Return it. If it is a string or None, then the tokenizer is generated from the grammar (see also module)

  • reflags (int)

  • nowarn (bool)

  • outputdir (str | None) – If non-None and lextab is not a module, then write the lexer table to tabfile in outputdir.

  • debuglog (PlyLogger | None) – The logger to write the debug log to. If None, debug log is sent to sys.stderr.

  • errorlog (PlyLogger | NullLogger | None) – Error log file. If None, the error log is sent to sys.stderr