Commit ada84325 authored by Jay Jay Billings's avatar Jay Jay Billings
Browse files

Merge remote-tracking branch 'origin/jay/projectSupport' into jay/reflectivity

parents b77fd94c 62000d16
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
icons/,\
contexts.xml
......@@ -30,7 +30,15 @@ import itertools
import subprocess
if sys.version_info >= (3,0):
if sys.version_info < (2,7):
print("")
print("--------------------------- ERROR -----------------------------")
print(" Unsupported Python version: " + sys.version_info.major + "." + sys.version_info.minor)
print(" Please update to Python 2.7 or greater to use the installer.")
print("--------------------------- ERROR -----------------------------")
print("")
exit()
elif sys.version_info >= (3,0):
import urllib.request as urllib2
else:
import urllib2
......
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.ice.parsergenerator.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Parser Generator Tester
Bundle-SymbolicName: org.eclipse.ice.parsergenerator.test
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.ice.parsergenerator.test.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.junit,
org.eclipse.core.resources,
org.eclipse.ice.parsergenerator,
org.eclipse.ice.datastructures
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
/*******************************************************************************
* Copyright (c) 2014 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation - Jay Jay Billings,
* Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson,
* Claire Saunders, Matthew Wang, Anna Wojtowicz
*******************************************************************************/
package org.eclipse.ice.parsergenerator.test;
import org.eclipse.ice.parsergenerator.grammars.FlatGrammar;
import org.junit.Test;
/**
*
*
* @author Andrew Bennett
*/
public class GrammarTester {
private String sep = java.lang.System.lineSeparator();
private String iniGrammar =
"grammar org.eclipse.ice.parsergenerator.ini"+ sep +
"INIFile:" + sep +
" sections+=Section*;" + sep +
"Section:" + sep +
" OPEN + name=ID + CLOSE" + sep +
" (NEWLINE+ lines+=Line)+" + sep +
" NEWLINE+;" + sep +
"Line:" + sep +
" (Entry | Comment);" + sep +
"Entry:" + sep +
" name=ID + ASSIGN + value=TEXT;" + sep +
"Comment:" + sep +
" WHITESPACE? COMMENT TEXT? NEWLINE;" + sep +
"terminal WHITESPACE:" + sep +
" (' ' | '\t')+;" + sep +
"terminal NEWLINE:" + sep +
" '\r'? '\n';" + sep +
"terminal ID:" + sep +
" ('A'..'Z' | 'a'..'z') ('A'..'Z' | 'a'..'z' | '_' | '-' | '0'..'9');" + sep +
"terminal TEXT:" + sep +
" !('\n' | '\r');" + sep +
"terminal COMMENT:" + sep +
" '#';" + sep +
"terminal OPEN:" + sep +
" '[';" + sep +
"terminal CLOSE:" + sep +
" ']';" + sep +
"terminal ASSIGN:" + sep +
" '=';" + sep;
@Test
public void TestGrammar() {
FlatGrammar g = new FlatGrammar();
g.setAssignmentOperator("=");
g.setCommentSymbol("#");
g.setSection("[", "]");
String grammar = g.toString();
System.out.println(iniGrammar);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.ice.parsergenerator</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Parsergenerator
Bundle-SymbolicName: org.eclipse.ice.parsergenerator
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.ice.parsergenerator.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ice.item
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.core.internal.resources,
org.eclipse.core.resources,
org.eclipse.ice.datastructures.form
Export-Package: org.eclipse.ice.parsergenerator,
org.eclipse.ice.parsergenerator.grammars
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.ice.parsergenerator">
<implementation class="org.eclipse.ice.parsergenerator.ParserGenerator"/>
</scr:component>
\ No newline at end of file
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGi-INF/ParserGeneratorComponent.xml
/*******************************************************************************
* Copyright (c) 2013, 2014 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation - Jay Jay Billings,
* Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson,
* Claire Saunders, Matthew Wang, Anna Wojtowicz
*******************************************************************************/
package org.eclipse.ice.parsergenerator;
import org.eclipse.core.resources.IProject;
import org.eclipse.ice.datastructures.form.Form;
import org.eclipse.ice.datastructures.form.FormStatus;
import org.eclipse.ice.item.Item;
/**
* This is an Item that assembles parsers based on various quantities that are
* common to most text parsers and can be set by clients.
*
* @author Andrew Bennett
*/
public class ParserGenerator extends Item {
/**
* Constructor
*/
public ParserGenerator() {
return;
}
/**
* Constructor
*/
public ParserGenerator(IProject projectSpace) {
return;
}
/**
* <p>
* This operation overrides the Item.setupForm() operation.
* </p>
*/
@Override
public void setupForm() {
// Create a fresh form to start with
form = new Form();
// If loading from the new item button we should just
// load up the default case 6 file by passing in null
if (project != null) {
loadInput(null);
}
}
/**
* <p>
* This operation overrides the Item.setupItemInfo() operation.
* </p>
*/
@Override
protected void setupItemInfo() {
return;
}
/**
* <p>
* Overrides the reviewEntries operation. This will still call
* super.reviewEntries, but will handle the dependencies after all other dep
* handing is finished.
* </p>
*
* @return the status of the form
*/
@Override
protected FormStatus reviewEntries(Form preparedForm) {
FormStatus retStatus = FormStatus.ReadyToProcess;
return retStatus;
}
/**
* <p>
* Overrides item's process by adding a customTaggedExportString (ini).
* Still utilizes Item's process functionality for all other calls.
* </p>
*/
@Override
public FormStatus process(String actionName) {
FormStatus retStatus = FormStatus.Processed;
return retStatus;
}
/**
* <p>
* This operation loads the given example into the Form.
* </p>
*
* @param name
* The path name of the example file name to load.
*/
@Override
public void loadInput(String name) {
return;
}
}
/*******************************************************************************
* Copyright (c) 2013, 2014 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation - Jay Jay Billings,
* Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson,
* Claire Saunders, Matthew Wang, Anna Wojtowicz
*******************************************************************************/
package org.eclipse.ice.parsergenerator;
import org.eclipse.core.resources.IProject;
import org.eclipse.ice.item.AbstractItemBuilder;
import org.eclipse.ice.item.Item;
import org.eclipse.ice.item.ItemType;
/**
* This class builds and manages the VibeModel. It inherits its operations from
* ItemBuilder.
*
* @author Scott Forest Hull II, Andrew Bennett
*/
public class ParserGeneratorBuilder extends AbstractItemBuilder {
/**
* The Constructord
*/
public ParserGeneratorBuilder() {
setName("Parser Generator");
setType(ItemType.Model);
}
/*
* (non-Javadoc)
* @see org.eclipse.ice.item.AbstractItemBuilder#getInstance(org.eclipse.core.resources.IProject)
*/
@Override
public Item getInstance(IProject projectSpace) {
// Create a model
Item item = new ParserGenerator(projectSpace);
// Set the item builder's name
item.setItemBuilderName(getItemName());
// Return the item
return item;
}
}
\ No newline at end of file
/*******************************************************************************
* Copyright (c) 2014 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation - Jay Jay Billings,
* Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson,
* Claire Saunders, Matthew Wang, Anna Wojtowicz
*******************************************************************************/
package org.eclipse.ice.parsergenerator.grammars;
import java.util.function.BiFunction;
/**
* Generates an ANTLR grammar that is capable of handling flat formats
* such as INI.
*
* @author arbennett
*/
public class FlatGrammar {
private StringBuilder sb;
private String sep = System.lineSeparator();
private String header = "grammar ItemParser";
private String declaration = "sections+=Section*";
private String content = "section*";
private String entry = "name=ID + ASSIGN + value=TEXT";
private String section = "OPEN + name=ID + CLOSE" + sep +
" (NEWLINE+ lines+=Line)+" + sep +
" NEWLINE+";
private String id = "('A'..'Z' | 'a'..'z') ('A'..'Z' | 'a'..'z' | '_' | '-' | '0'..'9')";
private String whitespace = "(' '|'\t')+;";
private String newline = "'\r'? '\n'+";
private String text = "(WHITESPACE+ | STRING+)*";
private String open;
private String close;
private String assign;
private String comment;
private BiFunction<String, String, String> build = (k,v) -> (k + ":" + sep + " " + v + ";" + sep);
public FlatGrammar() {
sb = new StringBuilder();
}
public void setSection(String o, String c) {
open = "'" + o + "'";
close = "'" + c + "'";
}
public void setAssignmentOperator(String a) {
assign = "'" + a + "'";
}
public void setCommentSymbol(String c) {
comment = "'" + c + "'";
}
private void buildGrammar() {
if (open==null || close==null || assign==null || comment==null)
return;
sb.append(header);
sb.append(build.apply("ItemParser", declaration));
// Intermediate nodes in parse tree
sb.append(build.apply("content", content));
sb.append(build.apply("section", section));
sb.append(build.apply("comment", "COMMENT " + text));
sb.append(build.apply("entry", entry));
// 'terminal' prefix denotes leaf nodes of parse tree
sb.append(build.apply("terminal ID", id));
sb.append(build.apply("terminal TEXT", text));
sb.append(build.apply("terminal NEWLINE", newline));
sb.append(build.apply("terminal WHITESPACE", whitespace));
sb.append(build.apply("terminal OPEN", open));
sb.append(build.apply("terminal CLOSE", close));
sb.append(build.apply("terminal ASSIGN", assign));
sb.append(build.apply("terminal COMMENT", comment));
}
public String toString() {
buildGrammar();
return sb.toString();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment