|
Server : LiteSpeed System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64 User : nandedex ( 1060) PHP Version : 8.1.33 Disable Function : NONE Directory : /opt/cppython/lib/python3.8/site-packages/jmespath/__pycache__/ |
U
O��g�J � @ sp d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ G dd � d e �Z
eG d
d� de ��ZdS )a� Top down operator precedence parser.
This is an implementation of Vaughan R. Pratt's
"Top Down Operator Precedence" parser.
(http://dl.acm.org/citation.cfm?doid=512927.512931).
These are some additional resources that help explain the
general idea behind a Pratt parser:
* http://effbot.org/zone/simple-top-down-parsing.htm
* http://javascript.crockford.com/tdop/tdop.html
A few notes on the implementation.
* All the nud/led tokens are on the Parser class itself, and are dispatched
using getattr(). This keeps all the parsing logic contained to a single
class.
* We use two passes through the data. One to create a list of token,
then one pass through the tokens to create the AST. While the lexer actually
yields tokens, we convert it to a list so we can easily implement two tokens
of lookahead. A previous implementation used a fixed circular buffer, but it
was significantly slower. Also, the average jmespath expression typically
does not have a large amount of token so this is not an issue. And
interestingly enough, creating a token list first is actually faster than
consuming from the token iterator one token at a time.
� N)�lexer)�with_repr_method)�ast)�
exceptions)�visitorc @ s� e Zd Zddddddddddddddddddddddddd d
ddd
d�ZdZi ZdZdxdd�Zdd� Zdd� Z dd� Z
dydd�Zdd� Zdd� Z
dd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Zd+d,� Zd-d.� Zd/d0� Zd1d2� Zd3d4� Zd5d6� Zd7d8� Zd9d:� Zd;d<� Zd=d>� Zd?d@� ZdAdB� ZdCdD� Z dEdF� Z!dGdH� Z"dIdJ� Z#dKdL� Z$dMdN� Z%dOdP� Z&dQdR� Z'dSdT� Z(dUdV� Z)dWdX� Z*dYdZ� Z+d[d\� Z,d]d^� Z-d_d`� Z.dadb� Z/dzddde�Z0dfdg� Z1dhdi� Z2djdk� Z3dldm� Z4dndo� Z5dpdq� Z6drds� Z7dtdu� Z8e9dvdw� �Z:dcS ){�Parserr � � � � � � � �( �- �2 �7 �<