-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update PLY from Chromium 114.0.5735.358
- Loading branch information
Showing
10 changed files
with
1,840 additions
and
1,553 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
monorail { | ||
component: "Tools" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[email protected] | ||
|
||
file://tools/idl_parser/OWNERS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
Name: PLY (Python Lex-Yacc) | ||
Current version: 3.4 | ||
URL: http://www.dabeaz.com/ply/ply-3.4.tar.gz | ||
Current version: 3.11 | ||
URL: http://www.dabeaz.com/ply/ply-3.11.tar.gz | ||
License: BSD | ||
License File: LICENSE | ||
Security Critical: no | ||
Version: 3.4 | ||
Version: 3.11 | ||
|
||
This directory contains a copy of these ply-3.4 components: | ||
PLY is used by (at least) the Mojo python bindings, the PPAPI | ||
IDL generator, and the Blink IDL generator. | ||
|
||
README ply-3.4/README | ||
Sources ply-3.4/ply/__init__.py | ||
ply-3.4/ply/lex.py | ||
ply-3.4/ply/yacc.py | ||
This directory contains a copy of these ply-3.11 components: | ||
|
||
README ply-3.11/README.md | ||
Sources ply-3.11/ply/__init__.py | ||
ply-3.11/ply/lex.py | ||
ply-3.11/ply/yacc.py | ||
|
||
|
||
The license is in LICENSE. | ||
|
||
Modifications made with initial commit: | ||
Modifications made: | ||
- Added the file README.chromium (this file) | ||
- Applies license.patch | ||
- Added ply.gni to list sources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
PLY (Python Lex-Yacc) Version 3.4 | ||
# PLY (Python Lex-Yacc) Version 3.11 | ||
|
||
Copyright (C) 2001-2011, | ||
[![Build Status](https://travis-ci.org/dabeaz/ply.svg?branch=master)](https://travis-ci.org/dabeaz/ply) | ||
|
||
Copyright (C) 2001-2018 | ||
David M. Beazley (Dabeaz LLC) | ||
All rights reserved. | ||
|
||
|
@@ -96,7 +98,7 @@ A simple example is found at the end of this document | |
|
||
Requirements | ||
============ | ||
PLY requires the use of Python 2.2 or greater. However, you should | ||
PLY requires the use of Python 2.6 or greater. However, you should | ||
use the latest Python release if possible. It should work on just | ||
about any platform. PLY has been tested with both CPython and Jython. | ||
It also seems to work with IronPython. | ||
|
@@ -112,7 +114,11 @@ book "Compilers : Principles, Techniques, and Tools" by Aho, Sethi, and | |
Ullman. The topics found in "Lex & Yacc" by Levine, Mason, and Brown | ||
may also be useful. | ||
|
||
A Google group for PLY can be found at | ||
The GitHub page for PLY can be found at: | ||
|
||
https://github.com/dabeaz/ply | ||
|
||
An old and relatively inactive discussion group for PLY is found at: | ||
|
||
http://groups.google.com/group/ply-hack | ||
|
||
|
@@ -130,7 +136,7 @@ and testing a revised LALR(1) implementation for PLY-2.0. | |
Special Note for PLY-3.0 | ||
======================== | ||
PLY-3.0 the first PLY release to support Python 3. However, backwards | ||
compatibility with Python 2.2 is still preserved. PLY provides dual | ||
compatibility with Python 2.6 is still preserved. PLY provides dual | ||
Python 2/3 compatibility by restricting its implementation to a common | ||
subset of basic language features. You should not convert PLY using | ||
2to3--it is not necessary and may in fact break the implementation. | ||
|
@@ -141,109 +147,109 @@ Example | |
Here is a simple example showing a PLY implementation of a calculator | ||
with variables. | ||
|
||
# ----------------------------------------------------------------------------- | ||
# calc.py | ||
# | ||
# A simple calculator with variables. | ||
# ----------------------------------------------------------------------------- | ||
|
||
tokens = ( | ||
'NAME','NUMBER', | ||
'PLUS','MINUS','TIMES','DIVIDE','EQUALS', | ||
'LPAREN','RPAREN', | ||
) | ||
|
||
# Tokens | ||
|
||
t_PLUS = r'\+' | ||
t_MINUS = r'-' | ||
t_TIMES = r'\*' | ||
t_DIVIDE = r'/' | ||
t_EQUALS = r'=' | ||
t_LPAREN = r'\(' | ||
t_RPAREN = r'\)' | ||
t_NAME = r'[a-zA-Z_][a-zA-Z0-9_]*' | ||
|
||
def t_NUMBER(t): | ||
r'\d+' | ||
t.value = int(t.value) | ||
return t | ||
|
||
# Ignored characters | ||
t_ignore = " \t" | ||
|
||
def t_newline(t): | ||
r'\n+' | ||
t.lexer.lineno += t.value.count("\n") | ||
def t_error(t): | ||
print("Illegal character '%s'" % t.value[0]) | ||
t.lexer.skip(1) | ||
# Build the lexer | ||
import ply.lex as lex | ||
lex.lex() | ||
|
||
# Precedence rules for the arithmetic operators | ||
precedence = ( | ||
('left','PLUS','MINUS'), | ||
('left','TIMES','DIVIDE'), | ||
('right','UMINUS'), | ||
) | ||
|
||
# dictionary of names (for storing variables) | ||
names = { } | ||
|
||
def p_statement_assign(p): | ||
'statement : NAME EQUALS expression' | ||
names[p[1]] = p[3] | ||
|
||
def p_statement_expr(p): | ||
'statement : expression' | ||
print(p[1]) | ||
|
||
def p_expression_binop(p): | ||
'''expression : expression PLUS expression | ||
| expression MINUS expression | ||
| expression TIMES expression | ||
| expression DIVIDE expression''' | ||
if p[2] == '+' : p[0] = p[1] + p[3] | ||
elif p[2] == '-': p[0] = p[1] - p[3] | ||
elif p[2] == '*': p[0] = p[1] * p[3] | ||
elif p[2] == '/': p[0] = p[1] / p[3] | ||
|
||
def p_expression_uminus(p): | ||
'expression : MINUS expression %prec UMINUS' | ||
p[0] = -p[2] | ||
|
||
def p_expression_group(p): | ||
'expression : LPAREN expression RPAREN' | ||
p[0] = p[2] | ||
|
||
def p_expression_number(p): | ||
'expression : NUMBER' | ||
p[0] = p[1] | ||
|
||
def p_expression_name(p): | ||
'expression : NAME' | ||
try: | ||
p[0] = names[p[1]] | ||
except LookupError: | ||
print("Undefined name '%s'" % p[1]) | ||
p[0] = 0 | ||
|
||
def p_error(p): | ||
print("Syntax error at '%s'" % p.value) | ||
|
||
import ply.yacc as yacc | ||
yacc.yacc() | ||
|
||
while 1: | ||
try: | ||
s = raw_input('calc > ') # use input() on Python 3 | ||
except EOFError: | ||
break | ||
yacc.parse(s) | ||
# ----------------------------------------------------------------------------- | ||
# calc.py | ||
# | ||
# A simple calculator with variables. | ||
# ----------------------------------------------------------------------------- | ||
|
||
tokens = ( | ||
'NAME','NUMBER', | ||
'PLUS','MINUS','TIMES','DIVIDE','EQUALS', | ||
'LPAREN','RPAREN', | ||
) | ||
|
||
# Tokens | ||
|
||
t_PLUS = r'\+' | ||
t_MINUS = r'-' | ||
t_TIMES = r'\*' | ||
t_DIVIDE = r'/' | ||
t_EQUALS = r'=' | ||
t_LPAREN = r'\(' | ||
t_RPAREN = r'\)' | ||
t_NAME = r'[a-zA-Z_][a-zA-Z0-9_]*' | ||
|
||
def t_NUMBER(t): | ||
r'\d+' | ||
t.value = int(t.value) | ||
return t | ||
|
||
# Ignored characters | ||
t_ignore = " \t" | ||
|
||
def t_newline(t): | ||
r'\n+' | ||
t.lexer.lineno += t.value.count("\n") | ||
|
||
def t_error(t): | ||
print("Illegal character '%s'" % t.value[0]) | ||
t.lexer.skip(1) | ||
|
||
# Build the lexer | ||
import ply.lex as lex | ||
lex.lex() | ||
|
||
# Precedence rules for the arithmetic operators | ||
precedence = ( | ||
('left','PLUS','MINUS'), | ||
('left','TIMES','DIVIDE'), | ||
('right','UMINUS'), | ||
) | ||
|
||
# dictionary of names (for storing variables) | ||
names = { } | ||
|
||
def p_statement_assign(p): | ||
'statement : NAME EQUALS expression' | ||
names[p[1]] = p[3] | ||
|
||
def p_statement_expr(p): | ||
'statement : expression' | ||
print(p[1]) | ||
|
||
def p_expression_binop(p): | ||
'''expression : expression PLUS expression | ||
| expression MINUS expression | ||
| expression TIMES expression | ||
| expression DIVIDE expression''' | ||
if p[2] == '+' : p[0] = p[1] + p[3] | ||
elif p[2] == '-': p[0] = p[1] - p[3] | ||
elif p[2] == '*': p[0] = p[1] * p[3] | ||
elif p[2] == '/': p[0] = p[1] / p[3] | ||
|
||
def p_expression_uminus(p): | ||
'expression : MINUS expression %prec UMINUS' | ||
p[0] = -p[2] | ||
|
||
def p_expression_group(p): | ||
'expression : LPAREN expression RPAREN' | ||
p[0] = p[2] | ||
|
||
def p_expression_number(p): | ||
'expression : NUMBER' | ||
p[0] = p[1] | ||
|
||
def p_expression_name(p): | ||
'expression : NAME' | ||
try: | ||
p[0] = names[p[1]] | ||
except LookupError: | ||
print("Undefined name '%s'" % p[1]) | ||
p[0] = 0 | ||
|
||
def p_error(p): | ||
print("Syntax error at '%s'" % p.value) | ||
|
||
import ply.yacc as yacc | ||
yacc.yacc() | ||
|
||
while True: | ||
try: | ||
s = raw_input('calc > ') # use input() on Python 3 | ||
except EOFError: | ||
break | ||
yacc.parse(s) | ||
|
||
|
||
Bug Reports and Patches | ||
|
@@ -252,12 +258,10 @@ My goal with PLY is to simply have a decent lex/yacc implementation | |
for Python. As a general rule, I don't spend huge amounts of time | ||
working on it unless I receive very specific bug reports and/or | ||
patches to fix problems. I also try to incorporate submitted feature | ||
requests and enhancements into each new version. To contact me about | ||
bugs and/or new features, please send email to [email protected]. | ||
|
||
In addition there is a Google group for discussing PLY related issues at | ||
|
||
http://groups.google.com/group/ply-hack | ||
requests and enhancements into each new version. Please visit the PLY | ||
github page at https://github.com/dabeaz/ply to submit issues and pull | ||
requests. To contact me about bugs and/or new features, please send | ||
email to [email protected]. | ||
|
||
-- Dave | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# PLY package | ||
# Author: David Beazley ([email protected]) | ||
# ----------------------------------------------------------------------------- | ||
# ply: yacc.py | ||
# ply: __init__.py | ||
# | ||
# Copyright (C) 2001-2011, | ||
# Copyright (C) 2001-2018 | ||
# David M. Beazley (Dabeaz LLC) | ||
# All rights reserved. | ||
# | ||
|
@@ -33,4 +33,5 @@ | |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
# ----------------------------------------------------------------------------- | ||
|
||
__version__ = '3.11' | ||
__all__ = ['lex','yacc'] |
Oops, something went wrong.