Skip to content

Commit

Permalink
Merge pull request #73 from walter-weinmann/wwe
Browse files Browse the repository at this point in the history
Version 1.3.1.
  • Loading branch information
walter-weinmann authored May 3, 2017
2 parents 78e3850 + 95a33cf commit 142026e
Show file tree
Hide file tree
Showing 12 changed files with 9,841 additions and 6,527 deletions.
245 changes: 115 additions & 130 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,24 @@ RETURN m
1> {ok, {ParseTree, Tokens}} = ocparse:source_to_pt("MATCH (m:Movie) WHERE m.title = 'The Matrix' RETURN m").
{ok,
{{cypher,
{regularQuery,
{singleQuery,
[{clause,
{match,[],
{pattern,
[{patternPart,[],
{patternElement,
{nodePattern,{symbolicName,"m"},{nodeLabels,[{...}]},[]},
[]}}]},
{where,
{orExpression,
{xorExpression,
{andExpression,
{notExpression,
{comparisonExpression,{addOrSubtractExpression,...},[...]},
[]},
[]},
[]},
[]}}}},
{clause,
{return,[],
{returnBody,
{returnItems,[],[],
[{returnItem,
{orExpression,{xorExpression,{...},...},[]},
[]}]},
[],[],[]}}}]},
[]},
{statement,
{query,
{regularQuery,
{singleQuery,
[{clause,
{match,[],
{pattern,
[{patternPart,[],
{anonymousPatternPart,{patternElement,{...},...}}}]},
{where,
{expression,
{orExpression,{xorExpression,{andExpression,...},[]},[]}}}}},
{clause,
{return,[],
{returnBody,
{returnItems,[],[],[{returnItem,{...},...}]},
[],[],[]}}}]},
[]}}},
[]},
[{'MATCH',1},
{'(',1},
Expand All @@ -69,53 +59,40 @@ RETURN m

```erlang
2> ParseTree.

{cypher,
{regularQuery,
{singleQuery,
[{clause,
{match,[],
{pattern,
[{patternPart,[],
{patternElement,
{nodePattern,
{symbolicName,"m"},
{nodeLabels,[{nodeLabel,{symbolicName,...}}]},
[]},
[]}}]},
{where,
{orExpression,
{xorExpression,
{andExpression,
{notExpression,
{comparisonExpression,
{addOrSubtractExpression,
{multiplyDivideModuloExpression,{...},...},
[]},
[{partialComparisonExpression,{...},...}]},
[]},
[]},
[]},
[]}}}},
{clause,
{return,[],
{returnBody,
{returnItems,[],[],
[{returnItem,
{statement,
{query,
{regularQuery,
{singleQuery,
[{clause,
{match,[],
{pattern,
[{patternPart,[],
{anonymousPatternPart,
{patternElement,
{nodePattern,{variable,...},{...},...},
[]}}}]},
{where,
{expression,
{orExpression,
{xorExpression,{andExpression,{notExpression,...},[]},[]},
[]},
[]}]},
[],[],[]}}}]},
[]},
{xorExpression,
{andExpression,{notExpression,{...},...},[]},
[]},
[]}}}}},
{clause,
{return,[],
{returnBody,
{returnItems,[],[],
[{returnItem,{expression,{orExpression,...}},[]}]},
[],[],[]}}}]},
[]}}},
[]}
```

### Access the token list of the example code:

```erlang
3> Tokens.

[{'MATCH',1},
{'(',1},
{'UNESCAPED_SYMBOLIC_NAME',1,"m"},
Expand All @@ -136,13 +113,11 @@ RETURN m

```erlang
4> ocparse:pt_to_source_td(ParseTree).

<<"match (m :Movie) where m .title = 'The Matrix' return m">>
```

```erlang
5> ocparse:pt_to_source_bu(ParseTree).

<<"match (m :Movie) where m .title = 'The Matrix' return m">>
```

Expand All @@ -152,62 +127,26 @@ The output of the parse tree in the Erlang shell is shortened (cause not known).

```erlang
{cypher,
{regularQuery,
{singleQuery,
[{clause,
{match,[],
{pattern,
[{patternPart,[],
{patternElement,
{nodePattern,
{symbolicName,"m"},
{nodeLabels,[{nodeLabel,{symbolicName,"Movie"}}]},
[]},
[]}}]},
{where,
{orExpression,
{xorExpression,
{andExpression,
{notExpression,
{comparisonExpression,
{addOrSubtractExpression,
{multiplyDivideModuloExpression,
{powerOfExpression,
{unaryAddOrSubtractExpression,
{stringListNullOperatorExpression,
{propertyOrLabelsExpression,
{atom,{symbolicName,"m"}},
[{propertyLookup,{symbolicName,"title"}}]},
[]},
[]},
[]},
{statement,
{query,
{regularQuery,
{singleQuery,
[{clause,
{match,[],
{pattern,
[{patternPart,[],
{anonymousPatternPart,
{patternElement,
{nodePattern,
{variable,{symbolicName,"m"}},
{nodeLabels,
[{nodeLabel,
{labelName,
{schemaName,{symbolicName,"Movie"}}}}]},
[]},
[]},
[{partialComparisonExpression,
{addOrSubtractExpression,
{multiplyDivideModuloExpression,
{powerOfExpression,
{unaryAddOrSubtractExpression,
{stringListNullOperatorExpression,
{propertyOrLabelsExpression,
{atom,
{literal,{stringLiteral,"'The Matrix'"}}},
[]},
[]},
[]},
[]},
[]},
[]},
"="}]},
[]},
[]},
[]},
[]}}}},
{clause,
{return,[],
{returnBody,
{returnItems,[],[],
[{returnItem,
[]}}}]},
{where,
{expression,
{orExpression,
{xorExpression,
{andExpression,
Expand All @@ -219,21 +158,67 @@ The output of the parse tree in the Erlang shell is shortened (cause not known).
{unaryAddOrSubtractExpression,
{stringListNullOperatorExpression,
{propertyOrLabelsExpression,
{atom,{symbolicName,"m"}},
[]},
{atom,{variable,{symbolicName,"m"}}},
[{propertyLookup,
{propertyKeyName,
{schemaName,{symbolicName,"title"}}}}]},
[]},
[]},
[]},
[]},
[]},
[]},
[{partialComparisonExpression,
{addOrSubtractExpression,
{multiplyDivideModuloExpression,
{powerOfExpression,
{unaryAddOrSubtractExpression,
{stringListNullOperatorExpression,
{propertyOrLabelsExpression,
{atom,
{literal,{stringLiteral,"'The Matrix'"}}},
[]},
[]},
[]},
[]},
[]},
[]},
"="}]},
[]},
[]},
[]},
[]},
[]}]},
[],[],[]}}}]},
[]},
[]}}}}},
{clause,
{return,[],
{returnBody,
{returnItems,[],[],
[{returnItem,
{expression,
{orExpression,
{xorExpression,
{andExpression,
{notExpression,
{comparisonExpression,
{addOrSubtractExpression,
{multiplyDivideModuloExpression,
{powerOfExpression,
{unaryAddOrSubtractExpression,
{stringListNullOperatorExpression,
{propertyOrLabelsExpression,
{atom,{variable,{symbolicName,"m"}}},
[]},
[]},
[]},
[]},
[]},
[]},
[]},
[]},
[]},
[]},
[]}},
[]}]},
[],[],[]}}}]},
[]}}},
[]}
```

Expand Down
Loading

0 comments on commit 142026e

Please sign in to comment.