| Author | Dave Jarvis <email> |
|---|---|
| Date | 2015-03-02 23:28:57 GMT-0800 |
| Commit | 625e03fb6b33e83f715d8c455f18cdfdad38c4dd |
| Parent | d964955 |
| Delta | 34 lines added, 33 lines removed, 1-line increase |
|---|
| javadoc { | ||
| - source( "$buildDir/", "source" ) | ||
| + source( "source", "source/antlr" ) | ||
| destinationDir = file( "docs/javadoc" ) | ||
| include( "**/*.java" ) | ||
| options.links( javadocLinks ) | ||
| } | ||
| -task copyLibraries( type: Copy ) { | ||
| - from configurations.runtime | ||
| - into "$buildDir/libs" | ||
| -} | ||
| +// Include dependent libraries into archive. | ||
| +jar { | ||
| + manifest { | ||
| + attributes "Main-Class": "$mainClassName" | ||
| + } | ||
| -run.dependsOn( [copyLibraries] ) | ||
| + from { | ||
| + configurations.compile.collect { | ||
| + it.isDirectory() ? it : zipTree(it) | ||
| + } | ||
| + } | ||
| +} | ||
| run { | ||
| grammarPackage: "com.whitemagicsoftware.rxm.grammar", | ||
| antlrSource: "source/grammar", | ||
| - destinationDir: "build" | ||
| + destinationDir: "source/antlr" | ||
| ] | ||
| Dave Jarvis - Developer | ||
| -Robert Bourret - Reviewer | ||
| +Robert Bourret - Technical Reviews and Sideline Remarks | ||
| -buildDir=build | ||
| - | ||
| -#!/bin/bash | ||
| - | ||
| -# Runs the test case. | ||
| -java -cp lib/*:build/libs/* com.whitemagicsoftware.rxm.Parser test/people.rxm | ||
| /* Define the symbols. */ | ||
| -T_MAP : '>' ; | ||
| -T_INNER : '+>' ; | ||
| -T_OUTER : '->' ; | ||
| -T_POP : '^' ; | ||
| -T_GLOB : '.*' ; | ||
| -T_EOL : ',' ; | ||
| -T_WHERE : ';' ; | ||
| +T_POP : '^' ; | ||
| +T_GLOB : '.*' ; | ||
| +T_MAP : '>' ; | ||
| +T_INNER: '+>' ; | ||
| +T_OUTER: '->' ; | ||
| +T_EOL : ',' ; | ||
| +T_WHERE: ';' ; | ||
| /* Define the table and path symbols. */ | ||
| -T_PERIOD: '.' ; | ||
| T_AT : '@' ; | ||
| +T_PERIOD: '.' ; | ||
| T_SLASH : '/' ; | ||
| T_EXPR_CLOSE: ')' ; | ||
| -query: start line where? EOF ; | ||
| +query: start statement+ where? EOF ; | ||
| /* Define the root, line map, and JOIN clauses. | ||
| */ | ||
| start: (root | module) T_EOL ; | ||
| root : T_ROOT T_MAP element ; | ||
| -line : statement+ ; | ||
| statement: (pop | glob | map | innerJoin | outerJoin | include) T_EOL ; | ||
| import java.io.IOException; | ||
| -import java.nio.charset.Charset; | ||
| -import java.nio.file.Files; | ||
| -import java.nio.file.Paths; | ||
| +import java.util.Stack; | ||
| import org.antlr.v4.runtime.ANTLRInputStream; | ||
| public class Parser extends QueryBaseListener { | ||
| private RXM rxm; | ||
| + | ||
| + /** Used to convert linear map to hierarchical form. */ | ||
| + private Stack stack = new Stack(); | ||
| /** | ||
| @Override | ||
| public void enterRoot( QueryParser.RootContext context ) { | ||
| - | ||
| - } | ||
| - | ||
| - @Override | ||
| - public void exitRoot( QueryParser.RootContext context ) { | ||
| - System.out.println( "<< root" ); | ||
| + String root = context.getChild(2).getText(); | ||
| + getStack().push( "SELECT XMLROOT( XMLELEMENT( NAME " + root ); | ||
| + getStack().push( "VERSION '1.0', STANDALONE YES )" ); | ||
| } | ||
| private RXM getRXM() { | ||
| return this.rxm; | ||
| + } | ||
| + | ||
| + private Stack getStack() { | ||
| + return this.stack; | ||
| } | ||
| } | ||