Package pyraf :: Module cgeneric
[hide private]
[frames] | no frames]

Module cgeneric

source code

cgeneric.py: Context-sensitive scanner class

Maintains a stack of instances of John Aycock's generic.py scanner class and allows context-sensitive switches between them.

Self.current is a stack (list) of integers, with the last value pointing to the current scanner to use; by default it is initialized to zero. The ContextSensitiveScanner object is passed to the action functions, which are permitted to access and modify the current stack in order to change the state. The ContextSensitiveScanner object should also be used for instance-specific attributes (e.g., the generated token list and current line number) so that the same scanners list can be used by several different ContextSensitiveScanner objects.

I also added the re match object as an argument to the action function.

$Id: cgeneric.py 678 2005-07-01 21:19:43Z perry $

Created 1999 September 10 by R. White

Classes [hide private]
  ContextSensitiveScanner
Context-sensitive scanner