??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
ó
QŒYc @ s˜ d Z d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d e f d „ ƒ YZ
e d
e f d „ ƒ Yƒ Z d S( s‹ 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.
iÿÿÿÿN( t lexer( t with_repr_method( t ast( t
exceptions( t visitort Parserc B sÅ e Z i d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d
6d d 6d d 6d
d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d! 6d" d# 6d$ d% 6d&