|
1 | 1 | # cratedb-sqlparse |
2 | 2 |
|
3 | 3 | `Antlr4` is a parser generator for reading, processing and executing text, there are several |
4 | | -target languages (Java, Python, JavaScript, Dart...) available. CrateDB uses the Java target. |
| 4 | +target languages (Java, Python, JavaScript, Dart) available. CrateDB uses the Java target. |
5 | 5 |
|
6 | 6 | The repository holds libraries/packages created from some of those available languages, so |
7 | | -far: `Python` and `JavaScript`. |
8 | | -More might be added if needed in the future. |
| 7 | +far: `Python` and `JavaScript`. More might be added if needed in the future. |
9 | 8 |
|
10 | 9 | These libraries allow you to parse Crate's SQL dialect without sending it to a CrateDB instance. |
11 | 10 |
|
@@ -50,29 +49,23 @@ exceptions as error listener, dollar strings and any new one. See past commits t |
50 | 49 | implemented in Python and Javascript, remember that CrateDB's SQLParser written in Java is the most |
51 | 50 | complete and the default reference. |
52 | 51 |
|
53 | | -## Building locally & using a different CrateDB version. |
| 52 | +## Building locally & using a different CrateDB version |
54 | 53 |
|
55 | 54 | The generated parser is not uploaded to the repository since it's huge, to use the package locally or |
56 | 55 | to build a different version use the build script. |
57 | 56 |
|
58 | | -#### Clone the project |
59 | | -`git clone [email protected]:crate/cratedb-sqlparse.git` |
60 | | - |
61 | | -#### Install the dependencies |
62 | | -`pip install antlr4-python3-runtime requests` |
63 | | - |
64 | | -#### Run the build script |
65 | | -`python3 setup_grammar.py` |
| 57 | +### Acquire sources |
| 58 | +```shell |
| 59 | +git clone [email protected]:crate/cratedb-sqlparse.git |
| 60 | +cd cratedb-sqlparse |
| 61 | +``` |
66 | 62 |
|
| 63 | +### Install dependencies |
| 64 | +``` |
| 65 | +pip install -r requirements.txt |
| 66 | +``` |
67 | 67 |
|
68 | | -> At the end of the build script `setup_grammar.py` the target and the CrateDB version can be modified. |
69 | | -> |
70 | | -> ```python |
71 | | -> if __name__ == '__main__': |
72 | | -> version = '5.6.4' |
73 | | -> target = Antlr4Target.python |
74 | | -> download_cratedb_grammar(version) |
75 | | -> compile_grammar(target) |
76 | | -> patch_lexer(target) |
77 | | -> set_version(target, version) |
78 | | ->``` |
| 68 | +### Generate grammar files |
| 69 | +```shell |
| 70 | +poe generate |
| 71 | +``` |
0 commit comments