Skip to content

Commit

Permalink
Merge pull request #60 from walter-weinmann/wwe_version_1.2.1
Browse files Browse the repository at this point in the history
Version 1.2.1: 'WS' has been replaced by '[SP]'.
  • Loading branch information
walter-weinmann authored Oct 3, 2016
2 parents abad505 + 5ca2c28 commit 150901f
Show file tree
Hide file tree
Showing 12 changed files with 7,663 additions and 7,622 deletions.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/walter-weinmann/ocparse.svg?branch=master)](https://travis-ci.org/walter-weinmann/ocparse)

**ocparse** is a production-ready [openCypher](https://github.com/opencypher/openCypher) parser written in pure Erlang. **ocparse** is closely aligned to the [openCypher](https://github.com/opencypher/openCypher) project and in future will be adapted on a regular basis as the [openCypher](https://github.com/opencypher/openCypher) project evolves. The [openCypher project](http://www.opencypher.org) aims to deliver a full and open specification of the industry’s most widely adopted graph database query language: [Cypher](https://neo4j.com/docs/developer-manual/current/#cypher-query-lang). And, with the [EBNF file](https://s3.amazonaws.com/artifacts.opencypher.org/cypher.ebnf) the project provides the basis for the definition of the LALR grammar.
**ocparse** is a production-ready [openCypher](https://github.com/opencypher/openCypher) parser written in pure Erlang. **ocparse** is closely aligned to the openCypher project and in future will be adapted on a regular basis as the openCypher project evolves. The [openCypher project](http://www.opencypher.org) aims to deliver a full and open specification of the industry’s most widely adopted graph database query language: [Cypher](https://neo4j.com/docs/developer-manual/current/#cypher-query-lang). And, with the [EBNF file](https://s3.amazonaws.com/artifacts.opencypher.org/cypher.ebnf) the project provides the basis for the definition of the LALR grammar.

### Legacy version:

Expand Down Expand Up @@ -284,6 +284,54 @@ This project was inspired by the [sqlparse](https://github.com/K2InformaticsGmbH

## 6. Release Notes

### Version 1.2.1

Release Date: 03.10.2016 - Grammar as of 02.10.2016

#### Grammar changes

- `WS` has been replaced by `[SP]`.

- **Union**

```
New: Union = ((U,N,I,O,N), SP, (A,L,L), [SP], SingleQuery)
| ((U,N,I,O,N), [SP], SingleQuery)
;
Old: Union = ((U,N,I,O,N), SP, (A,L,L), SingleQuery)
| ((U,N,I,O,N), SingleQuery)
;
```

- **Atom**

```
New: Atom = ...
| ((C,O,U,N,T), [SP], '(', [SP], '*', [SP], ')')
...
New: Atom = ...
| ((C,O,U,N,T), '(', '*', ')')
...
```

- **FunctionInvocation**

```
New: FunctionInvocation = FunctionName, [SP], '(', [SP], [(D,I,S,T,I,N,C,T), [SP]], [Expression, [SP], { ',', [SP], Expression, [SP] }], ')' ;
New: FunctionInvocation = FunctionName, WS, '(', WS, [(D,I,S,T,I,N,C,T), WS], [Expression, { ',', WS, Expression }, WS], ')' ;
```

- **WS**

```
New: n/a
New: WS = { whitespace } ;
```

### Version 1.2.0

Release Date: 29.08.2016 - Grammar as of 28.08.2016
Expand Down
2,000 changes: 1,000 additions & 1,000 deletions ct/performance_command_legacy_SUITE.erl

Large diffs are not rendered by default.

2,002 changes: 1,001 additions & 1,001 deletions ct/performance_cypher_SUITE.erl

Large diffs are not rendered by default.

2,002 changes: 1,001 additions & 1,001 deletions ct/performance_cypher_legacy_SUITE.erl

Large diffs are not rendered by default.

2,002 changes: 1,001 additions & 1,001 deletions ct/performance_query_SUITE.erl

Large diffs are not rendered by default.

2,002 changes: 1,001 additions & 1,001 deletions ct/performance_query_legacy_SUITE.erl

Large diffs are not rendered by default.

2,002 changes: 1,001 additions & 1,001 deletions ct/performance_statement_SUITE.erl

Large diffs are not rendered by default.

2,002 changes: 1,001 additions & 1,001 deletions ct/performance_statement_legacy_SUITE.erl

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*)
Cypher = WS, Statement, [WS, ';'], WS ;
Cypher = [SP], Statement, [[SP], ';'], [SP] ;
Statement = Query ;
Query = RegularQuery ;
RegularQuery = SingleQuery, { WS, Union } ;
RegularQuery = SingleQuery, { [SP], Union } ;
SingleQuery = Clause, { WS, Clause } ;
SingleQuery = Clause, { [SP], Clause } ;
Union = ((U,N,I,O,N), SP, (A,L,L), SingleQuery)
| ((U,N,I,O,N), SingleQuery)
Union = ((U,N,I,O,N), SP, (A,L,L), [SP], SingleQuery)
| ((U,N,I,O,N), [SP], SingleQuery)
;
Clause = Match
Expand All @@ -39,17 +39,17 @@ Clause = Match
| Return
;
Match = [(O,P,T,I,O,N,A,L), SP], (M,A,T,C,H), WS, Pattern, [WS, Where] ;
Match = [(O,P,T,I,O,N,A,L), SP], (M,A,T,C,H), [SP], Pattern, [[SP], Where] ;
Unwind = (U,N,W,I,N,D), WS, Expression, SP, (A,S), SP, Variable ;
Unwind = (U,N,W,I,N,D), [SP], Expression, SP, (A,S), SP, Variable ;
Merge = (M,E,R,G,E), WS, PatternPart, { SP, MergeAction } ;
Merge = (M,E,R,G,E), [SP], PatternPart, { SP, MergeAction } ;
MergeAction = ((O,N), SP, (M,A,T,C,H), SP, Set)
| ((O,N), SP, (C,R,E,A,T,E), SP, Set)
;
Create = (C,R,E,A,T,E), WS, Pattern ;
Create = (C,R,E,A,T,E), [SP], Pattern ;
Set = (S,E,T), SetItem, { ',', SetItem } ;
Expand All @@ -63,7 +63,7 @@ Delete = ((D,E,L,E,T,E), Expression, { ',', Expression })
| ((D,E,T,A,C,H), SP, (D,E,L,E,T,E), Expression, { ',', Expression })
;
Remove = (R,E,M,O,V,E), SP, RemoveItem, { WS, ',', WS, RemoveItem } ;
Remove = (R,E,M,O,V,E), SP, RemoveItem, { [SP], ',', [SP], RemoveItem } ;
RemoveItem = (Variable, NodeLabels)
| PropertyExpression
Expand All @@ -79,15 +79,15 @@ Return = ((R,E,T,U,R,N), SP, (D,I,S,T,I,N,C,T), SP, ReturnBody)
ReturnBody = ReturnItems, [SP, Order], [SP, Skip], [SP, Limit] ;
ReturnItems = ('*', { WS, ',', WS, ReturnItem })
| (ReturnItem, { WS, ',', WS, ReturnItem })
ReturnItems = ('*', { [SP], ',', [SP], ReturnItem })
| (ReturnItem, { [SP], ',', [SP], ReturnItem })
;
ReturnItem = (Expression, SP, (A,S), SP, Variable)
| Expression
;
Order = (O,R,D,E,R), SP, (B,Y), SP, SortItem, { ',', WS, SortItem } ;
Order = (O,R,D,E,R), SP, (B,Y), SP, SortItem, { ',', [SP], SortItem } ;
Skip = (S,K,I,P), SP, Expression ;
Expand All @@ -99,26 +99,26 @@ SortItem = (Expression, ((D,E,S,C,E,N,D,I,N,G) | (D,E,S,C)))
Where = (W,H,E,R,E), SP, Expression ;
Pattern = PatternPart, { WS, ',', WS, PatternPart } ;
Pattern = PatternPart, { [SP], ',', [SP], PatternPart } ;
PatternPart = (Variable, WS, '=', WS, AnonymousPatternPart)
PatternPart = (Variable, [SP], '=', [SP], AnonymousPatternPart)
| AnonymousPatternPart
;
AnonymousPatternPart = PatternElement ;
PatternElement = (NodePattern, { WS, PatternElementChain })
PatternElement = (NodePattern, { [SP], PatternElementChain })
| ('(', PatternElement, ')')
;
NodePattern = '(', WS, [Variable, WS], [NodeLabels, WS], [Properties, WS], ')' ;
NodePattern = '(', [SP], [Variable, [SP]], [NodeLabels, [SP]], [Properties, [SP]], ')' ;
PatternElementChain = RelationshipPattern, WS, NodePattern ;
PatternElementChain = RelationshipPattern, [SP], NodePattern ;
RelationshipPattern = (LeftArrowHead, WS, Dash, WS, [RelationshipDetail], WS, Dash, WS, RightArrowHead)
| (LeftArrowHead, WS, Dash, WS, [RelationshipDetail], WS, Dash)
| (Dash, WS, [RelationshipDetail], WS, Dash, WS, RightArrowHead)
| (Dash, WS, [RelationshipDetail], WS, Dash)
RelationshipPattern = (LeftArrowHead, [SP], Dash, [SP], [RelationshipDetail], [SP], Dash, [SP], RightArrowHead)
| (LeftArrowHead, [SP], Dash, [SP], [RelationshipDetail], [SP], Dash)
| (Dash, [SP], [RelationshipDetail], [SP], Dash, [SP], RightArrowHead)
| (Dash, [SP], [RelationshipDetail], [SP], Dash)
;
RelationshipDetail = '[', [Variable], ['?'], [RelationshipTypes], [RangeLiteral], [Properties], ']' ;
Expand All @@ -127,13 +127,13 @@ Properties = MapLiteral
| Parameter
;
RelationshipTypes = ':', RelTypeName, { WS, '|', [':'], WS, RelTypeName } ;
RelationshipTypes = ':', RelTypeName, { [SP], '|', [':'], [SP], RelTypeName } ;
NodeLabels = NodeLabel, { WS, NodeLabel } ;
NodeLabels = NodeLabel, { [SP], NodeLabel } ;
NodeLabel = ':', LabelName ;
RangeLiteral = '*', WS, [IntegerLiteral, WS], ['..', WS, [IntegerLiteral, WS]] ;
RangeLiteral = '*', [SP], [IntegerLiteral, [SP]], ['..', [SP], [IntegerLiteral, [SP]]] ;
LabelName = SymbolicName ;
Expand All @@ -149,17 +149,17 @@ Expression10 = Expression9, { SP, (A,N,D), SP, Expression9 } ;
Expression9 = { SP, (N,O,T), SP }, Expression8 ;
Expression8 = Expression7, { WS, PartialComparisonExpression } ;
Expression8 = Expression7, { [SP], PartialComparisonExpression } ;
Expression7 = Expression6, { (WS, '+', WS, Expression6) | (WS, '-', WS, Expression6) } ;
Expression7 = Expression6, { ([SP], '+', [SP], Expression6) | ([SP], '-', [SP], Expression6) } ;
Expression6 = Expression5, { (WS, '*', WS, Expression5) | (WS, '/', WS, Expression5) | (WS, '%', WS, Expression5) } ;
Expression6 = Expression5, { ([SP], '*', [SP], Expression5) | ([SP], '/', [SP], Expression5) | ([SP], '%', [SP], Expression5) } ;
Expression5 = Expression4, { WS, '^', WS, Expression4 } ;
Expression5 = Expression4, { [SP], '^', [SP], Expression4 } ;
Expression4 = { ('+' | '-'), WS }, Expression3 ;
Expression4 = { ('+' | '-'), [SP] }, Expression3 ;
Expression3 = Expression2, { (WS, '[', Expression, ']') | (WS, '[', [Expression], '..', [Expression], ']') | (((WS, '=~') | (SP, (I,N)) | (SP, (S,T,A,R,T,S), SP, (W,I,T,H)) | (SP, (E,N,D,S), SP, (W,I,T,H)) | (SP, (C,O,N,T,A,I,N,S))), WS, Expression2) | (SP, (I,S), SP, (N,U,L,L)) | (SP, (I,S), SP, (N,O,T), SP, (N,U,L,L)) } ;
Expression3 = Expression2, { ([SP], '[', Expression, ']') | ([SP], '[', [Expression], '..', [Expression], ']') | ((([SP], '=~') | (SP, (I,N)) | (SP, (S,T,A,R,T,S), SP, (W,I,T,H)) | (SP, (E,N,D,S), SP, (W,I,T,H)) | (SP, (C,O,N,T,A,I,N,S))), [SP], Expression2) | (SP, (I,S), SP, (N,U,L,L)) | (SP, (I,S), SP, (N,O,T), SP, (N,U,L,L)) } ;
Expression2 = Atom, { PropertyLookup | NodeLabels } ;
Expand All @@ -169,46 +169,46 @@ Atom = NumberLiteral
| (T,R,U,E)
| (F,A,L,S,E)
| (N,U,L,L)
| ((C,O,U,N,T), '(', '*', ')')
| ((C,O,U,N,T), [SP], '(', [SP], '*', [SP], ')')
| MapLiteral
| ListComprehension
| ('[', WS, Expression, WS, { ',', WS, Expression, WS }, ']')
| ((F,I,L,T,E,R), WS, '(', WS, FilterExpression, WS, ')')
| ((E,X,T,R,A,C,T), WS, '(', WS, FilterExpression, WS, [WS, '|', Expression], ')')
| ((A,L,L), WS, '(', WS, FilterExpression, WS, ')')
| ((A,N,Y), WS, '(', WS, FilterExpression, WS, ')')
| ((N,O,N,E), WS, '(', WS, FilterExpression, WS, ')')
| ((S,I,N,G,L,E), WS, '(', WS, FilterExpression, WS, ')')
| ('[', [SP], Expression, [SP], { ',', [SP], Expression, [SP] }, ']')
| ((F,I,L,T,E,R), [SP], '(', [SP], FilterExpression, [SP], ')')
| ((E,X,T,R,A,C,T), [SP], '(', [SP], FilterExpression, [SP], [[SP], '|', Expression], ')')
| ((A,L,L), [SP], '(', [SP], FilterExpression, [SP], ')')
| ((A,N,Y), [SP], '(', [SP], FilterExpression, [SP], ')')
| ((N,O,N,E), [SP], '(', [SP], FilterExpression, [SP], ')')
| ((S,I,N,G,L,E), [SP], '(', [SP], FilterExpression, [SP], ')')
| RelationshipsPattern
| ParenthesizedExpression
| FunctionInvocation
| Variable
;
PartialComparisonExpression = ('=', WS, Expression7)
| ('<>', WS, Expression7)
| ('!=', WS, Expression7)
| ('<', WS, Expression7)
| ('>', WS, Expression7)
| ('<=', WS, Expression7)
| ('>=', WS, Expression7)
PartialComparisonExpression = ('=', [SP], Expression7)
| ('<>', [SP], Expression7)
| ('!=', [SP], Expression7)
| ('<', [SP], Expression7)
| ('>', [SP], Expression7)
| ('<=', [SP], Expression7)
| ('>=', [SP], Expression7)
;
ParenthesizedExpression = '(', WS, Expression, WS, ')' ;
ParenthesizedExpression = '(', [SP], Expression, [SP], ')' ;
RelationshipsPattern = NodePattern, { WS, PatternElementChain }- ;
RelationshipsPattern = NodePattern, { [SP], PatternElementChain }- ;
FilterExpression = IdInColl, [WS, Where] ;
FilterExpression = IdInColl, [[SP], Where] ;
IdInColl = Variable, SP, (I,N), SP, Expression ;
FunctionInvocation = FunctionName, WS, '(', WS, [(D,I,S,T,I,N,C,T), WS], [Expression, { ',', WS, Expression }, WS], ')' ;
FunctionInvocation = FunctionName, [SP], '(', [SP], [(D,I,S,T,I,N,C,T), [SP]], [Expression, [SP], { ',', [SP], Expression, [SP] }], ')' ;
FunctionName = SymbolicName ;
ListComprehension = '[', FilterExpression, [WS, '|', Expression], ']' ;
ListComprehension = '[', FilterExpression, [[SP], '|', Expression], ']' ;
PropertyLookup = WS, '.', WS, ((PropertyKeyName, ('?' | '!')) | PropertyKeyName) ;
PropertyLookup = [SP], '.', [SP], ((PropertyKeyName, ('?' | '!')) | PropertyKeyName) ;
Variable = SymbolicName ;
Expand All @@ -222,11 +222,11 @@ NumberLiteral = DoubleLiteral
| IntegerLiteral
;
MapLiteral = '{', WS, [PropertyKeyName, WS, ':', WS, Expression, WS, { ',', WS, PropertyKeyName, WS, ':', WS, Expression, WS }], '}' ;
MapLiteral = '{', [SP], [PropertyKeyName, [SP], ':', [SP], Expression, [SP], { ',', [SP], PropertyKeyName, [SP], ':', [SP], Expression, [SP] }], '}' ;
Parameter = '$', (SymbolicName | DecimalInteger) ;
PropertyExpression = Atom, { WS, PropertyLookup }- ;
PropertyExpression = Atom, { [SP], PropertyLookup }- ;
PropertyKeyName = SymbolicName ;
Expand Down Expand Up @@ -328,8 +328,6 @@ UnescapedSymbolicName = IdentifierStart, { IdentifierPart } ;
(* Any character except "`", enclosed within `backticks`. Backticks are escaped with double backticks. *)EscapedSymbolicName = { '`', { ANY - ('`') }, '`' }- ;
WS = { whitespace } ;
SP = { whitespace }- ;
whitespace = SPACE
Expand Down
Loading

0 comments on commit 150901f

Please sign in to comment.