lex#
- astropy.utils.parsing.lex(lextab: str, package: str, reflags: int = 64) Lexer[source]#
 Create a lexer from local variables.
It automatically compiles the lexer in optimized mode, writing to
lextabin the same directory as the calling file.This function is thread-safe. The returned lexer is not thread-safe, but if it is used exclusively with a single parser returned by
yacc()then it will be safe.It is only intended to work with lexers defined within the calling function, rather than at class or module scope.
- Parameters:
 - lextab
python:str Name for the file to write with the generated tables, if it does not already exist (without
.pysuffix).- package
python:str Name of a test package which should be run with pytest to regenerate the output file. This is inserted into a comment in the generated file.
- reflags
python:int Passed to
ply.lex.
- lextab