Your IP : 216.73.216.213
B
Z��Z�/ � @ s` d dl mZ d dlZejeeeed� ddlmZ ddlmZm Z m
Z
e� ZG dd� de�ZdS ) � )�absolute_importN)�BOL�EOL�EOF� NOT_FOUND� )�Errors)r r r c @ sd e Zd ZdZddd�Zdd� Zdd � Zd
d� Zdd
� Zdd� Z dd� Z
dd� Zddd�Zdd� Z
dS )�Scannera�
A Scanner is used to read tokens from a stream of characters
using the token set specified by a Plex.Lexicon.
Constructor:
Scanner(lexicon, stream, name = '')
See the docstring of the __init__ method for details.
Methods:
See the docstrings of the individual methods for more
information.
read() --> (value, text)
Reads the next lexical token from the stream.
position() --> (name, line, col)
Returns the position of the last token read using the
read() method.
begin(state_name)
Causes scanner to change state.
produce(value [, text])
Causes return of a token value to the caller of the
Scanner.
� Nc C s� d| _ d| _d| _d| _d| _d| _d| _d| _d| _d| _ d| _
|| _|| _|| _
g | _d| _| �d� d| _d| _d| _t| _d| _|dk r�|d |d | _| _dS )a�
Scanner(lexicon, stream, name = '')
|lexicon| is a Plex.Lexicon instance specifying the lexical tokens
to be recognised.
|stream| can be a file object or anything which implements a
compatible read() method.
|name| is optional, and may be the name of the file being
scanned or any other identifying string.
r r
r N� )�trace�buffer�
buf_start_pos�next_pos�cur_pos�cur_line� start_pos�
start_line� start_col�text�
state_name�lexicon�stream�name�queue�
initial_state�begin�cur_line_startr �cur_char�input_state)�selfr r r Zinitial_pos� r! �G/opt/alt/python37/lib64/python3.7/site-packages/Cython/Plex/Scanners.py�__init__H s0
zScanner.__init__c C sl | j }xR|sX| �� \| _}|dkr6| �d� | �� q|�| | j�}|dk r| �|� qW |d }|d= |S )a"
Read the next lexical token from the stream and return a
tuple (value, text), where |value| is the value associated with
the token as specified by the Lexicon, and |text| is the actual
string read from the stream. Returns (None, '') on end of file.
Nr )r �scan_a_tokenr �produce�eofZperform)r r �action�value�resultr! r! r"