mirror of
https://github.com/sojamo/controlp5
synced 2024-11-16 03:07:56 +01:00
layout builder: properties inherintance
This commit is contained in:
parent
783e3a9d55
commit
977fad1799
133
src/main/java/controlP5/layout/ControllerFactory.java
Normal file
133
src/main/java/controlP5/layout/ControllerFactory.java
Normal file
@ -0,0 +1,133 @@
|
||||
package controlP5.layout;
|
||||
|
||||
import controlP5.*;
|
||||
import controlP5.layout.lang.XMLParser;
|
||||
import processing.core.PApplet;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.*;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
public class ControllerFactory {
|
||||
private final PApplet applet;
|
||||
private final ControlP5 cp5;
|
||||
private final Map<String, Class<? extends Controller>> controlMap;
|
||||
|
||||
|
||||
public ControllerFactory(PApplet applet, ControlP5 cp5) {
|
||||
this.applet = applet;
|
||||
this.cp5 = cp5;
|
||||
|
||||
|
||||
controlMap = new HashMap<>();
|
||||
// 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("Label", Label.class);
|
||||
// controlMap.put("RadioButton", RadioButton.class);
|
||||
// controlMap.put("Textarea", Textarea.class);
|
||||
// controlMap.put("TickMark", TickMark.class);
|
||||
// controlMap.put("Tooltip", Tooltip.class);
|
||||
controlMap.put("Bang", Bang.class);
|
||||
controlMap.put("Button", Button.class);
|
||||
controlMap.put("ButtonBar", ButtonBar.class);
|
||||
controlMap.put("Chart", Chart.class);
|
||||
controlMap.put("ColorWheel", ColorWheel.class);
|
||||
controlMap.put("Icon", Icon.class);
|
||||
controlMap.put("Knob", Knob.class);
|
||||
controlMap.put("ListBox", ListBox.class);
|
||||
controlMap.put("Matrix", Matrix.class);
|
||||
controlMap.put("MultiList", MultiList.class);
|
||||
controlMap.put("MultilineTextfield", MultilineTextfield.class);
|
||||
controlMap.put("Numberbox", Numberbox.class);
|
||||
controlMap.put("Range", Range.class);
|
||||
controlMap.put("ScrollableList", ScrollableList.class);
|
||||
controlMap.put("Slider", Slider.class);
|
||||
controlMap.put("Slider2D", Slider2D.class);
|
||||
controlMap.put("Spacer", Spacer.class);
|
||||
controlMap.put("Textfield", Textfield.class);
|
||||
controlMap.put("Textlabel", Textlabel.class);
|
||||
controlMap.put("Toggle", Toggle.class);
|
||||
|
||||
}
|
||||
|
||||
/* creates a controller based on the controlName */
|
||||
public Controller<?> createController(String controlName) {
|
||||
Class<? extends Controller> controllerClass = controlMap.get(controlName);
|
||||
if (controllerClass == null) {
|
||||
throw new IllegalArgumentException("Invalid control name: " + controlName);
|
||||
}
|
||||
|
||||
try {
|
||||
//instantiate the controller
|
||||
Constructor<? extends Controller> constructor = controllerClass.getConstructor(ControlP5.class,String.class);
|
||||
return constructor.newInstance(cp5,"");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to create control: " + controlName, 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);
|
||||
|
||||
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);
|
||||
// break;
|
||||
// case "visible":
|
||||
// controller.setVisible(Boolean.parseBoolean(attrValue));
|
||||
// break;
|
||||
// case "captionLabel":
|
||||
// controller.getCaptionLabel().setText(attrValue);
|
||||
// break;
|
||||
// case "valueLabel":
|
||||
// controller.getValueLabel().setText(attrValue);
|
||||
// break;
|
||||
default:
|
||||
System.out.println("Unknown attribute: " + attrName);
|
||||
}
|
||||
}
|
||||
|
||||
private int getValue(XMLParser.ValueContext ctx) {
|
||||
String unit = ctx.UNIT().getText();
|
||||
String value = ctx.NUMBER().getText();
|
||||
|
||||
switch (unit) {
|
||||
case "px":
|
||||
return Integer.parseInt(value);
|
||||
case "%":
|
||||
//get tabs
|
||||
ControllerList _myTabs = cp5.getWindow().getTabs();
|
||||
|
||||
return (int) (Float.parseFloat(value) / 100.0f * _myTabs.get(0).getWidth());
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown unit: " + unit);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,43 +1,165 @@
|
||||
package controlP5.layout;
|
||||
|
||||
import controlP5.layout.lang.XMLBaseListener;
|
||||
|
||||
import controlP5.ControlP5;
|
||||
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.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class LayoutBuilder {
|
||||
private final ControlP5 _cp5;
|
||||
private final PApplet _pApplet;
|
||||
private final Deque<ElementProps> contextStack = new ArrayDeque<>();
|
||||
|
||||
public static void parseXML(String xml) throws Exception {
|
||||
public LayoutBuilder(PApplet pApplet, ControlP5 cp5) {
|
||||
_cp5 = cp5;
|
||||
_pApplet = pApplet;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void parseXML(String xml) throws Exception {
|
||||
ANTLRInputStream input = new ANTLRInputStream(xml);
|
||||
XMLLexer lexer = new XMLLexer(input);
|
||||
CommonTokenStream tokens = new CommonTokenStream(lexer);
|
||||
XMLParser parser = new XMLParser(tokens);
|
||||
ParseTree tree = parser.document();
|
||||
|
||||
//create walker
|
||||
ParseTreeWalker walker = new ParseTreeWalker();
|
||||
XMLListener listener = new XMLListener();
|
||||
walker.walk(listener, tree);
|
||||
XMLVisitor visitor = new XMLVisitor(_pApplet, _cp5);
|
||||
visitor.visit(tree);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static class XMLListener extends XMLBaseListener {
|
||||
private class XMLVisitor extends XMLBaseVisitor {
|
||||
|
||||
private final ControlP5 _cp5;
|
||||
private final PApplet _pApplet;
|
||||
|
||||
public XMLVisitor(PApplet pApplet, ControlP5 cp5) {
|
||||
_cp5 = cp5;
|
||||
_pApplet = pApplet;
|
||||
}
|
||||
|
||||
|
||||
//visit first node
|
||||
@Override
|
||||
public void enterStartTag(XMLParser.StartTagContext ctx) {
|
||||
String controlName = ctx.Name().getText();
|
||||
public Object visitDocument(XMLParser.DocumentContext ctx) {
|
||||
// get width and height from the papplet
|
||||
int parentWidth = _pApplet.width;
|
||||
int parentHeight = _pApplet.height;
|
||||
|
||||
// Create ControlP5 instance based on controlName
|
||||
// ControlP5 control = ControlP5Factory.create(controlName);
|
||||
|
||||
int attrCount = ctx.attribute().size();
|
||||
for(int i = 0; i < attrCount; i++) {
|
||||
String attrName = ctx.attribute(i).Name().getText();
|
||||
String attrValue = ctx.attribute(i).STRING().getText();
|
||||
|
||||
// Set attribute
|
||||
// control.setAttribute(attrName, attrValue);
|
||||
//visit children
|
||||
for (int i = 0; i < ctx.children.size(); i++) {
|
||||
contextStack.push(new ElementProps(parentWidth, parentHeight));
|
||||
visit(ctx.children.get(i));
|
||||
contextStack.pop();
|
||||
}
|
||||
|
||||
// After setting all attributes, you could add the control to your UI or store it somewhere
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object visitStartTag(XMLParser.StartTagContext ctx) {
|
||||
HashMap<String,Attribute<?>> 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);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object visitAttribute(XMLParser.AttributeContext ctx) {
|
||||
if(ctx.value().STRING() != null){
|
||||
String name = ctx.Name().getText();
|
||||
String value = ctx.value().STRING().getText();
|
||||
return new Attribute<String>(name, value);
|
||||
}else if(ctx.value().NUMBER() != null) {
|
||||
String name = ctx.Name().getText();
|
||||
int value = Integer.parseInt(ctx.value().NUMBER().getText());
|
||||
|
||||
return new Attribute<Integer>(name, value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private class ElementProps {
|
||||
int width;
|
||||
int height;
|
||||
|
||||
public ElementProps(int width, int height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
}
|
||||
|
||||
private class Tag {
|
||||
private String name;
|
||||
private HashMap<String,Attribute<?>> attributes;
|
||||
|
||||
public Tag(String name, HashMap<String,Attribute<?>> attributes) {
|
||||
this.name = name;
|
||||
this.attributes = attributes;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public HashMap<String,Attribute<?>> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
}
|
||||
|
||||
private class Attribute<T> {
|
||||
private String name;
|
||||
private T value;
|
||||
|
||||
public Attribute(String name, T value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public T getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,26 @@
|
||||
grammar XML;
|
||||
|
||||
document : element EOF ;
|
||||
document : '<Window>' element+ '</Window>' ;
|
||||
|
||||
element : startTag (content | SPACE)* endTag
|
||||
element : startTag (content )? endTag
|
||||
| SELF_CLOSING
|
||||
;
|
||||
|
||||
startTag : OPEN Name attribute* CLOSE ;
|
||||
startTag : OPEN Name attribute* CLOSE ;
|
||||
|
||||
endTag : OPEN_SLASH Name CLOSE ;
|
||||
|
||||
SELF_CLOSING : OPEN Name SLASH_CLOSE ;
|
||||
|
||||
attribute : Name EQUALS STRING ;
|
||||
attribute : Name EQUALS value ;
|
||||
|
||||
content : element | STRING ;
|
||||
|
||||
value: STRING
|
||||
| NUMBER UNIT;
|
||||
|
||||
SPACE : [ \t\r\n] ;
|
||||
UNIT: 'px' | '%';
|
||||
WS : [ \t\r\n]+ -> skip;
|
||||
OPEN : '<' ;
|
||||
OPEN_SLASH: '</' ;
|
||||
CLOSE : '>' ;
|
||||
@ -26,6 +29,7 @@ EQUALS : '=' ;
|
||||
|
||||
Name : ALPHA (ALPHA | DIGIT | '.' | '-' | '_')* ;
|
||||
STRING : '"' ( ~'"' )* '"' | '\'' ( ~'\'' )* '\'' ;
|
||||
NUMBER : DIGIT+ ;
|
||||
|
||||
fragment DIGIT : [0-9] ;
|
||||
fragment ALPHA : [a-zA-Z] ;
|
||||
|
@ -1,5 +1,8 @@
|
||||
token literal names:
|
||||
null
|
||||
'<Window>'
|
||||
'</Window>'
|
||||
null
|
||||
null
|
||||
null
|
||||
'<'
|
||||
@ -9,11 +12,15 @@ null
|
||||
'='
|
||||
null
|
||||
null
|
||||
null
|
||||
|
||||
token symbolic names:
|
||||
null
|
||||
null
|
||||
null
|
||||
SELF_CLOSING
|
||||
SPACE
|
||||
UNIT
|
||||
WS
|
||||
OPEN
|
||||
OPEN_SLASH
|
||||
CLOSE
|
||||
@ -21,6 +28,7 @@ SLASH_CLOSE
|
||||
EQUALS
|
||||
Name
|
||||
STRING
|
||||
NUMBER
|
||||
|
||||
rule names:
|
||||
document
|
||||
@ -29,7 +37,8 @@ startTag
|
||||
endTag
|
||||
attribute
|
||||
content
|
||||
value
|
||||
|
||||
|
||||
atn:
|
||||
[4, 1, 9, 51, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 5, 1, 19, 8, 1, 10, 1, 12, 1, 22, 9, 1, 1, 1, 1, 1, 1, 1, 3, 1, 27, 8, 1, 1, 2, 1, 2, 1, 2, 5, 2, 32, 8, 2, 10, 2, 12, 2, 35, 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, 49, 8, 5, 1, 5, 0, 0, 6, 0, 2, 4, 6, 8, 10, 0, 0, 49, 0, 12, 1, 0, 0, 0, 2, 26, 1, 0, 0, 0, 4, 28, 1, 0, 0, 0, 6, 38, 1, 0, 0, 0, 8, 42, 1, 0, 0, 0, 10, 48, 1, 0, 0, 0, 12, 13, 3, 2, 1, 0, 13, 14, 5, 0, 0, 1, 14, 1, 1, 0, 0, 0, 15, 20, 3, 4, 2, 0, 16, 19, 3, 10, 5, 0, 17, 19, 5, 2, 0, 0, 18, 16, 1, 0, 0, 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, 3, 6, 3, 0, 24, 27, 1, 0, 0, 0, 25, 27, 5, 1, 0, 0, 26, 15, 1, 0, 0, 0, 26, 25, 1, 0, 0, 0, 27, 3, 1, 0, 0, 0, 28, 29, 5, 3, 0, 0, 29, 33, 5, 8, 0, 0, 30, 32, 3, 8, 4, 0, 31, 30, 1, 0, 0, 0, 32, 35, 1, 0, 0, 0, 33, 31, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 36, 1, 0, 0, 0, 35, 33, 1, 0, 0, 0, 36, 37, 5, 5, 0, 0, 37, 5, 1, 0, 0, 0, 38, 39, 5, 4, 0, 0, 39, 40, 5, 8, 0, 0, 40, 41, 5, 5, 0, 0, 41, 7, 1, 0, 0, 0, 42, 43, 5, 8, 0, 0, 43, 44, 5, 7, 0, 0, 44, 45, 5, 9, 0, 0, 45, 9, 1, 0, 0, 0, 46, 49, 3, 2, 1, 0, 47, 49, 5, 9, 0, 0, 48, 46, 1, 0, 0, 0, 48, 47, 1, 0, 0, 0, 49, 11, 1, 0, 0, 0, 5, 18, 20, 26, 33, 48]
|
||||
[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]
|
@ -1,14 +1,20 @@
|
||||
SELF_CLOSING=1
|
||||
SPACE=2
|
||||
OPEN=3
|
||||
OPEN_SLASH=4
|
||||
CLOSE=5
|
||||
SLASH_CLOSE=6
|
||||
EQUALS=7
|
||||
Name=8
|
||||
STRING=9
|
||||
'<'=3
|
||||
'</'=4
|
||||
'>'=5
|
||||
'/>'=6
|
||||
'='=7
|
||||
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
|
||||
'<Window>'=1
|
||||
'</Window>'=2
|
||||
'<'=6
|
||||
'</'=7
|
||||
'>'=8
|
||||
'/>'=9
|
||||
'='=10
|
||||
|
@ -84,6 +84,18 @@ public class XMLBaseListener implements XMLListener {
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitContent(XMLParser.ContentContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterValue(XMLParser.ValueContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitValue(XMLParser.ValueContext ctx) { }
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
64
src/main/java/controlP5/layout/lang/XMLBaseVisitor.java
Normal file
64
src/main/java/controlP5/layout/lang/XMLBaseVisitor.java
Normal file
@ -0,0 +1,64 @@
|
||||
// Generated from XML.g4 by ANTLR 4.13.0
|
||||
package controlP5.layout.lang;
|
||||
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
|
||||
|
||||
/**
|
||||
* This class provides an empty implementation of {@link XMLVisitor},
|
||||
* which can be extended to create a visitor which only needs to handle a subset
|
||||
* of the available methods.
|
||||
*
|
||||
* @param <T> The return type of the visit operation. Use {@link Void} for
|
||||
* operations with no return type.
|
||||
*/
|
||||
@SuppressWarnings("CheckReturnValue")
|
||||
public class XMLBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements XMLVisitor<T> {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitDocument(XMLParser.DocumentContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitElement(XMLParser.ElementContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitStartTag(XMLParser.StartTagContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitEndTag(XMLParser.EndTagContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitAttribute(XMLParser.AttributeContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitContent(XMLParser.ContentContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitValue(XMLParser.ValueContext ctx) { return visitChildren(ctx); }
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
token literal names:
|
||||
null
|
||||
'<Window>'
|
||||
'</Window>'
|
||||
null
|
||||
null
|
||||
null
|
||||
'<'
|
||||
@ -9,11 +12,15 @@ null
|
||||
'='
|
||||
null
|
||||
null
|
||||
null
|
||||
|
||||
token symbolic names:
|
||||
null
|
||||
null
|
||||
null
|
||||
SELF_CLOSING
|
||||
SPACE
|
||||
UNIT
|
||||
WS
|
||||
OPEN
|
||||
OPEN_SLASH
|
||||
CLOSE
|
||||
@ -21,10 +28,14 @@ SLASH_CLOSE
|
||||
EQUALS
|
||||
Name
|
||||
STRING
|
||||
NUMBER
|
||||
|
||||
rule names:
|
||||
T__0
|
||||
T__1
|
||||
SELF_CLOSING
|
||||
SPACE
|
||||
UNIT
|
||||
WS
|
||||
OPEN
|
||||
OPEN_SLASH
|
||||
CLOSE
|
||||
@ -32,6 +43,7 @@ SLASH_CLOSE
|
||||
EQUALS
|
||||
Name
|
||||
STRING
|
||||
NUMBER
|
||||
DIGIT
|
||||
ALPHA
|
||||
|
||||
@ -43,4 +55,4 @@ mode names:
|
||||
DEFAULT_MODE
|
||||
|
||||
atn:
|
||||
[4, 0, 9, 72, 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, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 5, 7, 46, 8, 7, 10, 7, 12, 7, 49, 9, 7, 1, 8, 1, 8, 5, 8, 53, 8, 8, 10, 8, 12, 8, 56, 9, 8, 1, 8, 1, 8, 1, 8, 5, 8, 61, 8, 8, 10, 8, 12, 8, 64, 9, 8, 1, 8, 3, 8, 67, 8, 8, 1, 9, 1, 9, 1, 10, 1, 10, 0, 0, 11, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 0, 21, 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, 75, 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, 1, 23, 1, 0, 0, 0, 3, 27, 1, 0, 0, 0, 5, 29, 1, 0, 0, 0, 7, 31, 1, 0, 0, 0, 9, 34, 1, 0, 0, 0, 11, 36, 1, 0, 0, 0, 13, 39, 1, 0, 0, 0, 15, 41, 1, 0, 0, 0, 17, 66, 1, 0, 0, 0, 19, 68, 1, 0, 0, 0, 21, 70, 1, 0, 0, 0, 23, 24, 3, 5, 2, 0, 24, 25, 3, 15, 7, 0, 25, 26, 3, 11, 5, 0, 26, 2, 1, 0, 0, 0, 27, 28, 7, 0, 0, 0, 28, 4, 1, 0, 0, 0, 29, 30, 5, 60, 0, 0, 30, 6, 1, 0, 0, 0, 31, 32, 5, 60, 0, 0, 32, 33, 5, 47, 0, 0, 33, 8, 1, 0, 0, 0, 34, 35, 5, 62, 0, 0, 35, 10, 1, 0, 0, 0, 36, 37, 5, 47, 0, 0, 37, 38, 5, 62, 0, 0, 38, 12, 1, 0, 0, 0, 39, 40, 5, 61, 0, 0, 40, 14, 1, 0, 0, 0, 41, 47, 3, 21, 10, 0, 42, 46, 3, 21, 10, 0, 43, 46, 3, 19, 9, 0, 44, 46, 7, 1, 0, 0, 45, 42, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 45, 44, 1, 0, 0, 0, 46, 49, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 16, 1, 0, 0, 0, 49, 47, 1, 0, 0, 0, 50, 54, 5, 34, 0, 0, 51, 53, 8, 2, 0, 0, 52, 51, 1, 0, 0, 0, 53, 56, 1, 0, 0, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 57, 1, 0, 0, 0, 56, 54, 1, 0, 0, 0, 57, 67, 5, 34, 0, 0, 58, 62, 5, 39, 0, 0, 59, 61, 8, 3, 0, 0, 60, 59, 1, 0, 0, 0, 61, 64, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 65, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 65, 67, 5, 39, 0, 0, 66, 50, 1, 0, 0, 0, 66, 58, 1, 0, 0, 0, 67, 18, 1, 0, 0, 0, 68, 69, 7, 4, 0, 0, 69, 20, 1, 0, 0, 0, 70, 71, 7, 5, 0, 0, 71, 22, 1, 0, 0, 0, 6, 0, 45, 47, 54, 62, 66, 0]
|
||||
[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]
|
@ -17,8 +17,8 @@ public class XMLLexer extends Lexer {
|
||||
protected static final PredictionContextCache _sharedContextCache =
|
||||
new PredictionContextCache();
|
||||
public static final int
|
||||
SELF_CLOSING=1, SPACE=2, OPEN=3, OPEN_SLASH=4, CLOSE=5, SLASH_CLOSE=6,
|
||||
EQUALS=7, Name=8, STRING=9;
|
||||
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;
|
||||
public static String[] channelNames = {
|
||||
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
|
||||
};
|
||||
@ -29,22 +29,23 @@ public class XMLLexer extends Lexer {
|
||||
|
||||
private static String[] makeRuleNames() {
|
||||
return new String[] {
|
||||
"SELF_CLOSING", "SPACE", "OPEN", "OPEN_SLASH", "CLOSE", "SLASH_CLOSE",
|
||||
"EQUALS", "Name", "STRING", "DIGIT", "ALPHA"
|
||||
"T__0", "T__1", "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, "'<Window>'", "'</Window>'", null, null, null, "'<'", "'</'", "'>'",
|
||||
"'/>'", "'='"
|
||||
};
|
||||
}
|
||||
private static final String[] _LITERAL_NAMES = makeLiteralNames();
|
||||
private static String[] makeSymbolicNames() {
|
||||
return new String[] {
|
||||
null, "SELF_CLOSING", "SPACE", "OPEN", "OPEN_SLASH", "CLOSE", "SLASH_CLOSE",
|
||||
"EQUALS", "Name", "STRING"
|
||||
null, null, null, "SELF_CLOSING", "UNIT", "WS", "OPEN", "OPEN_SLASH",
|
||||
"CLOSE", "SLASH_CLOSE", "EQUALS", "Name", "STRING", "NUMBER"
|
||||
};
|
||||
}
|
||||
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
|
||||
@ -106,50 +107,73 @@ public class XMLLexer extends Lexer {
|
||||
public ATN getATN() { return _ATN; }
|
||||
|
||||
public static final String _serializedATN =
|
||||
"\u0004\u0000\tH\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+
|
||||
"\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\u0001\u0000"+
|
||||
"\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0001\u0002"+
|
||||
"\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004"+
|
||||
"\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0007"+
|
||||
"\u0001\u0007\u0001\u0007\u0001\u0007\u0005\u0007.\b\u0007\n\u0007\f\u0007"+
|
||||
"1\t\u0007\u0001\b\u0001\b\u0005\b5\b\b\n\b\f\b8\t\b\u0001\b\u0001\b\u0001"+
|
||||
"\b\u0005\b=\b\b\n\b\f\b@\t\b\u0001\b\u0003\bC\b\b\u0001\t\u0001\t\u0001"+
|
||||
"\n\u0001\n\u0000\u0000\u000b\u0001\u0001\u0003\u0002\u0005\u0003\u0007"+
|
||||
"\u0004\t\u0005\u000b\u0006\r\u0007\u000f\b\u0011\t\u0013\u0000\u0015\u0000"+
|
||||
"\u0001\u0000\u0006\u0003\u0000\t\n\r\r \u0002\u0000-.__\u0001\u0000\""+
|
||||
"\"\u0001\u0000\'\'\u0001\u000009\u0002\u0000AZazK\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"+
|
||||
"\u0001\u0017\u0001\u0000\u0000\u0000\u0003\u001b\u0001\u0000\u0000\u0000"+
|
||||
"\u0005\u001d\u0001\u0000\u0000\u0000\u0007\u001f\u0001\u0000\u0000\u0000"+
|
||||
"\t\"\u0001\u0000\u0000\u0000\u000b$\u0001\u0000\u0000\u0000\r\'\u0001"+
|
||||
"\u0000\u0000\u0000\u000f)\u0001\u0000\u0000\u0000\u0011B\u0001\u0000\u0000"+
|
||||
"\u0000\u0013D\u0001\u0000\u0000\u0000\u0015F\u0001\u0000\u0000\u0000\u0017"+
|
||||
"\u0018\u0003\u0005\u0002\u0000\u0018\u0019\u0003\u000f\u0007\u0000\u0019"+
|
||||
"\u001a\u0003\u000b\u0005\u0000\u001a\u0002\u0001\u0000\u0000\u0000\u001b"+
|
||||
"\u001c\u0007\u0000\u0000\u0000\u001c\u0004\u0001\u0000\u0000\u0000\u001d"+
|
||||
"\u001e\u0005<\u0000\u0000\u001e\u0006\u0001\u0000\u0000\u0000\u001f \u0005"+
|
||||
"<\u0000\u0000 !\u0005/\u0000\u0000!\b\u0001\u0000\u0000\u0000\"#\u0005"+
|
||||
">\u0000\u0000#\n\u0001\u0000\u0000\u0000$%\u0005/\u0000\u0000%&\u0005"+
|
||||
">\u0000\u0000&\f\u0001\u0000\u0000\u0000\'(\u0005=\u0000\u0000(\u000e"+
|
||||
"\u0001\u0000\u0000\u0000)/\u0003\u0015\n\u0000*.\u0003\u0015\n\u0000+"+
|
||||
".\u0003\u0013\t\u0000,.\u0007\u0001\u0000\u0000-*\u0001\u0000\u0000\u0000"+
|
||||
"-+\u0001\u0000\u0000\u0000-,\u0001\u0000\u0000\u0000.1\u0001\u0000\u0000"+
|
||||
"\u0000/-\u0001\u0000\u0000\u0000/0\u0001\u0000\u0000\u00000\u0010\u0001"+
|
||||
"\u0000\u0000\u00001/\u0001\u0000\u0000\u000026\u0005\"\u0000\u000035\b"+
|
||||
"\u0002\u0000\u000043\u0001\u0000\u0000\u000058\u0001\u0000\u0000\u0000"+
|
||||
"64\u0001\u0000\u0000\u000067\u0001\u0000\u0000\u000079\u0001\u0000\u0000"+
|
||||
"\u000086\u0001\u0000\u0000\u00009C\u0005\"\u0000\u0000:>\u0005\'\u0000"+
|
||||
"\u0000;=\b\u0003\u0000\u0000<;\u0001\u0000\u0000\u0000=@\u0001\u0000\u0000"+
|
||||
"\u0000><\u0001\u0000\u0000\u0000>?\u0001\u0000\u0000\u0000?A\u0001\u0000"+
|
||||
"\u0000\u0000@>\u0001\u0000\u0000\u0000AC\u0005\'\u0000\u0000B2\u0001\u0000"+
|
||||
"\u0000\u0000B:\u0001\u0000\u0000\u0000C\u0012\u0001\u0000\u0000\u0000"+
|
||||
"DE\u0007\u0004\u0000\u0000E\u0014\u0001\u0000\u0000\u0000FG\u0007\u0005"+
|
||||
"\u0000\u0000G\u0016\u0001\u0000\u0000\u0000\u0006\u0000-/6>B\u0000";
|
||||
"\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"+
|
||||
"\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";
|
||||
public static final ATN _ATN =
|
||||
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
|
||||
static {
|
||||
|
@ -1,14 +1,20 @@
|
||||
SELF_CLOSING=1
|
||||
SPACE=2
|
||||
OPEN=3
|
||||
OPEN_SLASH=4
|
||||
CLOSE=5
|
||||
SLASH_CLOSE=6
|
||||
EQUALS=7
|
||||
Name=8
|
||||
STRING=9
|
||||
'<'=3
|
||||
'</'=4
|
||||
'>'=5
|
||||
'/>'=6
|
||||
'='=7
|
||||
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
|
||||
'<Window>'=1
|
||||
'</Window>'=2
|
||||
'<'=6
|
||||
'</'=7
|
||||
'>'=8
|
||||
'/>'=9
|
||||
'='=10
|
||||
|
@ -67,4 +67,14 @@ public interface XMLListener extends ParseTreeListener {
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitContent(XMLParser.ContentContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by {@link XMLParser#value}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterValue(XMLParser.ValueContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by {@link XMLParser#value}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitValue(XMLParser.ValueContext ctx);
|
||||
}
|
@ -17,28 +17,30 @@ public class XMLParser extends Parser {
|
||||
protected static final PredictionContextCache _sharedContextCache =
|
||||
new PredictionContextCache();
|
||||
public static final int
|
||||
SELF_CLOSING=1, SPACE=2, OPEN=3, OPEN_SLASH=4, CLOSE=5, SLASH_CLOSE=6,
|
||||
EQUALS=7, Name=8, STRING=9;
|
||||
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;
|
||||
public static final int
|
||||
RULE_document = 0, RULE_element = 1, RULE_startTag = 2, RULE_endTag = 3,
|
||||
RULE_attribute = 4, RULE_content = 5;
|
||||
RULE_attribute = 4, RULE_content = 5, RULE_value = 6;
|
||||
private static String[] makeRuleNames() {
|
||||
return new String[] {
|
||||
"document", "element", "startTag", "endTag", "attribute", "content"
|
||||
"document", "element", "startTag", "endTag", "attribute", "content",
|
||||
"value"
|
||||
};
|
||||
}
|
||||
public static final String[] ruleNames = makeRuleNames();
|
||||
|
||||
private static String[] makeLiteralNames() {
|
||||
return new String[] {
|
||||
null, null, null, "'<'", "'</'", "'>'", "'/>'", "'='"
|
||||
null, "'<Window>'", "'</Window>'", null, null, null, "'<'", "'</'", "'>'",
|
||||
"'/>'", "'='"
|
||||
};
|
||||
}
|
||||
private static final String[] _LITERAL_NAMES = makeLiteralNames();
|
||||
private static String[] makeSymbolicNames() {
|
||||
return new String[] {
|
||||
null, "SELF_CLOSING", "SPACE", "OPEN", "OPEN_SLASH", "CLOSE", "SLASH_CLOSE",
|
||||
"EQUALS", "Name", "STRING"
|
||||
null, null, null, "SELF_CLOSING", "UNIT", "WS", "OPEN", "OPEN_SLASH",
|
||||
"CLOSE", "SLASH_CLOSE", "EQUALS", "Name", "STRING", "NUMBER"
|
||||
};
|
||||
}
|
||||
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
|
||||
@ -94,10 +96,12 @@ public class XMLParser extends Parser {
|
||||
|
||||
@SuppressWarnings("CheckReturnValue")
|
||||
public static class DocumentContext extends ParserRuleContext {
|
||||
public ElementContext element() {
|
||||
return getRuleContext(ElementContext.class,0);
|
||||
public List<ElementContext> element() {
|
||||
return getRuleContexts(ElementContext.class);
|
||||
}
|
||||
public ElementContext element(int i) {
|
||||
return getRuleContext(ElementContext.class,i);
|
||||
}
|
||||
public TerminalNode EOF() { return getToken(XMLParser.EOF, 0); }
|
||||
public DocumentContext(ParserRuleContext parent, int invokingState) {
|
||||
super(parent, invokingState);
|
||||
}
|
||||
@ -110,18 +114,38 @@ public class XMLParser extends Parser {
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof XMLListener ) ((XMLListener)listener).exitDocument(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof XMLVisitor ) return ((XMLVisitor<? extends T>)visitor).visitDocument(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final DocumentContext document() throws RecognitionException {
|
||||
DocumentContext _localctx = new DocumentContext(_ctx, getState());
|
||||
enterRule(_localctx, 0, RULE_document);
|
||||
int _la;
|
||||
try {
|
||||
enterOuterAlt(_localctx, 1);
|
||||
{
|
||||
setState(12);
|
||||
element();
|
||||
setState(13);
|
||||
match(EOF);
|
||||
setState(14);
|
||||
match(T__0);
|
||||
setState(16);
|
||||
_errHandler.sync(this);
|
||||
_la = _input.LA(1);
|
||||
do {
|
||||
{
|
||||
{
|
||||
setState(15);
|
||||
element();
|
||||
}
|
||||
}
|
||||
setState(18);
|
||||
_errHandler.sync(this);
|
||||
_la = _input.LA(1);
|
||||
} while ( _la==SELF_CLOSING || _la==OPEN );
|
||||
setState(20);
|
||||
match(T__1);
|
||||
}
|
||||
}
|
||||
catch (RecognitionException re) {
|
||||
@ -143,15 +167,8 @@ public class XMLParser extends Parser {
|
||||
public EndTagContext endTag() {
|
||||
return getRuleContext(EndTagContext.class,0);
|
||||
}
|
||||
public List<ContentContext> content() {
|
||||
return getRuleContexts(ContentContext.class);
|
||||
}
|
||||
public ContentContext content(int i) {
|
||||
return getRuleContext(ContentContext.class,i);
|
||||
}
|
||||
public List<TerminalNode> SPACE() { return getTokens(XMLParser.SPACE); }
|
||||
public TerminalNode SPACE(int i) {
|
||||
return getToken(XMLParser.SPACE, i);
|
||||
public ContentContext content() {
|
||||
return getRuleContext(ContentContext.class,0);
|
||||
}
|
||||
public TerminalNode SELF_CLOSING() { return getToken(XMLParser.SELF_CLOSING, 0); }
|
||||
public ElementContext(ParserRuleContext parent, int invokingState) {
|
||||
@ -166,6 +183,11 @@ public class XMLParser extends Parser {
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof XMLListener ) ((XMLListener)listener).exitElement(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof XMLVisitor ) return ((XMLVisitor<? extends T>)visitor).visitElement(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final ElementContext element() throws RecognitionException {
|
||||
@ -173,52 +195,32 @@ public class XMLParser extends Parser {
|
||||
enterRule(_localctx, 2, RULE_element);
|
||||
int _la;
|
||||
try {
|
||||
setState(26);
|
||||
setState(29);
|
||||
_errHandler.sync(this);
|
||||
switch (_input.LA(1)) {
|
||||
case OPEN:
|
||||
enterOuterAlt(_localctx, 1);
|
||||
{
|
||||
setState(15);
|
||||
setState(22);
|
||||
startTag();
|
||||
setState(20);
|
||||
setState(24);
|
||||
_errHandler.sync(this);
|
||||
_la = _input.LA(1);
|
||||
while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 526L) != 0)) {
|
||||
if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 4168L) != 0)) {
|
||||
{
|
||||
setState(18);
|
||||
_errHandler.sync(this);
|
||||
switch (_input.LA(1)) {
|
||||
case SELF_CLOSING:
|
||||
case OPEN:
|
||||
case STRING:
|
||||
{
|
||||
setState(16);
|
||||
content();
|
||||
}
|
||||
break;
|
||||
case SPACE:
|
||||
{
|
||||
setState(17);
|
||||
match(SPACE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new NoViableAltException(this);
|
||||
setState(23);
|
||||
content();
|
||||
}
|
||||
}
|
||||
setState(22);
|
||||
_errHandler.sync(this);
|
||||
_la = _input.LA(1);
|
||||
}
|
||||
setState(23);
|
||||
|
||||
setState(26);
|
||||
endTag();
|
||||
}
|
||||
break;
|
||||
case SELF_CLOSING:
|
||||
enterOuterAlt(_localctx, 2);
|
||||
{
|
||||
setState(25);
|
||||
setState(28);
|
||||
match(SELF_CLOSING);
|
||||
}
|
||||
break;
|
||||
@ -260,6 +262,11 @@ public class XMLParser extends Parser {
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof XMLListener ) ((XMLListener)listener).exitStartTag(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof XMLVisitor ) return ((XMLVisitor<? extends T>)visitor).visitStartTag(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final StartTagContext startTag() throws RecognitionException {
|
||||
@ -269,25 +276,25 @@ public class XMLParser extends Parser {
|
||||
try {
|
||||
enterOuterAlt(_localctx, 1);
|
||||
{
|
||||
setState(28);
|
||||
setState(31);
|
||||
match(OPEN);
|
||||
setState(29);
|
||||
setState(32);
|
||||
match(Name);
|
||||
setState(33);
|
||||
setState(36);
|
||||
_errHandler.sync(this);
|
||||
_la = _input.LA(1);
|
||||
while (_la==Name) {
|
||||
{
|
||||
{
|
||||
setState(30);
|
||||
setState(33);
|
||||
attribute();
|
||||
}
|
||||
}
|
||||
setState(35);
|
||||
setState(38);
|
||||
_errHandler.sync(this);
|
||||
_la = _input.LA(1);
|
||||
}
|
||||
setState(36);
|
||||
setState(39);
|
||||
match(CLOSE);
|
||||
}
|
||||
}
|
||||
@ -319,6 +326,11 @@ public class XMLParser extends Parser {
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof XMLListener ) ((XMLListener)listener).exitEndTag(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof XMLVisitor ) return ((XMLVisitor<? extends T>)visitor).visitEndTag(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final EndTagContext endTag() throws RecognitionException {
|
||||
@ -327,11 +339,11 @@ public class XMLParser extends Parser {
|
||||
try {
|
||||
enterOuterAlt(_localctx, 1);
|
||||
{
|
||||
setState(38);
|
||||
setState(41);
|
||||
match(OPEN_SLASH);
|
||||
setState(39);
|
||||
setState(42);
|
||||
match(Name);
|
||||
setState(40);
|
||||
setState(43);
|
||||
match(CLOSE);
|
||||
}
|
||||
}
|
||||
@ -350,7 +362,9 @@ public class XMLParser extends Parser {
|
||||
public static class AttributeContext extends ParserRuleContext {
|
||||
public TerminalNode Name() { return getToken(XMLParser.Name, 0); }
|
||||
public TerminalNode EQUALS() { return getToken(XMLParser.EQUALS, 0); }
|
||||
public TerminalNode STRING() { return getToken(XMLParser.STRING, 0); }
|
||||
public ValueContext value() {
|
||||
return getRuleContext(ValueContext.class,0);
|
||||
}
|
||||
public AttributeContext(ParserRuleContext parent, int invokingState) {
|
||||
super(parent, invokingState);
|
||||
}
|
||||
@ -363,6 +377,11 @@ public class XMLParser extends Parser {
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof XMLListener ) ((XMLListener)listener).exitAttribute(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof XMLVisitor ) return ((XMLVisitor<? extends T>)visitor).visitAttribute(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final AttributeContext attribute() throws RecognitionException {
|
||||
@ -371,12 +390,12 @@ public class XMLParser extends Parser {
|
||||
try {
|
||||
enterOuterAlt(_localctx, 1);
|
||||
{
|
||||
setState(42);
|
||||
setState(45);
|
||||
match(Name);
|
||||
setState(43);
|
||||
setState(46);
|
||||
match(EQUALS);
|
||||
setState(44);
|
||||
match(STRING);
|
||||
setState(47);
|
||||
value();
|
||||
}
|
||||
}
|
||||
catch (RecognitionException re) {
|
||||
@ -408,27 +427,32 @@ public class XMLParser extends Parser {
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof XMLListener ) ((XMLListener)listener).exitContent(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof XMLVisitor ) return ((XMLVisitor<? extends T>)visitor).visitContent(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final ContentContext content() throws RecognitionException {
|
||||
ContentContext _localctx = new ContentContext(_ctx, getState());
|
||||
enterRule(_localctx, 10, RULE_content);
|
||||
try {
|
||||
setState(48);
|
||||
setState(51);
|
||||
_errHandler.sync(this);
|
||||
switch (_input.LA(1)) {
|
||||
case SELF_CLOSING:
|
||||
case OPEN:
|
||||
enterOuterAlt(_localctx, 1);
|
||||
{
|
||||
setState(46);
|
||||
setState(49);
|
||||
element();
|
||||
}
|
||||
break;
|
||||
case STRING:
|
||||
enterOuterAlt(_localctx, 2);
|
||||
{
|
||||
setState(47);
|
||||
setState(50);
|
||||
match(STRING);
|
||||
}
|
||||
break;
|
||||
@ -447,38 +471,105 @@ public class XMLParser extends Parser {
|
||||
return _localctx;
|
||||
}
|
||||
|
||||
@SuppressWarnings("CheckReturnValue")
|
||||
public static class ValueContext extends ParserRuleContext {
|
||||
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 ValueContext(ParserRuleContext parent, int invokingState) {
|
||||
super(parent, invokingState);
|
||||
}
|
||||
@Override public int getRuleIndex() { return RULE_value; }
|
||||
@Override
|
||||
public void enterRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof XMLListener ) ((XMLListener)listener).enterValue(this);
|
||||
}
|
||||
@Override
|
||||
public void exitRule(ParseTreeListener listener) {
|
||||
if ( listener instanceof XMLListener ) ((XMLListener)listener).exitValue(this);
|
||||
}
|
||||
@Override
|
||||
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
|
||||
if ( visitor instanceof XMLVisitor ) return ((XMLVisitor<? extends T>)visitor).visitValue(this);
|
||||
else return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final ValueContext value() throws RecognitionException {
|
||||
ValueContext _localctx = new ValueContext(_ctx, getState());
|
||||
enterRule(_localctx, 12, RULE_value);
|
||||
try {
|
||||
setState(56);
|
||||
_errHandler.sync(this);
|
||||
switch (_input.LA(1)) {
|
||||
case STRING:
|
||||
enterOuterAlt(_localctx, 1);
|
||||
{
|
||||
setState(53);
|
||||
match(STRING);
|
||||
}
|
||||
break;
|
||||
case NUMBER:
|
||||
enterOuterAlt(_localctx, 2);
|
||||
{
|
||||
setState(54);
|
||||
match(NUMBER);
|
||||
setState(55);
|
||||
match(UNIT);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new NoViableAltException(this);
|
||||
}
|
||||
}
|
||||
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\t3\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+
|
||||
"\u0004\u0001\r;\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+
|
||||
"\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002"+
|
||||
"\u0005\u0007\u0005\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001\u0001"+
|
||||
"\u0001\u0001\u0001\u0005\u0001\u0013\b\u0001\n\u0001\f\u0001\u0016\t\u0001"+
|
||||
"\u0001\u0001\u0001\u0001\u0001\u0001\u0003\u0001\u001b\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\u00051\b\u0005\u0001\u0005\u0000\u0000\u0006\u0000\u0002\u0004"+
|
||||
"\u0006\b\n\u0000\u00001\u0000\f\u0001\u0000\u0000\u0000\u0002\u001a\u0001"+
|
||||
"\u0000\u0000\u0000\u0004\u001c\u0001\u0000\u0000\u0000\u0006&\u0001\u0000"+
|
||||
"\u0000\u0000\b*\u0001\u0000\u0000\u0000\n0\u0001\u0000\u0000\u0000\f\r"+
|
||||
"\u0003\u0002\u0001\u0000\r\u000e\u0005\u0000\u0000\u0001\u000e\u0001\u0001"+
|
||||
"\u0000\u0000\u0000\u000f\u0014\u0003\u0004\u0002\u0000\u0010\u0013\u0003"+
|
||||
"\n\u0005\u0000\u0011\u0013\u0005\u0002\u0000\u0000\u0012\u0010\u0001\u0000"+
|
||||
"\u0000\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\u0003\u0006\u0003\u0000\u0018\u001b\u0001\u0000"+
|
||||
"\u0000\u0000\u0019\u001b\u0005\u0001\u0000\u0000\u001a\u000f\u0001\u0000"+
|
||||
"\u0000\u0000\u001a\u0019\u0001\u0000\u0000\u0000\u001b\u0003\u0001\u0000"+
|
||||
"\u0000\u0000\u001c\u001d\u0005\u0003\u0000\u0000\u001d!\u0005\b\u0000"+
|
||||
"\u0000\u001e \u0003\b\u0004\u0000\u001f\u001e\u0001\u0000\u0000\u0000"+
|
||||
" #\u0001\u0000\u0000\u0000!\u001f\u0001\u0000\u0000\u0000!\"\u0001\u0000"+
|
||||
"\u0000\u0000\"$\u0001\u0000\u0000\u0000#!\u0001\u0000\u0000\u0000$%\u0005"+
|
||||
"\u0005\u0000\u0000%\u0005\u0001\u0000\u0000\u0000&\'\u0005\u0004\u0000"+
|
||||
"\u0000\'(\u0005\b\u0000\u0000()\u0005\u0005\u0000\u0000)\u0007\u0001\u0000"+
|
||||
"\u0000\u0000*+\u0005\b\u0000\u0000+,\u0005\u0007\u0000\u0000,-\u0005\t"+
|
||||
"\u0000\u0000-\t\u0001\u0000\u0000\u0000.1\u0003\u0002\u0001\u0000/1\u0005"+
|
||||
"\t\u0000\u00000.\u0001\u0000\u0000\u00000/\u0001\u0000\u0000\u00001\u000b"+
|
||||
"\u0001\u0000\u0000\u0000\u0005\u0012\u0014\u001a!0";
|
||||
"\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";
|
||||
public static final ATN _ATN =
|
||||
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
|
||||
static {
|
||||
|
55
src/main/java/controlP5/layout/lang/XMLVisitor.java
Normal file
55
src/main/java/controlP5/layout/lang/XMLVisitor.java
Normal file
@ -0,0 +1,55 @@
|
||||
// Generated from XML.g4 by ANTLR 4.13.0
|
||||
package controlP5.layout.lang;
|
||||
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
|
||||
|
||||
/**
|
||||
* This interface defines a complete generic visitor for a parse tree produced
|
||||
* by {@link XMLParser}.
|
||||
*
|
||||
* @param <T> The return type of the visit operation. Use {@link Void} for
|
||||
* operations with no return type.
|
||||
*/
|
||||
public interface XMLVisitor<T> extends ParseTreeVisitor<T> {
|
||||
/**
|
||||
* Visit a parse tree produced by {@link XMLParser#document}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitDocument(XMLParser.DocumentContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link XMLParser#element}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitElement(XMLParser.ElementContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link XMLParser#startTag}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitStartTag(XMLParser.StartTagContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link XMLParser#endTag}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitEndTag(XMLParser.EndTagContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link XMLParser#attribute}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitAttribute(XMLParser.AttributeContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link XMLParser#content}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitContent(XMLParser.ContentContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link XMLParser#value}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitValue(XMLParser.ValueContext ctx);
|
||||
}
|
2
src/test/java/LayoutTests.java
Normal file
2
src/test/java/LayoutTests.java
Normal file
@ -0,0 +1,2 @@
|
||||
package PACKAGE_NAME;public class LayoutTests {
|
||||
}
|
Loading…
Reference in New Issue
Block a user