Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/rxm.git

Added ellipses notation to grammar to reduce duplication of element path information for column maps.

AuthorDave Jarvis <email>
Date2015-03-28 13:28:36 GMT-0700
Commit6643430676b9c9a7c03b2e6286243ba0b549588f
Parentf2a28d0
README.md
# Overview
-Relational eXpression Map (**rxm**) is a database- and output-agnostic
+Relational eXpression Map (**rxm**) is a terse database- and output-agnostic
query language for generating structured documents.
source/grammar/Query.g
/* Define table and path symbols. */
-T_AT : '@' ;
-T_PERIOD: '.' ;
-T_SLASH : '/' ;
+T_ELLIPSES: '...' ;
+T_AT : '@' ;
+T_SLASH : '/' ;
+T_PERIOD : '.' ;
/* Define an identifier. */
element : T_ID ;
elementPath : element (T_SLASH element)* ;
-path : element | elementPath;
+ellipsesPath: T_ELLIPSES T_SLASH elementPath ;
+path : element | elementPath | ellipsesPath;
/************************************************************************
source/java/com/whitemagicsoftware/rxm/DivergentList.java
public int diverges( DivergentList<E> list ) {
int index = -1;
+
+ // Used to determine the larger list for iterating.
boolean smaller = list.size() < this.size();
Iterator<E> iFew = (smaller ? list : this).iterator();
+ // Iterate over the larger list.
for( E e : (smaller ? this : list) ) {
index++;
+ // Terminate when the smaller list runs out of items.
if( !(iFew.hasNext() && e.equals( iFew.next() )) ) {
break;
test/ellipses.rxm
+root > people,
+person > person,
+.first_name > name/first,
+.last_name > .../last,
+.middle_name > .../middle,
+address > address,
+address.person_id +> person.id,
+.id > @id,
+.city > city,
+.region > province,
+.code > postal,
+.street_line1 > street/line1,
+.street_line2 > .../line2,
+.street_line3 > .../line3,
+
Delta26 lines added, 5 lines removed, 21-line increase