From 2c2690bb91aa4e33c01d7a799db95112b8dccd6d Mon Sep 17 00:00:00 2001
From: Gabriel Salvador
Date: Mon, 10 Jul 2023 20:25:07 +0100
Subject: [PATCH] grammar and parser creating and configuring elements: not
nesting yet
---
.../controlP5/layout/ControllerFactory.java | 151 +++++++++---
.../java/controlP5/layout/LayoutBuilder.java | 112 ++++++---
src/main/java/controlP5/layout/XML.g4 | 11 +-
.../java/controlP5/layout/lang/XML.interp | 11 +-
.../java/controlP5/layout/lang/XML.tokens | 40 +--
.../layout/lang/XMLBaseListener.java | 12 +
.../controlP5/layout/lang/XMLBaseVisitor.java | 7 +
.../controlP5/layout/lang/XMLLexer.interp | 14 +-
.../java/controlP5/layout/lang/XMLLexer.java | 161 ++++++------
.../controlP5/layout/lang/XMLLexer.tokens | 40 +--
.../controlP5/layout/lang/XMLListener.java | 10 +
.../java/controlP5/layout/lang/XMLParser.java | 233 ++++++++++++------
.../controlP5/layout/lang/XMLVisitor.java | 6 +
src/main/resources/test.xml | 0
14 files changed, 552 insertions(+), 256 deletions(-)
create mode 100644 src/main/resources/test.xml
diff --git a/src/main/java/controlP5/layout/ControllerFactory.java b/src/main/java/controlP5/layout/ControllerFactory.java
index 3a57b56..97162c5 100644
--- a/src/main/java/controlP5/layout/ControllerFactory.java
+++ b/src/main/java/controlP5/layout/ControllerFactory.java
@@ -1,16 +1,18 @@
package controlP5.layout;
import controlP5.*;
-import main.java.controlp5.layout.lang.XMLParser;
+
+import controlP5.layout.lang.XMLParser;
import processing.core.PApplet;
+import java.awt.Color;
import java.lang.reflect.Constructor;
import java.util.*;
public class ControllerFactory {
private final PApplet applet;
private final ControlP5 cp5;
- private final Map> controlMap;
+ private final Map>> controlMap;
public ControllerFactory(PApplet applet, ControlP5 cp5) {
@@ -19,19 +21,21 @@ public class ControllerFactory {
controlMap = new HashMap<>();
-// controlMap.put("Accordion", Accordion.class);
-// controlMap.put("Background", Background.class);
+ controlMap.put("Accordion", Accordion.class);
+ controlMap.put("Background", Background.class);
// controlMap.put("Canvas", Canvas.class);
// controlMap.put("ChartData", ChartData.class);
// controlMap.put("ChartDataSet", ChartDataSet.class);
-// controlMap.put("CheckBox", CheckBox.class);
-// controlMap.put("ColorPicker", ColorPicker.class);
-// controlMap.put("Group", Group.class);
+ controlMap.put("CheckBox", CheckBox.class);
+ controlMap.put("ColorPicker", ColorPicker.class);
+ controlMap.put("Group", Group.class);
// controlMap.put("Label", Label.class);
-// controlMap.put("RadioButton", RadioButton.class);
-// controlMap.put("Textarea", Textarea.class);
+ controlMap.put("RadioButton", RadioButton.class);
+ controlMap.put("Textarea", Textarea.class);
// controlMap.put("TickMark", TickMark.class);
// controlMap.put("Tooltip", Tooltip.class);
+
+ controlMap.put("Accordion", Accordion.class);
controlMap.put("Bang", Bang.class);
controlMap.put("Button", Button.class);
controlMap.put("ButtonBar", ButtonBar.class);
@@ -55,45 +59,110 @@ public class ControllerFactory {
}
- /* creates a controller based on the controlName */
- public Controller> createController(String controlName) {
- Class extends Controller> controllerClass = controlMap.get(controlName);
+ /* creates a ControllerInterface based on the controllerTypeName */
+ public ControllerInterface> createController(String controllerTypeName, Deque propertiesInheritance) {
+ /* Class of the desired controller */
+ Class extends ControllerInterface> controllerClass = controlMap.get(controllerTypeName);
+
if (controllerClass == null) {
- throw new IllegalArgumentException("Invalid control name: " + controlName);
+ throw new IllegalArgumentException("Invalid control name: " + controllerTypeName);
}
try {
//instantiate the controller
- Constructor extends Controller> constructor = controllerClass.getConstructor(ControlP5.class,String.class);
- return constructor.newInstance(cp5,"");
+ Constructor extends ControllerInterface> constructor = controllerClass.getConstructor(ControlP5.class, String.class);
+
+ String uui = UUID.randomUUID().toString();
+
+ ControllerInterface> controller = constructor.newInstance(cp5, uui);
+ LayoutBuilder.ElementProps parentsProps = propertiesInheritance.peek();
+
+
+ return controller;
+
} catch (Exception e) {
- throw new RuntimeException("Failed to create control: " + controlName, e);
+ throw new RuntimeException("Failed to create control: " + controllerTypeName, e);
}
}
- public Group createGroup(String groupName) {
- return new Group(cp5, groupName);
- };
- public void configure(Controller> controller, String attrName, XMLParser.ValueContext attrValueContext) {
- // eg. turn things like '23px' or '35%' into pixels value
- int attrValue = getValue(attrValueContext);
+ public void configure(ControllerInterface> controller, HashMap> attributes,Deque propertiesInheritance ) {
+
+ LayoutBuilder.ElementProps parentsProps = propertiesInheritance.peek();
+
+ for (Map.Entry> entry : attributes.entrySet()) {
+ String attrName = entry.getKey();
+ LayoutBuilder.Attribute> attribute = entry.getValue();
+
+ int width = 0;
+ int height = 0;
+ switch (attrName) {
+ case "x":
+ int x = (int) attribute.getValue();
+ controller.setPosition(x, controller.getPosition()[1]);
+ break;
+ case "y":
+ int y = (int) attribute.getValue();
+
+ controller.setPosition(controller.getPosition()[0], y);
+ break;
+ case "width":
+ //if attribute has an int inside
+ if (attribute.getValue() instanceof Integer) {
+ width = (int) attribute.getValue();
+ height = controller.getHeight();
+ controller.setSize(width, height);
+ }//if it has a percentage
+ else if (attribute.getValue() instanceof LayoutBuilder.Percentage){
+ LayoutBuilder.Percentage percentage = (LayoutBuilder.Percentage) attribute.getValue();
+ float percentageValue = percentage.percentage;
+ width = (int) ( percentageValue / 100.0f * parentsProps.width);
+ height = controller.getHeight();
+ controller.setSize(width, height);
+ }
+
+ case "height":
+ //if attribute has an int inside
+ if (attribute.getValue() instanceof Integer) {
+ height = (int) attribute.getValue();
+ width = controller.getWidth();
+ controller.setSize(width, height);
+ }
+ //if it has a percentage
+ else if (attribute.getValue() instanceof LayoutBuilder.Percentage){
+ int percentageValue = (int) ((LayoutBuilder.Percentage) attribute.getValue()).percentage;
+
+ height = (int) ((percentageValue) / 100.0f * parentsProps.height);
+ width = controller.getWidth();
+ controller.setSize(width, height);
+ }
+
+
+ break;
+// case "position":
+// int[] pos = new int[]{40,40};
+// controller.setPosition(pos[0], pos[1]);
+// break;
+// case "size":
+// int[] size = new int[]{40,40};
+// controller.setSize(1000,500);
+// break;
+ case "background":
+// if attribute has a color inside
+ if (attribute.getValue() instanceof Color) {
+ Color color = (Color) attribute.getValue();
+ int a = color.getAlpha();
+ int r = color.getRed();
+ int g = color.getGreen();
+ int b = color.getBlue();
+ int colorInt = (a << 24) | (r << 16) | (g << 8) | b;
+ if (controller instanceof Group) {
+ ((Group) controller).setBackgroundColor(colorInt);
+ }
+ }
+
+
- switch (attrName) {
- case "x":
- controller.setPosition(attrValue, controller.getPosition()[1]);
- break;
- case "y":
- controller.setPosition(controller.getPosition()[0], attrValue);
- break;
- case "width":
- controller.setWidth(attrValue);
- break;
- case "height":
- controller.setHeight(attrValue);
- break;
- case "color":
- // Assuming color value is given as a hex string
break;
// case "label":
// controller.setLabel(attrValue);
@@ -107,9 +176,13 @@ public class ControllerFactory {
// case "valueLabel":
// controller.getValueLabel().setText(attrValue);
// break;
- default:
- System.out.println("Unknown attribute: " + attrName);
+ default:
+ System.out.println("Unknown attribute: " + attrName);
+ }
+
}
+
+
}
private int getValue(XMLParser.ValueContext ctx) {
diff --git a/src/main/java/controlP5/layout/LayoutBuilder.java b/src/main/java/controlP5/layout/LayoutBuilder.java
index a870bed..c93eb0e 100644
--- a/src/main/java/controlP5/layout/LayoutBuilder.java
+++ b/src/main/java/controlP5/layout/LayoutBuilder.java
@@ -1,14 +1,19 @@
package controlP5.layout;
-import main.java.controlp5.ControlP5;
-import main.java.controlp5.layout.lang.XMLBaseVisitor;
-import main.java.controlp5.layout.lang.XMLLexer;
-import main.java.controlp5.layout.lang.XMLParser;
+import controlP5.ColorPicker;
+import controlP5.ControlP5;
+import controlP5.ControllerInterface;
+import controlP5.Group;
+import controlP5.layout.lang.XMLBaseVisitor;
+import controlP5.layout.lang.XMLLexer;
+import controlP5.layout.lang.XMLParser;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.tree.*;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import processing.core.PApplet;
+
+import java.awt.*;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.HashMap;
@@ -17,11 +22,13 @@ import java.util.HashMap;
public class LayoutBuilder {
private final ControlP5 _cp5;
private final PApplet _pApplet;
- private final Deque contextStack = new ArrayDeque<>();
+ private final Deque propertiesInheritance = new ArrayDeque<>();
+ private final ControllerFactory _factory;
public LayoutBuilder(PApplet pApplet, ControlP5 cp5) {
_cp5 = cp5;
_pApplet = pApplet;
+ _factory = new ControllerFactory(pApplet, _cp5);
}
@@ -52,7 +59,7 @@ public class LayoutBuilder {
}
- //visit first node
+ //visit first node
@Override
public Object visitDocument(XMLParser.DocumentContext ctx) {
// get width and height from the papplet
@@ -61,11 +68,11 @@ public class LayoutBuilder {
//visit children
+ propertiesInheritance.push(new ElementProps(parentWidth, parentHeight));
for (int i = 0; i < ctx.children.size(); i++) {
- contextStack.push(new ElementProps(parentWidth, parentHeight));
visit(ctx.children.get(i));
- contextStack.pop();
}
+ propertiesInheritance.pop();
return null;
@@ -73,55 +80,85 @@ public class LayoutBuilder {
@Override
public Object visitElement(XMLParser.ElementContext ctx) {
- //parent props
- ElementProps parentProps = contextStack.peek();
- Tag tag = (Tag) visitStartTag(ctx.startTag());
- System.out.println("im a " + tag.getName() + " and my parent has " + parentProps.width + " " + parentProps.height);
-
-
- //visit children
- for (int i = 0; i < ctx.children.size(); i++) {
- contextStack.push(new ElementProps(parentProps.width/2, parentProps.height/2));
- visit(ctx.children.get(i));
- contextStack.pop();
+ visitStartTag(ctx.startTag());
+ if(ctx.content() != null){
+ visitContent(ctx.content());
}
-
+ visitEndTag(ctx.endTag());
return null;
}
@Override
public Object visitStartTag(XMLParser.StartTagContext ctx) {
- HashMap> attributes = new HashMap<>();
- for (int i = 0; i < ctx.attribute().size() ; i++) {
+ HashMap> attributes = new HashMap<>();
+ for (int i = 0; i < ctx.attribute().size(); i++) {
Attribute> attribute = (Attribute>) visitAttribute(ctx.attribute(i));
attributes.put(attribute.getName(), attribute);
}
Tag tag = new Tag(ctx.Name().getText(), attributes);
+
+ ControllerInterface> controller = _factory.createController(tag.getName(), propertiesInheritance);
+
+ _factory.configure(controller, tag.getAttributes(),propertiesInheritance);
+
+ //push to the inheritance stack
+ propertiesInheritance.push(new ElementProps(controller.getWidth(), controller.getHeight()));
+
return tag;
}
+ @Override
+ public Object visitContent(XMLParser.ContentContext ctx) {
+ return super.visitContent(ctx);
+ }
+
+ public Object visitEndTag(XMLParser.EndTagContext ctx) {
+ propertiesInheritance.pop();
+ return super.visitEndTag(ctx);
+ }
+
@Override
public Object visitAttribute(XMLParser.AttributeContext ctx) {
- if(ctx.value().STRING() != null){
+ if (ctx.value().STRING() != null) {
String name = ctx.Name().getText();
String value = ctx.value().STRING().getText();
return new Attribute(name, value);
- }else if(ctx.value().NUMBER() != null) {
+ }
+ //if it px
+ else if (ctx.value().UNIT() != null && ctx.value().UNIT().getText().equals("px")) {
String name = ctx.Name().getText();
int value = Integer.parseInt(ctx.value().NUMBER().getText());
-
return new Attribute(name, value);
}
+ //if it a percentage
+ else if(ctx.value().UNIT() != null && ctx.value().UNIT().getText().equals("%")){
+ String name = ctx.Name().getText();
+ int value = Integer.parseInt(ctx.value().NUMBER().getText());
+ Percentage percentage = new Percentage(value);
+ return new Attribute(name, percentage);
+ }
+ // if its a rgb(r,g,b,)
+ else if (ctx.value().rgb() != null) {
+ String name = ctx.Name().getText();
+ int a = 1;
+ int r = Integer.parseInt(ctx.value().rgb().NUMBER(0).getText());
+ int g = Integer.parseInt(ctx.value().rgb().NUMBER(1).getText());
+ int b = Integer.parseInt(ctx.value().rgb().NUMBER(2).getText());
+// Color color = (a << 24) | (r << 16) | (g << 8) | b;
+ Color c = new Color(r,g,b,a);
+ return new Attribute(name, c);
+ }
+
return null;
}
}
- private class ElementProps {
+ public class ElementProps {
int width;
int height;
@@ -133,21 +170,23 @@ public class LayoutBuilder {
private class Tag {
private String name;
- private HashMap> attributes;
+ private HashMap> attributes;
- public Tag(String name, HashMap> attributes) {
+ public Tag(String name, HashMap> attributes) {
this.name = name;
this.attributes = attributes;
}
+
public String getName() {
return name;
}
- public HashMap> getAttributes() {
+
+ public HashMap> getAttributes() {
return attributes;
}
}
- private class Attribute {
+ public class Attribute {
private String name;
private T value;
@@ -155,11 +194,24 @@ public class LayoutBuilder {
this.name = name;
this.value = value;
}
+
public String getName() {
return name;
}
+
public T getValue() {
return value;
}
}
+
+
+ public static class Percentage{
+
+ public float percentage;
+
+ public Percentage (float percentage){
+ this.percentage = percentage;
+ }
+
+ }
}
diff --git a/src/main/java/controlP5/layout/XML.g4 b/src/main/java/controlP5/layout/XML.g4
index 08e98a6..84ad59d 100644
--- a/src/main/java/controlP5/layout/XML.g4
+++ b/src/main/java/controlP5/layout/XML.g4
@@ -1,6 +1,6 @@
grammar XML;
-document : '' element+ '' ;
+document : '' element* '' ;
element : startTag (content )? endTag
| SELF_CLOSING
@@ -10,14 +10,19 @@ startTag : OPEN Name attribute* CLOSE ;
endTag : OPEN_SLASH Name CLOSE ;
+content : element | STRING ;
+
SELF_CLOSING : OPEN Name SLASH_CLOSE ;
attribute : Name EQUALS value ;
-content : element | STRING ;
+
value: STRING
- | NUMBER UNIT;
+ | NUMBER UNIT
+ | rgb;
+
+rgb: 'rgb' '(' NUMBER ',' NUMBER ',' NUMBER ')';
UNIT: 'px' | '%';
WS : [ \t\r\n]+ -> skip;
diff --git a/src/main/java/controlP5/layout/lang/XML.interp b/src/main/java/controlP5/layout/lang/XML.interp
index b98a8de..73e6add 100644
--- a/src/main/java/controlP5/layout/lang/XML.interp
+++ b/src/main/java/controlP5/layout/lang/XML.interp
@@ -2,6 +2,10 @@ token literal names:
null
''
''
+'rgb'
+'('
+','
+')'
null
null
null
@@ -18,6 +22,10 @@ token symbolic names:
null
null
null
+null
+null
+null
+null
SELF_CLOSING
UNIT
WS
@@ -38,7 +46,8 @@ endTag
attribute
content
value
+rgb
atn:
-[4, 1, 13, 59, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 1, 0, 1, 0, 4, 0, 17, 8, 0, 11, 0, 12, 0, 18, 1, 0, 1, 0, 1, 1, 1, 1, 3, 1, 25, 8, 1, 1, 1, 1, 1, 1, 1, 3, 1, 30, 8, 1, 1, 2, 1, 2, 1, 2, 5, 2, 35, 8, 2, 10, 2, 12, 2, 38, 9, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 3, 5, 52, 8, 5, 1, 6, 1, 6, 1, 6, 3, 6, 57, 8, 6, 1, 6, 0, 0, 7, 0, 2, 4, 6, 8, 10, 12, 0, 0, 57, 0, 14, 1, 0, 0, 0, 2, 29, 1, 0, 0, 0, 4, 31, 1, 0, 0, 0, 6, 41, 1, 0, 0, 0, 8, 45, 1, 0, 0, 0, 10, 51, 1, 0, 0, 0, 12, 56, 1, 0, 0, 0, 14, 16, 5, 1, 0, 0, 15, 17, 3, 2, 1, 0, 16, 15, 1, 0, 0, 0, 17, 18, 1, 0, 0, 0, 18, 16, 1, 0, 0, 0, 18, 19, 1, 0, 0, 0, 19, 20, 1, 0, 0, 0, 20, 21, 5, 2, 0, 0, 21, 1, 1, 0, 0, 0, 22, 24, 3, 4, 2, 0, 23, 25, 3, 10, 5, 0, 24, 23, 1, 0, 0, 0, 24, 25, 1, 0, 0, 0, 25, 26, 1, 0, 0, 0, 26, 27, 3, 6, 3, 0, 27, 30, 1, 0, 0, 0, 28, 30, 5, 3, 0, 0, 29, 22, 1, 0, 0, 0, 29, 28, 1, 0, 0, 0, 30, 3, 1, 0, 0, 0, 31, 32, 5, 6, 0, 0, 32, 36, 5, 11, 0, 0, 33, 35, 3, 8, 4, 0, 34, 33, 1, 0, 0, 0, 35, 38, 1, 0, 0, 0, 36, 34, 1, 0, 0, 0, 36, 37, 1, 0, 0, 0, 37, 39, 1, 0, 0, 0, 38, 36, 1, 0, 0, 0, 39, 40, 5, 8, 0, 0, 40, 5, 1, 0, 0, 0, 41, 42, 5, 7, 0, 0, 42, 43, 5, 11, 0, 0, 43, 44, 5, 8, 0, 0, 44, 7, 1, 0, 0, 0, 45, 46, 5, 11, 0, 0, 46, 47, 5, 10, 0, 0, 47, 48, 3, 12, 6, 0, 48, 9, 1, 0, 0, 0, 49, 52, 3, 2, 1, 0, 50, 52, 5, 12, 0, 0, 51, 49, 1, 0, 0, 0, 51, 50, 1, 0, 0, 0, 52, 11, 1, 0, 0, 0, 53, 57, 5, 12, 0, 0, 54, 55, 5, 13, 0, 0, 55, 57, 5, 4, 0, 0, 56, 53, 1, 0, 0, 0, 56, 54, 1, 0, 0, 0, 57, 13, 1, 0, 0, 0, 6, 18, 24, 29, 36, 51, 56]
\ No newline at end of file
+[4, 1, 17, 72, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 1, 0, 1, 0, 5, 0, 19, 8, 0, 10, 0, 12, 0, 22, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 3, 1, 28, 8, 1, 1, 1, 1, 1, 1, 1, 3, 1, 33, 8, 1, 1, 2, 1, 2, 1, 2, 5, 2, 38, 8, 2, 10, 2, 12, 2, 41, 9, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 3, 5, 55, 8, 5, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 61, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 0, 0, 8, 0, 2, 4, 6, 8, 10, 12, 14, 0, 0, 70, 0, 16, 1, 0, 0, 0, 2, 32, 1, 0, 0, 0, 4, 34, 1, 0, 0, 0, 6, 44, 1, 0, 0, 0, 8, 48, 1, 0, 0, 0, 10, 54, 1, 0, 0, 0, 12, 60, 1, 0, 0, 0, 14, 62, 1, 0, 0, 0, 16, 20, 5, 1, 0, 0, 17, 19, 3, 2, 1, 0, 18, 17, 1, 0, 0, 0, 19, 22, 1, 0, 0, 0, 20, 18, 1, 0, 0, 0, 20, 21, 1, 0, 0, 0, 21, 23, 1, 0, 0, 0, 22, 20, 1, 0, 0, 0, 23, 24, 5, 2, 0, 0, 24, 1, 1, 0, 0, 0, 25, 27, 3, 4, 2, 0, 26, 28, 3, 10, 5, 0, 27, 26, 1, 0, 0, 0, 27, 28, 1, 0, 0, 0, 28, 29, 1, 0, 0, 0, 29, 30, 3, 6, 3, 0, 30, 33, 1, 0, 0, 0, 31, 33, 5, 7, 0, 0, 32, 25, 1, 0, 0, 0, 32, 31, 1, 0, 0, 0, 33, 3, 1, 0, 0, 0, 34, 35, 5, 10, 0, 0, 35, 39, 5, 15, 0, 0, 36, 38, 3, 8, 4, 0, 37, 36, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 42, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 42, 43, 5, 12, 0, 0, 43, 5, 1, 0, 0, 0, 44, 45, 5, 11, 0, 0, 45, 46, 5, 15, 0, 0, 46, 47, 5, 12, 0, 0, 47, 7, 1, 0, 0, 0, 48, 49, 5, 15, 0, 0, 49, 50, 5, 14, 0, 0, 50, 51, 3, 12, 6, 0, 51, 9, 1, 0, 0, 0, 52, 55, 3, 2, 1, 0, 53, 55, 5, 16, 0, 0, 54, 52, 1, 0, 0, 0, 54, 53, 1, 0, 0, 0, 55, 11, 1, 0, 0, 0, 56, 61, 5, 16, 0, 0, 57, 58, 5, 17, 0, 0, 58, 61, 5, 8, 0, 0, 59, 61, 3, 14, 7, 0, 60, 56, 1, 0, 0, 0, 60, 57, 1, 0, 0, 0, 60, 59, 1, 0, 0, 0, 61, 13, 1, 0, 0, 0, 62, 63, 5, 3, 0, 0, 63, 64, 5, 4, 0, 0, 64, 65, 5, 17, 0, 0, 65, 66, 5, 5, 0, 0, 66, 67, 5, 17, 0, 0, 67, 68, 5, 5, 0, 0, 68, 69, 5, 17, 0, 0, 69, 70, 5, 6, 0, 0, 70, 15, 1, 0, 0, 0, 6, 20, 27, 32, 39, 54, 60]
\ No newline at end of file
diff --git a/src/main/java/controlP5/layout/lang/XML.tokens b/src/main/java/controlP5/layout/lang/XML.tokens
index 30d639a..4c2ff5b 100644
--- a/src/main/java/controlP5/layout/lang/XML.tokens
+++ b/src/main/java/controlP5/layout/lang/XML.tokens
@@ -1,20 +1,28 @@
T__0=1
T__1=2
-SELF_CLOSING=3
-UNIT=4
-WS=5
-OPEN=6
-OPEN_SLASH=7
-CLOSE=8
-SLASH_CLOSE=9
-EQUALS=10
-Name=11
-STRING=12
-NUMBER=13
+T__2=3
+T__3=4
+T__4=5
+T__5=6
+SELF_CLOSING=7
+UNIT=8
+WS=9
+OPEN=10
+OPEN_SLASH=11
+CLOSE=12
+SLASH_CLOSE=13
+EQUALS=14
+Name=15
+STRING=16
+NUMBER=17
''=1
''=2
-'<'=6
-''=7
-'>'=8
-'/>'=9
-'='=10
+'rgb'=3
+'('=4
+','=5
+')'=6
+'<'=10
+''=11
+'>'=12
+'/>'=13
+'='=14
diff --git a/src/main/java/controlP5/layout/lang/XMLBaseListener.java b/src/main/java/controlP5/layout/lang/XMLBaseListener.java
index 00befed..83abba9 100644
--- a/src/main/java/controlP5/layout/lang/XMLBaseListener.java
+++ b/src/main/java/controlP5/layout/lang/XMLBaseListener.java
@@ -96,6 +96,18 @@ public class XMLBaseListener implements XMLListener {
* The default implementation does nothing.
*/
@Override public void exitValue(XMLParser.ValueContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void enterRgb(XMLParser.RgbContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation does nothing.
+ */
+ @Override public void exitRgb(XMLParser.RgbContext ctx) { }
/**
* {@inheritDoc}
diff --git a/src/main/java/controlP5/layout/lang/XMLBaseVisitor.java b/src/main/java/controlP5/layout/lang/XMLBaseVisitor.java
index 07fbb5b..9102ab5 100644
--- a/src/main/java/controlP5/layout/lang/XMLBaseVisitor.java
+++ b/src/main/java/controlP5/layout/lang/XMLBaseVisitor.java
@@ -61,4 +61,11 @@ public class XMLBaseVisitor extends AbstractParseTreeVisitor implements XM
* {@link #visitChildren} on {@code ctx}.
*/
@Override public T visitValue(XMLParser.ValueContext ctx) { return visitChildren(ctx); }
+ /**
+ * {@inheritDoc}
+ *
+ * The default implementation returns the result of calling
+ * {@link #visitChildren} on {@code ctx}.
+ */
+ @Override public T visitRgb(XMLParser.RgbContext ctx) { return visitChildren(ctx); }
}
\ No newline at end of file
diff --git a/src/main/java/controlP5/layout/lang/XMLLexer.interp b/src/main/java/controlP5/layout/lang/XMLLexer.interp
index 5848fd8..5aa144c 100644
--- a/src/main/java/controlP5/layout/lang/XMLLexer.interp
+++ b/src/main/java/controlP5/layout/lang/XMLLexer.interp
@@ -2,6 +2,10 @@ token literal names:
null
''
''
+'rgb'
+'('
+','
+')'
null
null
null
@@ -18,6 +22,10 @@ token symbolic names:
null
null
null
+null
+null
+null
+null
SELF_CLOSING
UNIT
WS
@@ -33,6 +41,10 @@ NUMBER
rule names:
T__0
T__1
+T__2
+T__3
+T__4
+T__5
SELF_CLOSING
UNIT
WS
@@ -55,4 +67,4 @@ mode names:
DEFAULT_MODE
atn:
-[4, 0, 13, 114, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 3, 3, 58, 8, 3, 1, 4, 4, 4, 61, 8, 4, 11, 4, 12, 4, 62, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 5, 10, 83, 8, 10, 10, 10, 12, 10, 86, 9, 10, 1, 11, 1, 11, 5, 11, 90, 8, 11, 10, 11, 12, 11, 93, 9, 11, 1, 11, 1, 11, 1, 11, 5, 11, 98, 8, 11, 10, 11, 12, 11, 101, 9, 11, 1, 11, 3, 11, 104, 8, 11, 1, 12, 4, 12, 107, 8, 12, 11, 12, 12, 12, 108, 1, 13, 1, 13, 1, 14, 1, 14, 0, 0, 15, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 0, 29, 0, 1, 0, 6, 3, 0, 9, 10, 13, 13, 32, 32, 2, 0, 45, 46, 95, 95, 1, 0, 34, 34, 1, 0, 39, 39, 1, 0, 48, 57, 2, 0, 65, 90, 97, 122, 120, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 1, 31, 1, 0, 0, 0, 3, 40, 1, 0, 0, 0, 5, 50, 1, 0, 0, 0, 7, 57, 1, 0, 0, 0, 9, 60, 1, 0, 0, 0, 11, 66, 1, 0, 0, 0, 13, 68, 1, 0, 0, 0, 15, 71, 1, 0, 0, 0, 17, 73, 1, 0, 0, 0, 19, 76, 1, 0, 0, 0, 21, 78, 1, 0, 0, 0, 23, 103, 1, 0, 0, 0, 25, 106, 1, 0, 0, 0, 27, 110, 1, 0, 0, 0, 29, 112, 1, 0, 0, 0, 31, 32, 5, 60, 0, 0, 32, 33, 5, 87, 0, 0, 33, 34, 5, 105, 0, 0, 34, 35, 5, 110, 0, 0, 35, 36, 5, 100, 0, 0, 36, 37, 5, 111, 0, 0, 37, 38, 5, 119, 0, 0, 38, 39, 5, 62, 0, 0, 39, 2, 1, 0, 0, 0, 40, 41, 5, 60, 0, 0, 41, 42, 5, 47, 0, 0, 42, 43, 5, 87, 0, 0, 43, 44, 5, 105, 0, 0, 44, 45, 5, 110, 0, 0, 45, 46, 5, 100, 0, 0, 46, 47, 5, 111, 0, 0, 47, 48, 5, 119, 0, 0, 48, 49, 5, 62, 0, 0, 49, 4, 1, 0, 0, 0, 50, 51, 3, 11, 5, 0, 51, 52, 3, 21, 10, 0, 52, 53, 3, 17, 8, 0, 53, 6, 1, 0, 0, 0, 54, 55, 5, 112, 0, 0, 55, 58, 5, 120, 0, 0, 56, 58, 5, 37, 0, 0, 57, 54, 1, 0, 0, 0, 57, 56, 1, 0, 0, 0, 58, 8, 1, 0, 0, 0, 59, 61, 7, 0, 0, 0, 60, 59, 1, 0, 0, 0, 61, 62, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 65, 6, 4, 0, 0, 65, 10, 1, 0, 0, 0, 66, 67, 5, 60, 0, 0, 67, 12, 1, 0, 0, 0, 68, 69, 5, 60, 0, 0, 69, 70, 5, 47, 0, 0, 70, 14, 1, 0, 0, 0, 71, 72, 5, 62, 0, 0, 72, 16, 1, 0, 0, 0, 73, 74, 5, 47, 0, 0, 74, 75, 5, 62, 0, 0, 75, 18, 1, 0, 0, 0, 76, 77, 5, 61, 0, 0, 77, 20, 1, 0, 0, 0, 78, 84, 3, 29, 14, 0, 79, 83, 3, 29, 14, 0, 80, 83, 3, 27, 13, 0, 81, 83, 7, 1, 0, 0, 82, 79, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 81, 1, 0, 0, 0, 83, 86, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 84, 85, 1, 0, 0, 0, 85, 22, 1, 0, 0, 0, 86, 84, 1, 0, 0, 0, 87, 91, 5, 34, 0, 0, 88, 90, 8, 2, 0, 0, 89, 88, 1, 0, 0, 0, 90, 93, 1, 0, 0, 0, 91, 89, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 94, 1, 0, 0, 0, 93, 91, 1, 0, 0, 0, 94, 104, 5, 34, 0, 0, 95, 99, 5, 39, 0, 0, 96, 98, 8, 3, 0, 0, 97, 96, 1, 0, 0, 0, 98, 101, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 99, 100, 1, 0, 0, 0, 100, 102, 1, 0, 0, 0, 101, 99, 1, 0, 0, 0, 102, 104, 5, 39, 0, 0, 103, 87, 1, 0, 0, 0, 103, 95, 1, 0, 0, 0, 104, 24, 1, 0, 0, 0, 105, 107, 3, 27, 13, 0, 106, 105, 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 108, 109, 1, 0, 0, 0, 109, 26, 1, 0, 0, 0, 110, 111, 7, 4, 0, 0, 111, 28, 1, 0, 0, 0, 112, 113, 7, 5, 0, 0, 113, 30, 1, 0, 0, 0, 9, 0, 57, 62, 82, 84, 91, 99, 103, 108, 1, 6, 0, 0]
\ No newline at end of file
+[4, 0, 17, 132, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 3, 7, 76, 8, 7, 1, 8, 4, 8, 79, 8, 8, 11, 8, 12, 8, 80, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 101, 8, 14, 10, 14, 12, 14, 104, 9, 14, 1, 15, 1, 15, 5, 15, 108, 8, 15, 10, 15, 12, 15, 111, 9, 15, 1, 15, 1, 15, 1, 15, 5, 15, 116, 8, 15, 10, 15, 12, 15, 119, 9, 15, 1, 15, 3, 15, 122, 8, 15, 1, 16, 4, 16, 125, 8, 16, 11, 16, 12, 16, 126, 1, 17, 1, 17, 1, 18, 1, 18, 0, 0, 19, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 0, 37, 0, 1, 0, 6, 3, 0, 9, 10, 13, 13, 32, 32, 2, 0, 45, 46, 95, 95, 1, 0, 34, 34, 1, 0, 39, 39, 1, 0, 48, 57, 2, 0, 65, 90, 97, 122, 138, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 1, 39, 1, 0, 0, 0, 3, 48, 1, 0, 0, 0, 5, 58, 1, 0, 0, 0, 7, 62, 1, 0, 0, 0, 9, 64, 1, 0, 0, 0, 11, 66, 1, 0, 0, 0, 13, 68, 1, 0, 0, 0, 15, 75, 1, 0, 0, 0, 17, 78, 1, 0, 0, 0, 19, 84, 1, 0, 0, 0, 21, 86, 1, 0, 0, 0, 23, 89, 1, 0, 0, 0, 25, 91, 1, 0, 0, 0, 27, 94, 1, 0, 0, 0, 29, 96, 1, 0, 0, 0, 31, 121, 1, 0, 0, 0, 33, 124, 1, 0, 0, 0, 35, 128, 1, 0, 0, 0, 37, 130, 1, 0, 0, 0, 39, 40, 5, 60, 0, 0, 40, 41, 5, 87, 0, 0, 41, 42, 5, 105, 0, 0, 42, 43, 5, 110, 0, 0, 43, 44, 5, 100, 0, 0, 44, 45, 5, 111, 0, 0, 45, 46, 5, 119, 0, 0, 46, 47, 5, 62, 0, 0, 47, 2, 1, 0, 0, 0, 48, 49, 5, 60, 0, 0, 49, 50, 5, 47, 0, 0, 50, 51, 5, 87, 0, 0, 51, 52, 5, 105, 0, 0, 52, 53, 5, 110, 0, 0, 53, 54, 5, 100, 0, 0, 54, 55, 5, 111, 0, 0, 55, 56, 5, 119, 0, 0, 56, 57, 5, 62, 0, 0, 57, 4, 1, 0, 0, 0, 58, 59, 5, 114, 0, 0, 59, 60, 5, 103, 0, 0, 60, 61, 5, 98, 0, 0, 61, 6, 1, 0, 0, 0, 62, 63, 5, 40, 0, 0, 63, 8, 1, 0, 0, 0, 64, 65, 5, 44, 0, 0, 65, 10, 1, 0, 0, 0, 66, 67, 5, 41, 0, 0, 67, 12, 1, 0, 0, 0, 68, 69, 3, 19, 9, 0, 69, 70, 3, 29, 14, 0, 70, 71, 3, 25, 12, 0, 71, 14, 1, 0, 0, 0, 72, 73, 5, 112, 0, 0, 73, 76, 5, 120, 0, 0, 74, 76, 5, 37, 0, 0, 75, 72, 1, 0, 0, 0, 75, 74, 1, 0, 0, 0, 76, 16, 1, 0, 0, 0, 77, 79, 7, 0, 0, 0, 78, 77, 1, 0, 0, 0, 79, 80, 1, 0, 0, 0, 80, 78, 1, 0, 0, 0, 80, 81, 1, 0, 0, 0, 81, 82, 1, 0, 0, 0, 82, 83, 6, 8, 0, 0, 83, 18, 1, 0, 0, 0, 84, 85, 5, 60, 0, 0, 85, 20, 1, 0, 0, 0, 86, 87, 5, 60, 0, 0, 87, 88, 5, 47, 0, 0, 88, 22, 1, 0, 0, 0, 89, 90, 5, 62, 0, 0, 90, 24, 1, 0, 0, 0, 91, 92, 5, 47, 0, 0, 92, 93, 5, 62, 0, 0, 93, 26, 1, 0, 0, 0, 94, 95, 5, 61, 0, 0, 95, 28, 1, 0, 0, 0, 96, 102, 3, 37, 18, 0, 97, 101, 3, 37, 18, 0, 98, 101, 3, 35, 17, 0, 99, 101, 7, 1, 0, 0, 100, 97, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 100, 99, 1, 0, 0, 0, 101, 104, 1, 0, 0, 0, 102, 100, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 30, 1, 0, 0, 0, 104, 102, 1, 0, 0, 0, 105, 109, 5, 34, 0, 0, 106, 108, 8, 2, 0, 0, 107, 106, 1, 0, 0, 0, 108, 111, 1, 0, 0, 0, 109, 107, 1, 0, 0, 0, 109, 110, 1, 0, 0, 0, 110, 112, 1, 0, 0, 0, 111, 109, 1, 0, 0, 0, 112, 122, 5, 34, 0, 0, 113, 117, 5, 39, 0, 0, 114, 116, 8, 3, 0, 0, 115, 114, 1, 0, 0, 0, 116, 119, 1, 0, 0, 0, 117, 115, 1, 0, 0, 0, 117, 118, 1, 0, 0, 0, 118, 120, 1, 0, 0, 0, 119, 117, 1, 0, 0, 0, 120, 122, 5, 39, 0, 0, 121, 105, 1, 0, 0, 0, 121, 113, 1, 0, 0, 0, 122, 32, 1, 0, 0, 0, 123, 125, 3, 35, 17, 0, 124, 123, 1, 0, 0, 0, 125, 126, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 126, 127, 1, 0, 0, 0, 127, 34, 1, 0, 0, 0, 128, 129, 7, 4, 0, 0, 129, 36, 1, 0, 0, 0, 130, 131, 7, 5, 0, 0, 131, 38, 1, 0, 0, 0, 9, 0, 75, 80, 100, 102, 109, 117, 121, 126, 1, 6, 0, 0]
\ No newline at end of file
diff --git a/src/main/java/controlP5/layout/lang/XMLLexer.java b/src/main/java/controlP5/layout/lang/XMLLexer.java
index f634b64..32f104f 100644
--- a/src/main/java/controlP5/layout/lang/XMLLexer.java
+++ b/src/main/java/controlP5/layout/lang/XMLLexer.java
@@ -17,8 +17,9 @@ public class XMLLexer extends Lexer {
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
- T__0=1, T__1=2, SELF_CLOSING=3, UNIT=4, WS=5, OPEN=6, OPEN_SLASH=7, CLOSE=8,
- SLASH_CLOSE=9, EQUALS=10, Name=11, STRING=12, NUMBER=13;
+ T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, SELF_CLOSING=7, UNIT=8,
+ WS=9, OPEN=10, OPEN_SLASH=11, CLOSE=12, SLASH_CLOSE=13, EQUALS=14, Name=15,
+ STRING=16, NUMBER=17;
public static String[] channelNames = {
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
};
@@ -29,23 +30,25 @@ public class XMLLexer extends Lexer {
private static String[] makeRuleNames() {
return new String[] {
- "T__0", "T__1", "SELF_CLOSING", "UNIT", "WS", "OPEN", "OPEN_SLASH", "CLOSE",
- "SLASH_CLOSE", "EQUALS", "Name", "STRING", "NUMBER", "DIGIT", "ALPHA"
+ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "SELF_CLOSING", "UNIT",
+ "WS", "OPEN", "OPEN_SLASH", "CLOSE", "SLASH_CLOSE", "EQUALS", "Name",
+ "STRING", "NUMBER", "DIGIT", "ALPHA"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
- null, "''", "''", null, null, null, "'<'", "''", "'>'",
- "'/>'", "'='"
+ null, "''", "''", "'rgb'", "'('", "','", "')'", null,
+ null, null, "'<'", "''", "'>'", "'/>'", "'='"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
- null, null, null, "SELF_CLOSING", "UNIT", "WS", "OPEN", "OPEN_SLASH",
- "CLOSE", "SLASH_CLOSE", "EQUALS", "Name", "STRING", "NUMBER"
+ null, null, null, null, null, null, null, "SELF_CLOSING", "UNIT", "WS",
+ "OPEN", "OPEN_SLASH", "CLOSE", "SLASH_CLOSE", "EQUALS", "Name", "STRING",
+ "NUMBER"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
@@ -107,73 +110,83 @@ public class XMLLexer extends Lexer {
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
- "\u0004\u0000\rr\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+
- "\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004"+
- "\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007"+
- "\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b"+
- "\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0001"+
- "\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001"+
- "\u0000\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001"+
+ "\u0004\u0000\u0011\u0084\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002"+
+ "\u0001\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002"+
+ "\u0004\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002"+
+ "\u0007\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002"+
+ "\u000b\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e"+
+ "\u0002\u000f\u0007\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011"+
+ "\u0002\u0012\u0007\u0012\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000"+
+ "\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001"+
"\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001"+
- "\u0001\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0003\u0001"+
- "\u0003\u0001\u0003\u0003\u0003:\b\u0003\u0001\u0004\u0004\u0004=\b\u0004"+
- "\u000b\u0004\f\u0004>\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005"+
- "\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001\b\u0001"+
- "\b\u0001\b\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\u0001\n\u0005\nS\b"+
- "\n\n\n\f\nV\t\n\u0001\u000b\u0001\u000b\u0005\u000bZ\b\u000b\n\u000b\f"+
- "\u000b]\t\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0005\u000bb\b\u000b"+
- "\n\u000b\f\u000be\t\u000b\u0001\u000b\u0003\u000bh\b\u000b\u0001\f\u0004"+
- "\fk\b\f\u000b\f\f\fl\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0000\u0000"+
- "\u000f\u0001\u0001\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005\u000b\u0006"+
- "\r\u0007\u000f\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019\r\u001b\u0000"+
- "\u001d\u0000\u0001\u0000\u0006\u0003\u0000\t\n\r\r \u0002\u0000-.__\u0001"+
- "\u0000\"\"\u0001\u0000\'\'\u0001\u000009\u0002\u0000AZazx\u0000\u0001"+
- "\u0001\u0000\u0000\u0000\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005"+
- "\u0001\u0000\u0000\u0000\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001"+
- "\u0000\u0000\u0000\u0000\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000"+
- "\u0000\u0000\u0000\u000f\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000"+
- "\u0000\u0000\u0000\u0013\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000"+
- "\u0000\u0000\u0000\u0017\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000"+
- "\u0000\u0000\u0001\u001f\u0001\u0000\u0000\u0000\u0003(\u0001\u0000\u0000"+
- "\u0000\u00052\u0001\u0000\u0000\u0000\u00079\u0001\u0000\u0000\u0000\t"+
- "<\u0001\u0000\u0000\u0000\u000bB\u0001\u0000\u0000\u0000\rD\u0001\u0000"+
- "\u0000\u0000\u000fG\u0001\u0000\u0000\u0000\u0011I\u0001\u0000\u0000\u0000"+
- "\u0013L\u0001\u0000\u0000\u0000\u0015N\u0001\u0000\u0000\u0000\u0017g"+
- "\u0001\u0000\u0000\u0000\u0019j\u0001\u0000\u0000\u0000\u001bn\u0001\u0000"+
- "\u0000\u0000\u001dp\u0001\u0000\u0000\u0000\u001f \u0005<\u0000\u0000"+
- " !\u0005W\u0000\u0000!\"\u0005i\u0000\u0000\"#\u0005n\u0000\u0000#$\u0005"+
- "d\u0000\u0000$%\u0005o\u0000\u0000%&\u0005w\u0000\u0000&\'\u0005>\u0000"+
- "\u0000\'\u0002\u0001\u0000\u0000\u0000()\u0005<\u0000\u0000)*\u0005/\u0000"+
- "\u0000*+\u0005W\u0000\u0000+,\u0005i\u0000\u0000,-\u0005n\u0000\u0000"+
- "-.\u0005d\u0000\u0000./\u0005o\u0000\u0000/0\u0005w\u0000\u000001\u0005"+
- ">\u0000\u00001\u0004\u0001\u0000\u0000\u000023\u0003\u000b\u0005\u0000"+
- "34\u0003\u0015\n\u000045\u0003\u0011\b\u00005\u0006\u0001\u0000\u0000"+
- "\u000067\u0005p\u0000\u00007:\u0005x\u0000\u00008:\u0005%\u0000\u0000"+
- "96\u0001\u0000\u0000\u000098\u0001\u0000\u0000\u0000:\b\u0001\u0000\u0000"+
- "\u0000;=\u0007\u0000\u0000\u0000<;\u0001\u0000\u0000\u0000=>\u0001\u0000"+
- "\u0000\u0000><\u0001\u0000\u0000\u0000>?\u0001\u0000\u0000\u0000?@\u0001"+
- "\u0000\u0000\u0000@A\u0006\u0004\u0000\u0000A\n\u0001\u0000\u0000\u0000"+
- "BC\u0005<\u0000\u0000C\f\u0001\u0000\u0000\u0000DE\u0005<\u0000\u0000"+
- "EF\u0005/\u0000\u0000F\u000e\u0001\u0000\u0000\u0000GH\u0005>\u0000\u0000"+
- "H\u0010\u0001\u0000\u0000\u0000IJ\u0005/\u0000\u0000JK\u0005>\u0000\u0000"+
- "K\u0012\u0001\u0000\u0000\u0000LM\u0005=\u0000\u0000M\u0014\u0001\u0000"+
- "\u0000\u0000NT\u0003\u001d\u000e\u0000OS\u0003\u001d\u000e\u0000PS\u0003"+
- "\u001b\r\u0000QS\u0007\u0001\u0000\u0000RO\u0001\u0000\u0000\u0000RP\u0001"+
- "\u0000\u0000\u0000RQ\u0001\u0000\u0000\u0000SV\u0001\u0000\u0000\u0000"+
- "TR\u0001\u0000\u0000\u0000TU\u0001\u0000\u0000\u0000U\u0016\u0001\u0000"+
- "\u0000\u0000VT\u0001\u0000\u0000\u0000W[\u0005\"\u0000\u0000XZ\b\u0002"+
- "\u0000\u0000YX\u0001\u0000\u0000\u0000Z]\u0001\u0000\u0000\u0000[Y\u0001"+
- "\u0000\u0000\u0000[\\\u0001\u0000\u0000\u0000\\^\u0001\u0000\u0000\u0000"+
- "][\u0001\u0000\u0000\u0000^h\u0005\"\u0000\u0000_c\u0005\'\u0000\u0000"+
- "`b\b\u0003\u0000\u0000a`\u0001\u0000\u0000\u0000be\u0001\u0000\u0000\u0000"+
- "ca\u0001\u0000\u0000\u0000cd\u0001\u0000\u0000\u0000df\u0001\u0000\u0000"+
- "\u0000ec\u0001\u0000\u0000\u0000fh\u0005\'\u0000\u0000gW\u0001\u0000\u0000"+
- "\u0000g_\u0001\u0000\u0000\u0000h\u0018\u0001\u0000\u0000\u0000ik\u0003"+
- "\u001b\r\u0000ji\u0001\u0000\u0000\u0000kl\u0001\u0000\u0000\u0000lj\u0001"+
- "\u0000\u0000\u0000lm\u0001\u0000\u0000\u0000m\u001a\u0001\u0000\u0000"+
- "\u0000no\u0007\u0004\u0000\u0000o\u001c\u0001\u0000\u0000\u0000pq\u0007"+
- "\u0005\u0000\u0000q\u001e\u0001\u0000\u0000\u0000\t\u00009>RT[cgl\u0001"+
- "\u0006\u0000\u0000";
+ "\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0002"+
+ "\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0005"+
+ "\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0007"+
+ "\u0001\u0007\u0001\u0007\u0003\u0007L\b\u0007\u0001\b\u0004\bO\b\b\u000b"+
+ "\b\f\bP\u0001\b\u0001\b\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\u0001"+
+ "\u000b\u0001\u000b\u0001\f\u0001\f\u0001\f\u0001\r\u0001\r\u0001\u000e"+
+ "\u0001\u000e\u0001\u000e\u0001\u000e\u0005\u000ee\b\u000e\n\u000e\f\u000e"+
+ "h\t\u000e\u0001\u000f\u0001\u000f\u0005\u000fl\b\u000f\n\u000f\f\u000f"+
+ "o\t\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0005\u000ft\b\u000f\n\u000f"+
+ "\f\u000fw\t\u000f\u0001\u000f\u0003\u000fz\b\u000f\u0001\u0010\u0004\u0010"+
+ "}\b\u0010\u000b\u0010\f\u0010~\u0001\u0011\u0001\u0011\u0001\u0012\u0001"+
+ "\u0012\u0000\u0000\u0013\u0001\u0001\u0003\u0002\u0005\u0003\u0007\u0004"+
+ "\t\u0005\u000b\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015\u000b\u0017"+
+ "\f\u0019\r\u001b\u000e\u001d\u000f\u001f\u0010!\u0011#\u0000%\u0000\u0001"+
+ "\u0000\u0006\u0003\u0000\t\n\r\r \u0002\u0000-.__\u0001\u0000\"\"\u0001"+
+ "\u0000\'\'\u0001\u000009\u0002\u0000AZaz\u008a\u0000\u0001\u0001\u0000"+
+ "\u0000\u0000\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005\u0001\u0000"+
+ "\u0000\u0000\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000"+
+ "\u0000\u0000\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000\u0000\u0000"+
+ "\u0000\u000f\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000\u0000\u0000"+
+ "\u0000\u0013\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000\u0000\u0000"+
+ "\u0000\u0017\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000\u0000\u0000"+
+ "\u0000\u001b\u0001\u0000\u0000\u0000\u0000\u001d\u0001\u0000\u0000\u0000"+
+ "\u0000\u001f\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000\u0000\u0001"+
+ "\'\u0001\u0000\u0000\u0000\u00030\u0001\u0000\u0000\u0000\u0005:\u0001"+
+ "\u0000\u0000\u0000\u0007>\u0001\u0000\u0000\u0000\t@\u0001\u0000\u0000"+
+ "\u0000\u000bB\u0001\u0000\u0000\u0000\rD\u0001\u0000\u0000\u0000\u000f"+
+ "K\u0001\u0000\u0000\u0000\u0011N\u0001\u0000\u0000\u0000\u0013T\u0001"+
+ "\u0000\u0000\u0000\u0015V\u0001\u0000\u0000\u0000\u0017Y\u0001\u0000\u0000"+
+ "\u0000\u0019[\u0001\u0000\u0000\u0000\u001b^\u0001\u0000\u0000\u0000\u001d"+
+ "`\u0001\u0000\u0000\u0000\u001fy\u0001\u0000\u0000\u0000!|\u0001\u0000"+
+ "\u0000\u0000#\u0080\u0001\u0000\u0000\u0000%\u0082\u0001\u0000\u0000\u0000"+
+ "\'(\u0005<\u0000\u0000()\u0005W\u0000\u0000)*\u0005i\u0000\u0000*+\u0005"+
+ "n\u0000\u0000+,\u0005d\u0000\u0000,-\u0005o\u0000\u0000-.\u0005w\u0000"+
+ "\u0000./\u0005>\u0000\u0000/\u0002\u0001\u0000\u0000\u000001\u0005<\u0000"+
+ "\u000012\u0005/\u0000\u000023\u0005W\u0000\u000034\u0005i\u0000\u0000"+
+ "45\u0005n\u0000\u000056\u0005d\u0000\u000067\u0005o\u0000\u000078\u0005"+
+ "w\u0000\u000089\u0005>\u0000\u00009\u0004\u0001\u0000\u0000\u0000:;\u0005"+
+ "r\u0000\u0000;<\u0005g\u0000\u0000<=\u0005b\u0000\u0000=\u0006\u0001\u0000"+
+ "\u0000\u0000>?\u0005(\u0000\u0000?\b\u0001\u0000\u0000\u0000@A\u0005,"+
+ "\u0000\u0000A\n\u0001\u0000\u0000\u0000BC\u0005)\u0000\u0000C\f\u0001"+
+ "\u0000\u0000\u0000DE\u0003\u0013\t\u0000EF\u0003\u001d\u000e\u0000FG\u0003"+
+ "\u0019\f\u0000G\u000e\u0001\u0000\u0000\u0000HI\u0005p\u0000\u0000IL\u0005"+
+ "x\u0000\u0000JL\u0005%\u0000\u0000KH\u0001\u0000\u0000\u0000KJ\u0001\u0000"+
+ "\u0000\u0000L\u0010\u0001\u0000\u0000\u0000MO\u0007\u0000\u0000\u0000"+
+ "NM\u0001\u0000\u0000\u0000OP\u0001\u0000\u0000\u0000PN\u0001\u0000\u0000"+
+ "\u0000PQ\u0001\u0000\u0000\u0000QR\u0001\u0000\u0000\u0000RS\u0006\b\u0000"+
+ "\u0000S\u0012\u0001\u0000\u0000\u0000TU\u0005<\u0000\u0000U\u0014\u0001"+
+ "\u0000\u0000\u0000VW\u0005<\u0000\u0000WX\u0005/\u0000\u0000X\u0016\u0001"+
+ "\u0000\u0000\u0000YZ\u0005>\u0000\u0000Z\u0018\u0001\u0000\u0000\u0000"+
+ "[\\\u0005/\u0000\u0000\\]\u0005>\u0000\u0000]\u001a\u0001\u0000\u0000"+
+ "\u0000^_\u0005=\u0000\u0000_\u001c\u0001\u0000\u0000\u0000`f\u0003%\u0012"+
+ "\u0000ae\u0003%\u0012\u0000be\u0003#\u0011\u0000ce\u0007\u0001\u0000\u0000"+
+ "da\u0001\u0000\u0000\u0000db\u0001\u0000\u0000\u0000dc\u0001\u0000\u0000"+
+ "\u0000eh\u0001\u0000\u0000\u0000fd\u0001\u0000\u0000\u0000fg\u0001\u0000"+
+ "\u0000\u0000g\u001e\u0001\u0000\u0000\u0000hf\u0001\u0000\u0000\u0000"+
+ "im\u0005\"\u0000\u0000jl\b\u0002\u0000\u0000kj\u0001\u0000\u0000\u0000"+
+ "lo\u0001\u0000\u0000\u0000mk\u0001\u0000\u0000\u0000mn\u0001\u0000\u0000"+
+ "\u0000np\u0001\u0000\u0000\u0000om\u0001\u0000\u0000\u0000pz\u0005\"\u0000"+
+ "\u0000qu\u0005\'\u0000\u0000rt\b\u0003\u0000\u0000sr\u0001\u0000\u0000"+
+ "\u0000tw\u0001\u0000\u0000\u0000us\u0001\u0000\u0000\u0000uv\u0001\u0000"+
+ "\u0000\u0000vx\u0001\u0000\u0000\u0000wu\u0001\u0000\u0000\u0000xz\u0005"+
+ "\'\u0000\u0000yi\u0001\u0000\u0000\u0000yq\u0001\u0000\u0000\u0000z \u0001"+
+ "\u0000\u0000\u0000{}\u0003#\u0011\u0000|{\u0001\u0000\u0000\u0000}~\u0001"+
+ "\u0000\u0000\u0000~|\u0001\u0000\u0000\u0000~\u007f\u0001\u0000\u0000"+
+ "\u0000\u007f\"\u0001\u0000\u0000\u0000\u0080\u0081\u0007\u0004\u0000\u0000"+
+ "\u0081$\u0001\u0000\u0000\u0000\u0082\u0083\u0007\u0005\u0000\u0000\u0083"+
+ "&\u0001\u0000\u0000\u0000\t\u0000KPdfmuy~\u0001\u0006\u0000\u0000";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
diff --git a/src/main/java/controlP5/layout/lang/XMLLexer.tokens b/src/main/java/controlP5/layout/lang/XMLLexer.tokens
index 30d639a..4c2ff5b 100644
--- a/src/main/java/controlP5/layout/lang/XMLLexer.tokens
+++ b/src/main/java/controlP5/layout/lang/XMLLexer.tokens
@@ -1,20 +1,28 @@
T__0=1
T__1=2
-SELF_CLOSING=3
-UNIT=4
-WS=5
-OPEN=6
-OPEN_SLASH=7
-CLOSE=8
-SLASH_CLOSE=9
-EQUALS=10
-Name=11
-STRING=12
-NUMBER=13
+T__2=3
+T__3=4
+T__4=5
+T__5=6
+SELF_CLOSING=7
+UNIT=8
+WS=9
+OPEN=10
+OPEN_SLASH=11
+CLOSE=12
+SLASH_CLOSE=13
+EQUALS=14
+Name=15
+STRING=16
+NUMBER=17
''=1
''=2
-'<'=6
-''=7
-'>'=8
-'/>'=9
-'='=10
+'rgb'=3
+'('=4
+','=5
+')'=6
+'<'=10
+''=11
+'>'=12
+'/>'=13
+'='=14
diff --git a/src/main/java/controlP5/layout/lang/XMLListener.java b/src/main/java/controlP5/layout/lang/XMLListener.java
index affbd5b..c0e5916 100644
--- a/src/main/java/controlP5/layout/lang/XMLListener.java
+++ b/src/main/java/controlP5/layout/lang/XMLListener.java
@@ -77,4 +77,14 @@ public interface XMLListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitValue(XMLParser.ValueContext ctx);
+ /**
+ * Enter a parse tree produced by {@link XMLParser#rgb}.
+ * @param ctx the parse tree
+ */
+ void enterRgb(XMLParser.RgbContext ctx);
+ /**
+ * Exit a parse tree produced by {@link XMLParser#rgb}.
+ * @param ctx the parse tree
+ */
+ void exitRgb(XMLParser.RgbContext ctx);
}
\ No newline at end of file
diff --git a/src/main/java/controlP5/layout/lang/XMLParser.java b/src/main/java/controlP5/layout/lang/XMLParser.java
index 1aa8d3c..6b3ae71 100644
--- a/src/main/java/controlP5/layout/lang/XMLParser.java
+++ b/src/main/java/controlP5/layout/lang/XMLParser.java
@@ -3,8 +3,11 @@ package controlP5.layout.lang;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
+import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"})
public class XMLParser extends Parser {
@@ -14,30 +17,32 @@ public class XMLParser extends Parser {
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
- T__0=1, T__1=2, SELF_CLOSING=3, UNIT=4, WS=5, OPEN=6, OPEN_SLASH=7, CLOSE=8,
- SLASH_CLOSE=9, EQUALS=10, Name=11, STRING=12, NUMBER=13;
+ T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, SELF_CLOSING=7, UNIT=8,
+ WS=9, OPEN=10, OPEN_SLASH=11, CLOSE=12, SLASH_CLOSE=13, EQUALS=14, Name=15,
+ STRING=16, NUMBER=17;
public static final int
RULE_document = 0, RULE_element = 1, RULE_startTag = 2, RULE_endTag = 3,
- RULE_attribute = 4, RULE_content = 5, RULE_value = 6;
+ RULE_attribute = 4, RULE_content = 5, RULE_value = 6, RULE_rgb = 7;
private static String[] makeRuleNames() {
return new String[] {
"document", "element", "startTag", "endTag", "attribute", "content",
- "value"
+ "value", "rgb"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
- null, "''", "''", null, null, null, "'<'", "''", "'>'",
- "'/>'", "'='"
+ null, "''", "''", "'rgb'", "'('", "','", "')'", null,
+ null, null, "'<'", "''", "'>'", "'/>'", "'='"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
- null, null, null, "SELF_CLOSING", "UNIT", "WS", "OPEN", "OPEN_SLASH",
- "CLOSE", "SLASH_CLOSE", "EQUALS", "Name", "STRING", "NUMBER"
+ null, null, null, null, null, null, null, "SELF_CLOSING", "UNIT", "WS",
+ "OPEN", "OPEN_SLASH", "CLOSE", "SLASH_CLOSE", "EQUALS", "Name", "STRING",
+ "NUMBER"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
@@ -125,23 +130,23 @@ public class XMLParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(14);
+ setState(16);
match(T__0);
- setState(16);
+ setState(20);
_errHandler.sync(this);
_la = _input.LA(1);
- do {
+ while (_la==SELF_CLOSING || _la==OPEN) {
{
{
- setState(15);
+ setState(17);
element();
}
}
- setState(18);
+ setState(22);
_errHandler.sync(this);
_la = _input.LA(1);
- } while ( _la==SELF_CLOSING || _la==OPEN );
- setState(20);
+ }
+ setState(23);
match(T__1);
}
}
@@ -192,32 +197,32 @@ public class XMLParser extends Parser {
enterRule(_localctx, 2, RULE_element);
int _la;
try {
- setState(29);
+ setState(32);
_errHandler.sync(this);
switch (_input.LA(1)) {
case OPEN:
enterOuterAlt(_localctx, 1);
{
- setState(22);
+ setState(25);
startTag();
- setState(24);
+ setState(27);
_errHandler.sync(this);
_la = _input.LA(1);
- if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 4168L) != 0)) {
+ if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 66688L) != 0)) {
{
- setState(23);
+ setState(26);
content();
}
}
- setState(26);
+ setState(29);
endTag();
}
break;
case SELF_CLOSING:
enterOuterAlt(_localctx, 2);
{
- setState(28);
+ setState(31);
match(SELF_CLOSING);
}
break;
@@ -273,25 +278,25 @@ public class XMLParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(31);
+ setState(34);
match(OPEN);
- setState(32);
+ setState(35);
match(Name);
- setState(36);
+ setState(39);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Name) {
{
{
- setState(33);
+ setState(36);
attribute();
}
}
- setState(38);
+ setState(41);
_errHandler.sync(this);
_la = _input.LA(1);
}
- setState(39);
+ setState(42);
match(CLOSE);
}
}
@@ -336,11 +341,11 @@ public class XMLParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(41);
+ setState(44);
match(OPEN_SLASH);
- setState(42);
+ setState(45);
match(Name);
- setState(43);
+ setState(46);
match(CLOSE);
}
}
@@ -387,11 +392,11 @@ public class XMLParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
- setState(45);
+ setState(48);
match(Name);
- setState(46);
+ setState(49);
match(EQUALS);
- setState(47);
+ setState(50);
value();
}
}
@@ -435,21 +440,21 @@ public class XMLParser extends Parser {
ContentContext _localctx = new ContentContext(_ctx, getState());
enterRule(_localctx, 10, RULE_content);
try {
- setState(51);
+ setState(54);
_errHandler.sync(this);
switch (_input.LA(1)) {
case SELF_CLOSING:
case OPEN:
enterOuterAlt(_localctx, 1);
{
- setState(49);
+ setState(52);
element();
}
break;
case STRING:
enterOuterAlt(_localctx, 2);
{
- setState(50);
+ setState(53);
match(STRING);
}
break;
@@ -473,6 +478,9 @@ public class XMLParser extends Parser {
public TerminalNode STRING() { return getToken(XMLParser.STRING, 0); }
public TerminalNode NUMBER() { return getToken(XMLParser.NUMBER, 0); }
public TerminalNode UNIT() { return getToken(XMLParser.UNIT, 0); }
+ public RgbContext rgb() {
+ return getRuleContext(RgbContext.class,0);
+ }
public ValueContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@@ -496,25 +504,32 @@ public class XMLParser extends Parser {
ValueContext _localctx = new ValueContext(_ctx, getState());
enterRule(_localctx, 12, RULE_value);
try {
- setState(56);
+ setState(60);
_errHandler.sync(this);
switch (_input.LA(1)) {
case STRING:
enterOuterAlt(_localctx, 1);
{
- setState(53);
+ setState(56);
match(STRING);
}
break;
case NUMBER:
enterOuterAlt(_localctx, 2);
{
- setState(54);
+ setState(57);
match(NUMBER);
- setState(55);
+ setState(58);
match(UNIT);
}
break;
+ case T__2:
+ enterOuterAlt(_localctx, 3);
+ {
+ setState(59);
+ rgb();
+ }
+ break;
default:
throw new NoViableAltException(this);
}
@@ -530,43 +545,109 @@ public class XMLParser extends Parser {
return _localctx;
}
+ @SuppressWarnings("CheckReturnValue")
+ public static class RgbContext extends ParserRuleContext {
+ public List NUMBER() { return getTokens(XMLParser.NUMBER); }
+ public TerminalNode NUMBER(int i) {
+ return getToken(XMLParser.NUMBER, i);
+ }
+ public RgbContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_rgb; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof XMLListener ) ((XMLListener)listener).enterRgb(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof XMLListener ) ((XMLListener)listener).exitRgb(this);
+ }
+ @Override
+ public T accept(ParseTreeVisitor extends T> visitor) {
+ if ( visitor instanceof XMLVisitor ) return ((XMLVisitor extends T>)visitor).visitRgb(this);
+ else return visitor.visitChildren(this);
+ }
+ }
+
+ public final RgbContext rgb() throws RecognitionException {
+ RgbContext _localctx = new RgbContext(_ctx, getState());
+ enterRule(_localctx, 14, RULE_rgb);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(62);
+ match(T__2);
+ setState(63);
+ match(T__3);
+ setState(64);
+ match(NUMBER);
+ setState(65);
+ match(T__4);
+ setState(66);
+ match(NUMBER);
+ setState(67);
+ match(T__4);
+ setState(68);
+ match(NUMBER);
+ setState(69);
+ match(T__5);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
public static final String _serializedATN =
- "\u0004\u0001\r;\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+
+ "\u0004\u0001\u0011H\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+
"\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002"+
- "\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0001\u0000\u0001\u0000\u0004"+
- "\u0000\u0011\b\u0000\u000b\u0000\f\u0000\u0012\u0001\u0000\u0001\u0000"+
- "\u0001\u0001\u0001\u0001\u0003\u0001\u0019\b\u0001\u0001\u0001\u0001\u0001"+
- "\u0001\u0001\u0003\u0001\u001e\b\u0001\u0001\u0002\u0001\u0002\u0001\u0002"+
- "\u0005\u0002#\b\u0002\n\u0002\f\u0002&\t\u0002\u0001\u0002\u0001\u0002"+
- "\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004"+
- "\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005\u0003\u00054\b\u0005"+
- "\u0001\u0006\u0001\u0006\u0001\u0006\u0003\u00069\b\u0006\u0001\u0006"+
- "\u0000\u0000\u0007\u0000\u0002\u0004\u0006\b\n\f\u0000\u00009\u0000\u000e"+
- "\u0001\u0000\u0000\u0000\u0002\u001d\u0001\u0000\u0000\u0000\u0004\u001f"+
- "\u0001\u0000\u0000\u0000\u0006)\u0001\u0000\u0000\u0000\b-\u0001\u0000"+
- "\u0000\u0000\n3\u0001\u0000\u0000\u0000\f8\u0001\u0000\u0000\u0000\u000e"+
- "\u0010\u0005\u0001\u0000\u0000\u000f\u0011\u0003\u0002\u0001\u0000\u0010"+
- "\u000f\u0001\u0000\u0000\u0000\u0011\u0012\u0001\u0000\u0000\u0000\u0012"+
- "\u0010\u0001\u0000\u0000\u0000\u0012\u0013\u0001\u0000\u0000\u0000\u0013"+
- "\u0014\u0001\u0000\u0000\u0000\u0014\u0015\u0005\u0002\u0000\u0000\u0015"+
- "\u0001\u0001\u0000\u0000\u0000\u0016\u0018\u0003\u0004\u0002\u0000\u0017"+
- "\u0019\u0003\n\u0005\u0000\u0018\u0017\u0001\u0000\u0000\u0000\u0018\u0019"+
- "\u0001\u0000\u0000\u0000\u0019\u001a\u0001\u0000\u0000\u0000\u001a\u001b"+
- "\u0003\u0006\u0003\u0000\u001b\u001e\u0001\u0000\u0000\u0000\u001c\u001e"+
- "\u0005\u0003\u0000\u0000\u001d\u0016\u0001\u0000\u0000\u0000\u001d\u001c"+
- "\u0001\u0000\u0000\u0000\u001e\u0003\u0001\u0000\u0000\u0000\u001f \u0005"+
- "\u0006\u0000\u0000 $\u0005\u000b\u0000\u0000!#\u0003\b\u0004\u0000\"!"+
- "\u0001\u0000\u0000\u0000#&\u0001\u0000\u0000\u0000$\"\u0001\u0000\u0000"+
- "\u0000$%\u0001\u0000\u0000\u0000%\'\u0001\u0000\u0000\u0000&$\u0001\u0000"+
- "\u0000\u0000\'(\u0005\b\u0000\u0000(\u0005\u0001\u0000\u0000\u0000)*\u0005"+
- "\u0007\u0000\u0000*+\u0005\u000b\u0000\u0000+,\u0005\b\u0000\u0000,\u0007"+
- "\u0001\u0000\u0000\u0000-.\u0005\u000b\u0000\u0000./\u0005\n\u0000\u0000"+
- "/0\u0003\f\u0006\u00000\t\u0001\u0000\u0000\u000014\u0003\u0002\u0001"+
- "\u000024\u0005\f\u0000\u000031\u0001\u0000\u0000\u000032\u0001\u0000\u0000"+
- "\u00004\u000b\u0001\u0000\u0000\u000059\u0005\f\u0000\u000067\u0005\r"+
- "\u0000\u000079\u0005\u0004\u0000\u000085\u0001\u0000\u0000\u000086\u0001"+
- "\u0000\u0000\u00009\r\u0001\u0000\u0000\u0000\u0006\u0012\u0018\u001d"+
- "$38";
+ "\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007\u0001"+
+ "\u0000\u0001\u0000\u0005\u0000\u0013\b\u0000\n\u0000\f\u0000\u0016\t\u0000"+
+ "\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0003\u0001\u001c\b\u0001"+
+ "\u0001\u0001\u0001\u0001\u0001\u0001\u0003\u0001!\b\u0001\u0001\u0002"+
+ "\u0001\u0002\u0001\u0002\u0005\u0002&\b\u0002\n\u0002\f\u0002)\t\u0002"+
+ "\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003"+
+ "\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005"+
+ "\u0003\u00057\b\u0005\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
+ "\u0003\u0006=\b\u0006\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
+ "\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
+ "\u0000\u0000\b\u0000\u0002\u0004\u0006\b\n\f\u000e\u0000\u0000F\u0000"+
+ "\u0010\u0001\u0000\u0000\u0000\u0002 \u0001\u0000\u0000\u0000\u0004\""+
+ "\u0001\u0000\u0000\u0000\u0006,\u0001\u0000\u0000\u0000\b0\u0001\u0000"+
+ "\u0000\u0000\n6\u0001\u0000\u0000\u0000\f<\u0001\u0000\u0000\u0000\u000e"+
+ ">\u0001\u0000\u0000\u0000\u0010\u0014\u0005\u0001\u0000\u0000\u0011\u0013"+
+ "\u0003\u0002\u0001\u0000\u0012\u0011\u0001\u0000\u0000\u0000\u0013\u0016"+
+ "\u0001\u0000\u0000\u0000\u0014\u0012\u0001\u0000\u0000\u0000\u0014\u0015"+
+ "\u0001\u0000\u0000\u0000\u0015\u0017\u0001\u0000\u0000\u0000\u0016\u0014"+
+ "\u0001\u0000\u0000\u0000\u0017\u0018\u0005\u0002\u0000\u0000\u0018\u0001"+
+ "\u0001\u0000\u0000\u0000\u0019\u001b\u0003\u0004\u0002\u0000\u001a\u001c"+
+ "\u0003\n\u0005\u0000\u001b\u001a\u0001\u0000\u0000\u0000\u001b\u001c\u0001"+
+ "\u0000\u0000\u0000\u001c\u001d\u0001\u0000\u0000\u0000\u001d\u001e\u0003"+
+ "\u0006\u0003\u0000\u001e!\u0001\u0000\u0000\u0000\u001f!\u0005\u0007\u0000"+
+ "\u0000 \u0019\u0001\u0000\u0000\u0000 \u001f\u0001\u0000\u0000\u0000!"+
+ "\u0003\u0001\u0000\u0000\u0000\"#\u0005\n\u0000\u0000#\'\u0005\u000f\u0000"+
+ "\u0000$&\u0003\b\u0004\u0000%$\u0001\u0000\u0000\u0000&)\u0001\u0000\u0000"+
+ "\u0000\'%\u0001\u0000\u0000\u0000\'(\u0001\u0000\u0000\u0000(*\u0001\u0000"+
+ "\u0000\u0000)\'\u0001\u0000\u0000\u0000*+\u0005\f\u0000\u0000+\u0005\u0001"+
+ "\u0000\u0000\u0000,-\u0005\u000b\u0000\u0000-.\u0005\u000f\u0000\u0000"+
+ "./\u0005\f\u0000\u0000/\u0007\u0001\u0000\u0000\u000001\u0005\u000f\u0000"+
+ "\u000012\u0005\u000e\u0000\u000023\u0003\f\u0006\u00003\t\u0001\u0000"+
+ "\u0000\u000047\u0003\u0002\u0001\u000057\u0005\u0010\u0000\u000064\u0001"+
+ "\u0000\u0000\u000065\u0001\u0000\u0000\u00007\u000b\u0001\u0000\u0000"+
+ "\u00008=\u0005\u0010\u0000\u00009:\u0005\u0011\u0000\u0000:=\u0005\b\u0000"+
+ "\u0000;=\u0003\u000e\u0007\u0000<8\u0001\u0000\u0000\u0000<9\u0001\u0000"+
+ "\u0000\u0000<;\u0001\u0000\u0000\u0000=\r\u0001\u0000\u0000\u0000>?\u0005"+
+ "\u0003\u0000\u0000?@\u0005\u0004\u0000\u0000@A\u0005\u0011\u0000\u0000"+
+ "AB\u0005\u0005\u0000\u0000BC\u0005\u0011\u0000\u0000CD\u0005\u0005\u0000"+
+ "\u0000DE\u0005\u0011\u0000\u0000EF\u0005\u0006\u0000\u0000F\u000f\u0001"+
+ "\u0000\u0000\u0000\u0006\u0014\u001b \'6<";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
diff --git a/src/main/java/controlP5/layout/lang/XMLVisitor.java b/src/main/java/controlP5/layout/lang/XMLVisitor.java
index 4b8fd76..b051cfb 100644
--- a/src/main/java/controlP5/layout/lang/XMLVisitor.java
+++ b/src/main/java/controlP5/layout/lang/XMLVisitor.java
@@ -52,4 +52,10 @@ public interface XMLVisitor extends ParseTreeVisitor {
* @return the visitor result
*/
T visitValue(XMLParser.ValueContext ctx);
+ /**
+ * Visit a parse tree produced by {@link XMLParser#rgb}.
+ * @param ctx the parse tree
+ * @return the visitor result
+ */
+ T visitRgb(XMLParser.RgbContext ctx);
}
\ No newline at end of file
diff --git a/src/main/resources/test.xml b/src/main/resources/test.xml
new file mode 100644
index 0000000..e69de29