Last active
December 16, 2020 13:27
-
-
Save xshyamx/7863e7b208a55f1bbfaa to your computer and use it in GitHub Desktop.
Extract Neo4j Cypher keywords, clauses & functions
This file contains hidden or 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
#!/bin/sh | |
url=http://m2.neo4j.org/content/repositories/snapshots/org/neo4j/neo4j-cypher-compiler-2.2/2.2-SNAPSHOT/neo4j-cypher-compiler-2.2-2.2-20140807.002630-9-sources.jar | |
fn=$(echo $url | sed -re 's/^.*\/([^/]*)$/\1/') | |
curl -s -o $fn -L $url | |
jar xf $fn org/neo4j/cypher/internal/compiler/ | |
echo Cypher Keywords | |
grep --no-filename -re 'keyword(' org/neo4j/cypher/internal/compiler/ \ | |
| sed 's/keyword(/\n\0/g' \ | |
| awk '/keyword\("/ { print tolower($0) }' \ | |
| sed -e 's/keyword(//' -e 's/).*//' \ | |
| sort | uniq | sed ':a;N;$!ba;s/\n/ /g' | |
echo Cypher Clauses | |
grep --no-filename -re 'rule(' org/neo4j/cypher/internal/compiler/ \ | |
| sed 's/rule(/\n\0/g' \ | |
| grep -E '"[A-Z][A-Z ]+?"' \ | |
| awk '/rule\("/ { print tolower($0) }' \ | |
| sed -e 's/rule(//' -e 's/).*//' \ | |
| sort | uniq | sed ':a;N;$!ba;s/\n/ /g' | |
echo Cypher Functions | |
fn_dir=$(find org/ -name functions -type d) | |
grep --no-filename -re 'name' $fn_dir \ | |
| awk '{ print tolower($4) }' \ | |
| awk '/^"/ { print }' \ | |
| sort | uniq \ | |
| sed ':a;N;$!ba;s/\n/ /g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment