-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore code from floyd-python v0.16.0.
This reverts commit 6b4450e.
- Loading branch information
Showing
44 changed files
with
12,011 additions
and
19 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,28 @@ | ||
name: Python package | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.8, 3.12] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Set up Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- name: Run tests | ||
run: python run tests |
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,75 @@ | ||
# Copyright 2014 Google Inc. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# This file is taken from the suggested pylint configuration in | ||
# Google's Python Style Guide, specifically | ||
# https://github.com/google/styleguide/blob/28d10d1/pylintrc | ||
# with some changes: | ||
# - suppress consider-using-f-string as too noisy | ||
# - Commented out the disabling of no-self-use in order to get rid of | ||
# the "useless option value" warning. | ||
# - Disabled the duplicate-code check because there's too much unavoidable | ||
# code similarity between compiler.py and printer.py. | ||
# - Turned off the score message in the [REPORTS] section. | ||
|
||
[MAIN] | ||
|
||
persistent=yes | ||
|
||
[MESSAGES CONTROL] | ||
|
||
disable= | ||
broad-except, | ||
consider-using-f-string, # over-sensitive | ||
duplicate-code, # Too much is duplicated between printer and compiler. | ||
exec-used, # The uses of exec in this package are okay. | ||
fixme, # Don't want warnings for this. | ||
global-statement, | ||
locally-disabled, | ||
missing-docstring, | ||
# no-self-use, # Pylint generates a 'useless option value' warning for this | ||
too-many-arguments, | ||
too-few-public-methods, | ||
too-many-branches, | ||
too-many-instance-attributes, | ||
too-many-locals, | ||
too-many-public-methods, | ||
too-many-return-statements, | ||
unidiomatic-typecheck, | ||
|
||
[REPORTS] | ||
|
||
reports=no | ||
|
||
[SCORE] | ||
|
||
score=no # Suppress the "score" message in the output. | ||
|
||
[BASIC] | ||
|
||
# By default, pylint wants method names to be at most 31 chars long, | ||
# but we want to allow up to 49 to allow for longer test names. | ||
method-rgx=[a-zA-Z_][a-zA-Z0-9_]{0,48}$ | ||
|
||
# By default, pylint only allows UPPER_CASE constants, but we want to | ||
# allow snake_case as well in some situations. | ||
const-rgx=[a-zA-Z_][a-zA-Z0-9_]{0,30}$ | ||
|
||
# By default, pylint wants all parameter names to be at least two chars long, | ||
# but we want to allow single-char parameter names as well. | ||
argument-rgx=[a-z_][a-z0-9_]{0,30}$ | ||
|
||
# By default, pylint wants all variable names to be at least two chars long, | ||
# but we want to allow single-char variable names as well. | ||
variable-rgx=[a-z_][a-z0-9_]{0,30}$ |
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,44 @@ | ||
# The goals I wish to research and/or achieve with Floyd | ||
|
||
1. Build a production-ready PEG parser and generator that focuses its | ||
action language on JSON (i.e., JSON objects are returned from the | ||
parse). | ||
2. Have the generated parsers be comparable to what you would write by | ||
hand (i.e., be very readable). | ||
3. If necessary, provide two modes of generated output: clear/simple and | ||
fast. | ||
4. Benchmark the generated grammars against other Python parsing | ||
frameworks' output and hand-written parsers (e.g., the built-in JSON | ||
or TOML parsers). | ||
5. Have the parsers be able to handle a wide range of grammars, including | ||
ones with left recursion and ones that are indentation-sensitive. | ||
6. Potentially add the ability to generate non-PEG grammars, e.g. LL and | ||
LR grammars for suitable languages. | ||
7. Have the action language of the grammars be comparable in power to AWK | ||
so that you can build simple parsing scripts with some of AWK's | ||
utility. This might give us an external DSL. | ||
8. Explore how to generate code without needing any custom Python code | ||
(i.e., have a printing language to match the parsing language). | ||
9. Be able to generate code for multiple languages including perhaps C, | ||
C++, Go, Java, Javascript, Python, and Rust (and possibly Kotlin, | ||
Swift, and Zig). | ||
10. Use the output of (9) to enable cross-language benchmarking of the | ||
same problem space. | ||
11. Reimplement everything in some of the other languages in (9) so that | ||
we have examples of a non-trivial code base in multiple languages to | ||
compare and benchmark. Ideally the grammars and pretty-printing | ||
descriptions are host-language-independent, so that writing new | ||
grammars and implementing new languages are only N+M problems and not | ||
N*M problems. | ||
12. Be able to use the language implemented for the parsers as a simple | ||
embeddable DSL. | ||
13. Have the language be dynamically typed but suitable for static typing. | ||
14. Define a way to map objects to schemas and host data types so that you | ||
can parse directly to host data structures and not require manual | ||
conversion in the host from JSON. | ||
15. Implement grammars and pretty printers for some of JSON, JSON5, HJSON, | ||
TOML, a simplified subset of YAML, Ninja, GN, HTML, CSS, JavaScript, | ||
Protocol Buffers (text format if possible?). | ||
16. Define a DOM-like interface that can be used to produce round-trippable | ||
versions of parsed docs (i.e., ones that preserve the input including | ||
whitespace and comments). |
Oops, something went wrong.