TypeReference[] toReferences(T[] types) {
+ if (types == null) {
+ return null;
+ }
+ TypeReference[] to = new TypeReference[types.length];
+ for (int i = 0; i < types.length; i++) {
+ to[i] = new TypeReference(null, types[i], null);
+ }
+ return to;
+ }
+
+ public static TypeDeclaration createFunctionalType(String name, int parameterCount, boolean hasResult,
+ boolean disambiguation) {
+ TypeDeclaration functionalType = null;
+ TypeParameterDeclaration[] typeParameters = new TypeParameterDeclaration[parameterCount];
+ for (int i = 0; i < parameterCount; i++) {
+ typeParameters[i] = new TypeParameterDeclaration(null, "T" + (i + 1));
+ }
+ TypeParameterDeclaration resultType = new TypeParameterDeclaration(null, "R");
+ ParameterDeclaration[] parameters = new ParameterDeclaration[typeParameters.length];
+ for (int i = 0; i < typeParameters.length; i++) {
+ parameters[i] = new ParameterDeclaration(null, "p" + (i + 1),
+ new TypeReference(null, typeParameters[i], null), false, false);
+ }
+ FunctionDeclaration newFunction = new FunctionDeclaration(null,
+ JSweetDefTranslatorConfig.ANONYMOUS_FUNCTION_NAME,
+ hasResult ? new TypeReference(null, resultType, null) : new TypeReference(null, "void", null),
+ parameters, null);
+
+ if (hasResult) {
+ typeParameters = ArrayUtils.add(typeParameters, resultType);
+ }
+ functionalType = new TypeDeclaration(null, "interface", name, typeParameters, null,
+ new FunctionDeclaration[] { newFunction });
+ functionalType.addAnnotation(new FunctionalInterface() {
+ @Override
+ public Class extends Annotation> annotationType() {
+ return FunctionalInterface.class;
+ }
+ });
+ if (disambiguation) {
+ functionalType.setDocumentation(
+ "/** This functional interface should be used for disambiguating lambdas in function parameters (by casting to this interface)."
+ + "It was automatically generated for functions (taking lambdas) that lead to the same erased signature. */");
+ } else {
+ functionalType.setDocumentation(
+ "/** This functional interface was automatically generated for allowing lambdas taking "
+ + parameterCount + " parameters " + (hasResult ? " and returning a result." : ".") + " */");
+ }
+ return functionalType;
+ }
+
+ public static Type getTypeOrComponentType(TypeReference typeReference) {
+ if (typeReference.isArray()) {
+ return getTypeOrComponentType(typeReference.getComponentType());
+ } else {
+ return typeReference.getDeclaration();
+ }
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/FullFunctionDeclaration.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/FullFunctionDeclaration.java
new file mode 100644
index 00000000..53a2b5a7
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/FullFunctionDeclaration.java
@@ -0,0 +1,35 @@
+package org.jsweet.input.typescriptdef.ast;
+
+
+public class FullFunctionDeclaration {
+
+ public FullFunctionDeclaration(ModuleDeclaration declaringModule, TypeDeclaration declaringType, FunctionDeclaration function) {
+ super();
+ this.declaringType = declaringType;
+ this.function = function;
+ }
+
+ public TypeDeclaration declaringType;
+ public ModuleDeclaration declaringModule;
+ public FunctionDeclaration function;
+
+ @Override
+ public String toString() {
+ return (declaringModule == null ? "" : declaringModule.getName() + ".") + (declaringType == null ? "" : declaringType.getName() + ".") + function;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof FullFunctionDeclaration)) {
+ return false;
+ }
+ FullFunctionDeclaration d = (FullFunctionDeclaration) obj;
+ return this.function == d.function;
+ }
+
+ @Override
+ public int hashCode() {
+ return function.hashCode();
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/FunctionDeclaration.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/FunctionDeclaration.java
new file mode 100644
index 00000000..2531a326
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/FunctionDeclaration.java
@@ -0,0 +1,121 @@
+package org.jsweet.input.typescriptdef.ast;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import org.jsweet.JSweetDefTranslatorConfig;
+
+public class FunctionDeclaration extends AbstractTypedDeclaration implements TypeParameterizedElement {
+
+ public static final String NEW_FUNCTION_RESERVED_NAME = JSweetDefTranslatorConfig.NEW_FUNCTION_NAME;
+ public static final String ANONYMOUS_FUNCTION_RESERVED_NAME = JSweetDefTranslatorConfig.ANONYMOUS_FUNCTION_NAME;
+ public static final String INDEXSIG_RESERVED_NAME = JSweetDefTranslatorConfig.INDEXED_GET_FUCTION_NAME;
+
+ ParameterDeclaration[] parameters;
+ TypeParameterDeclaration[] typeParameters;
+
+ public FunctionDeclaration(Token token, String name, TypeReference type, ParameterDeclaration[] parameters,
+ TypeParameterDeclaration[] typeParameters) {
+ super(token, name, type);
+ this.parameters = parameters;
+ this.typeParameters = typeParameters;
+
+ // System.out.println("new " + this);
+ }
+
+ public boolean isConstructor() {
+ return "new".equals(name) || "constructor".equals(name) || NEW_FUNCTION_RESERVED_NAME.equals(name);
+ }
+
+ public boolean isIndexSignature() {
+ return INDEXSIG_RESERVED_NAME.equals(name);
+ }
+
+ @Override
+ public boolean isAnonymous() {
+ return super.isAnonymous() || ANONYMOUS_FUNCTION_RESERVED_NAME.equals(name);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(super.toString());
+ sb.append("(");
+ for (ParameterDeclaration p : parameters) {
+ sb.append(p.name);
+ sb.append(":");
+ sb.append(p.getType().toString());
+ sb.append(",");
+ }
+ if (parameters.length > 0) {
+ sb.deleteCharAt(sb.length() - 1);
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ @Override
+ public void accept(Visitor v) {
+ v.visitFunctionDeclaration(this);
+ }
+
+ public ParameterDeclaration[] getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(ParameterDeclaration[] parameters) {
+ this.parameters = parameters;
+ }
+
+ @Override
+ public TypeParameterDeclaration[] getTypeParameters() {
+ return this.typeParameters;
+ }
+
+ @Override
+ public void setTypeParameters(TypeParameterDeclaration[] typeParameters) {
+ this.typeParameters = typeParameters;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!o.getClass().equals(getClass())) {
+ return false;
+ }
+ FunctionDeclaration fd = (FunctionDeclaration) o;
+ String name1 = getName();
+ if ("constructor".equals(name1)) {
+ name1 = "new";
+ }
+ String name2 = fd.getName();
+ if ("constructor".equals(name2)) {
+ name2 = "new";
+ }
+ if (name2 == null && name1 != null) {
+ return false;
+ }
+ if (!name2.equals(name1)) {
+ return false;
+ }
+ if (fd.parameters.length != parameters.length) {
+ return false;
+ }
+ for (int i = 0; i < fd.parameters.length; i++) {
+ if (!parameters[i].getType().equals(fd.parameters[i].getType())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public FunctionDeclaration copy() {
+ FunctionDeclaration copy = new FunctionDeclaration(null, name, getType() == null ? null : getType().copy(),
+ DeclarationHelper.copy(parameters), DeclarationHelper.copy(typeParameters));
+ copy.setDocumentation(getDocumentation());
+ copy.setModifiers(this.getModifiers() == null ? null : new HashSet(getModifiers()));
+ copy.setStringAnnotations(this.getStringAnnotations() == null ? null : new ArrayList(
+ getStringAnnotations()));
+ return copy;
+ }
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/FunctionalTypeReference.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/FunctionalTypeReference.java
new file mode 100644
index 00000000..9cd7503b
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/FunctionalTypeReference.java
@@ -0,0 +1,102 @@
+package org.jsweet.input.typescriptdef.ast;
+
+import org.apache.commons.lang3.StringUtils;
+
+public class FunctionalTypeReference extends TypeReference implements TypeParameterizedElement {
+
+ private ParameterDeclaration[] parameters;
+ private TypeReference returnType;
+ private boolean constructor;
+ private TypeParameterDeclaration[] typeParameters;
+
+ public FunctionalTypeReference(Token token, TypeReference returnType, ParameterDeclaration[] parameters,
+ TypeParameterDeclaration[] typeParameters) {
+ this(token, false, returnType, parameters, typeParameters);
+ }
+
+ public FunctionalTypeReference(Token token, boolean constructor, TypeReference returnType,
+ ParameterDeclaration[] parameters, TypeParameterDeclaration[] typeParameters) {
+ super(token, (String) null, null);
+ this.parameters = parameters;
+ this.returnType = returnType;
+ this.constructor = constructor;
+ this.typeParameters = typeParameters;
+ }
+
+ @Override
+ public String toString() {
+ return StringUtils.join(parameters, ",") + "=>" + returnType;
+ }
+
+ @Override
+ public void accept(Visitor visitor) {
+ visitor.visitFunctionalTypeReference(this);
+ }
+
+ public ParameterDeclaration[] getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(ParameterDeclaration[] parameters) {
+ this.parameters = parameters;
+ }
+
+ public TypeReference getReturnType() {
+ return returnType;
+ }
+
+ public void setReturnType(TypeReference returnType) {
+ this.returnType = returnType;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!obj.getClass().equals(getClass())) {
+ return false;
+ }
+ FunctionalTypeReference ft = (FunctionalTypeReference) obj;
+ if (!getReturnType().equals(ft.getReturnType())) {
+ return false;
+ }
+ if (parameters.length != ft.parameters.length) {
+ return false;
+ }
+ for (int i = 0; i < ft.parameters.length; i++) {
+ if (!parameters[i].getType().equals(ft.parameters[i].getType())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public FunctionalTypeReference copy(boolean copyDeclarations) {
+ FunctionalTypeReference copy = new FunctionalTypeReference(null, isConstructor(),
+ getReturnType().copy(copyDeclarations), DeclarationHelper.copy(getParameters()),
+ DeclarationHelper.copy(getTypeParameters()));
+ return copy;
+ }
+
+ @Override
+ public FunctionalTypeReference copy() {
+ return copy(false);
+ }
+
+ public boolean isConstructor() {
+ return constructor;
+ }
+
+ public void setConstructor(boolean constructor) {
+ this.constructor = constructor;
+ }
+
+ @Override
+ public TypeParameterDeclaration[] getTypeParameters() {
+ return typeParameters;
+ }
+
+ @Override
+ public void setTypeParameters(TypeParameterDeclaration[] typeParameters) {
+ this.typeParameters = typeParameters;
+ }
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Literal.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Literal.java
new file mode 100644
index 00000000..08ea165d
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Literal.java
@@ -0,0 +1,30 @@
+package org.jsweet.input.typescriptdef.ast;
+
+
+public class Literal extends AbstractAstNode {
+
+ public Literal(Token token, String value) {
+ super(token);
+ this.value = value;
+ }
+
+ protected String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public void accept(Visitor visitor) {
+ visitor.visitLiteral(this);
+ }
+
+ public Literal copy() {
+ return new Literal(null, this.value);
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/ModuleDeclaration.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/ModuleDeclaration.java
new file mode 100644
index 00000000..e92b8cdb
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/ModuleDeclaration.java
@@ -0,0 +1,117 @@
+package org.jsweet.input.typescriptdef.ast;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+
+public class ModuleDeclaration extends AbstractDeclaration implements DeclarationContainer {
+
+ Declaration[] members;
+
+ public static ModuleDeclaration createQualifiedModuleDeclaration(Token token, String qualifiedName,
+ Declaration[] members) {
+
+ String[] subNames = qualifiedName.startsWith("\"") ? new String[] { qualifiedName }
+ : qualifiedName.split("\\.");
+ ModuleDeclaration module = new ModuleDeclaration(token, subNames[subNames.length - 1], members);
+ if (subNames.length > 1) {
+ return createQualifiedModuleDeclaration(token,
+ StringUtils.join(ArrayUtils.subarray(subNames, 0, subNames.length - 1), "."),
+ new Declaration[] { module });
+ } else {
+ return module;
+ }
+
+ }
+
+ public ModuleDeclaration(Token token, String name, Declaration[] members) {
+ super(token, name);
+ this.members = members;
+ // System.out.println("new " + this);
+ }
+
+ @Override
+ public void accept(Visitor v) {
+ v.visitModuleDeclaration(this);
+ }
+
+ @Override
+ public Declaration[] getMembers() {
+ return members;
+ }
+
+ @Override
+ public void addMember(Declaration declaration) {
+ members = DeclarationHelper.addMember(this, declaration);
+ }
+
+ @Override
+ public void removeMember(Declaration declaration) {
+ members = DeclarationHelper.removeMember(this, declaration);
+ }
+
+ @Override
+ public void replaceMember(Declaration existingDeclaration, Declaration withNewDeclaration) {
+ members = DeclarationHelper.replaceMember(this, existingDeclaration, withNewDeclaration);
+ }
+
+ @Override
+ public void clearMembers() {
+ members = new Declaration[0];
+ }
+
+ public FunctionDeclaration findFirstFunction(String name) {
+ return DeclarationHelper.findFirstFunction(this, name);
+ }
+
+ public List findFunctions(String name) {
+ return DeclarationHelper.findFunctions(this, name);
+ }
+
+ public VariableDeclaration findVariable(String name) {
+ return DeclarationHelper.findVariable(this, name);
+ }
+
+ @Override
+ public VariableDeclaration findVariableIgnoreCase(String name) {
+ return DeclarationHelper.findVariableIgnoreCase(this, name);
+ }
+
+ @Override
+ public TypeDeclaration findType(String name) {
+ return DeclarationHelper.findType(this, name);
+ }
+
+ @Override
+ public TypeDeclaration findTypeIgnoreCase(String name) {
+ return DeclarationHelper.findTypeIgnoreCase(this, name);
+ }
+
+ @Override
+ public Declaration findDeclaration(String name) {
+ return DeclarationHelper.findDeclaration(this, name);
+ }
+
+ @Override
+ public void addMembers(Declaration[] declarations) {
+ DeclarationHelper.addMembers(this, declarations);
+ }
+
+ @Override
+ public Declaration findDeclaration(Declaration declaration) {
+ return DeclarationHelper.findDeclaration(this, declaration);
+ }
+
+ @Override
+ public ModuleDeclaration copy() {
+ ModuleDeclaration copy = new ModuleDeclaration(null, getName(), DeclarationHelper.copy(members));
+ copy.setStringAnnotations(
+ this.getStringAnnotations() == null ? null : new ArrayList(getStringAnnotations()));
+ copy.quotedName = this.quotedName;
+ copy.originalName = this.originalName;
+ return copy;
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/NamedElement.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/NamedElement.java
new file mode 100644
index 00000000..0286e2af
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/NamedElement.java
@@ -0,0 +1,15 @@
+package org.jsweet.input.typescriptdef.ast;
+
+public interface NamedElement {
+
+ boolean isAnonymous();
+
+ String getName();
+
+ void setName(String name);
+
+ String getOriginalName();
+
+ void setOriginalName(String name);
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/ParameterDeclaration.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/ParameterDeclaration.java
new file mode 100644
index 00000000..9e85f8e3
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/ParameterDeclaration.java
@@ -0,0 +1,38 @@
+package org.jsweet.input.typescriptdef.ast;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+public class ParameterDeclaration extends VariableDeclaration {
+
+ private boolean varargs = false;
+
+ public ParameterDeclaration(Token token, String name, TypeReference type, boolean optional, boolean varargs) {
+ super(token, name, type, optional, false);
+ this.varargs = varargs;
+ }
+
+ @Override
+ public void accept(Visitor v) {
+ v.visitParameterDeclaration(this);
+ }
+
+ public boolean isVarargs() {
+ return varargs;
+ }
+
+ public void setVarargs(boolean varargs) {
+ this.varargs = varargs;
+ }
+
+ @Override
+ public ParameterDeclaration copy() {
+ ParameterDeclaration copy = new ParameterDeclaration(null, name, getType().copy(), isOptional(), isVarargs());
+ copy.setModifiers(this.getModifiers() == null ? null : new HashSet(this.getModifiers()));
+ copy.setStringAnnotations(this.getStringAnnotations() == null ? null : new ArrayList(
+ getStringAnnotations()));
+ copy.setDocumentation(this.getDocumentation());
+ return copy;
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/QualifiedDeclaration.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/QualifiedDeclaration.java
new file mode 100644
index 00000000..0401e364
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/QualifiedDeclaration.java
@@ -0,0 +1,35 @@
+package org.jsweet.input.typescriptdef.ast;
+
+import org.jsweet.input.typescriptdef.util.Util;
+
+public class QualifiedDeclaration {
+ private T declaration;
+ private String qualifiedDeclarationName;
+
+ public QualifiedDeclaration(T declaration, String qualifiedDeclarationName) {
+ this.declaration = declaration;
+ this.qualifiedDeclarationName = qualifiedDeclarationName;
+ }
+
+ public T getDeclaration() {
+ return declaration;
+ }
+
+ public String getQualifiedDeclarationName() {
+ return qualifiedDeclarationName;
+ }
+
+ @Override
+ public String toString() {
+ return qualifiedDeclarationName;
+ }
+
+ public String getQualifier() {
+ return Util.getQualifier(qualifiedDeclarationName);
+ }
+
+ public String getSimpleName() {
+ return Util.getSimpleName(qualifiedDeclarationName);
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/ReferenceDeclaration.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/ReferenceDeclaration.java
new file mode 100644
index 00000000..7bc09972
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/ReferenceDeclaration.java
@@ -0,0 +1,55 @@
+package org.jsweet.input.typescriptdef.ast;
+
+import static org.apache.commons.lang3.StringUtils.strip;
+
+import org.apache.commons.lang3.StringUtils;
+
+public class ReferenceDeclaration extends AbstractDeclaration {
+
+ private String referencedName;
+
+ public ReferenceDeclaration(Token token, String alias, String referencedName) {
+ super(token, alias);
+
+ this.referencedName = strip(referencedName, "[\"']");
+ }
+
+ @Override
+ public void accept(Visitor v) {
+ v.visitReferenceDeclaration(this);
+ }
+
+ @Override
+ public Declaration copy() {
+ ReferenceDeclaration copy = new ReferenceDeclaration(null, name, referencedName);
+ copy.setDocumentation(getDocumentation());
+ copy.name = name;
+ copy.referencedName = referencedName;
+ return copy;
+ }
+
+ public String getReferencedName() {
+ return referencedName;
+ }
+
+ public boolean isImport() {
+ return !isExport();
+ }
+
+ public boolean isExport() {
+ return StringUtils.isBlank(name);
+ }
+
+ @Override
+ public String toString() {
+ if (isExport()) {
+ return "export = " + referencedName;
+ } else {
+ return "import " + name + " = " + referencedName;
+ }
+ }
+
+ public void setReferencedName(String referencedName) {
+ this.referencedName = referencedName;
+ }
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Scanner.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Scanner.java
new file mode 100644
index 00000000..b0b14747
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Scanner.java
@@ -0,0 +1,743 @@
+package org.jsweet.input.typescriptdef.ast;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.Stack;
+import java.util.function.Predicate;
+
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+import org.jsweet.JSweetDefTranslatorConfig;
+
+public abstract class Scanner implements Visitor {
+
+ private Stack stack = new Stack();
+
+ protected final Logger logger = Logger.getLogger(getClass());
+
+ protected Context context;
+
+ public Scanner(Context context) {
+ this.context = context;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Scanner(Scanner parentScanner) {
+ this.context = parentScanner.context;
+ this.stack = (Stack) parentScanner.stack.clone();
+ }
+
+ public void onScanStart() {
+ }
+
+ public void onScanEnded() {
+ }
+
+ protected String getCurrentContainerName() {
+ return getContainerNameAtIndex(0);
+ }
+
+ /**
+ * Gets the container name at the stack.size()-i level.
+ *
+ * @param i
+ * the reversed index (0=top of the stack)
+ */
+ protected String getContainerNameAtIndex(int i) {
+ List modules = new ArrayList();
+ for (int j = 0; j < getStack().size() - i; j++) {
+ Visitable v = getStack().get(j);
+ if (v instanceof ModuleDeclaration) {
+ modules.add(((ModuleDeclaration) v).getName());
+ }
+ if (v instanceof TypeDeclaration && !((TypeDeclaration) v).isAnonymous()) {
+ modules.add(((TypeDeclaration) v).getName());
+ }
+ }
+ return StringUtils.join(modules.iterator(), ".");
+ }
+
+ protected String getCurrentModuleName() {
+ List modules = new ArrayList();
+ for (Visitable v : getStack()) {
+ if (v instanceof ModuleDeclaration) {
+ modules.add(((ModuleDeclaration) v).getName());
+ }
+ }
+ return StringUtils.join(modules.iterator(), ".");
+ }
+
+ /**
+ * Tells if the given declaration belongs to the current scanning stack.
+ */
+ protected boolean isInScope(Declaration declaration) {
+ boolean inScope = false;
+ for (int i = 0; i < getStack().size(); i++) {
+ if (getStack().get(i) == declaration) {
+ inScope = true;
+ break;
+ }
+ }
+ return inScope;
+ }
+
+ protected String getCurrentDeclarationName() {
+ StringBuffer sb = new StringBuffer();
+ for (Visitable v : getStack()) {
+ if (v instanceof Declaration) {
+ sb.append(((Declaration) v).getName());
+ sb.append('.');
+ }
+ }
+ if (!getStack().isEmpty() && !(sb.length() == 0)) {
+ sb.deleteCharAt(sb.length() - 1);
+ }
+ return sb.toString();
+ }
+
+ protected Visitable getRoot() {
+ if (getStack().isEmpty()) {
+ return null;
+ }
+
+ return getStack().get(0);
+ }
+
+ protected QualifiedDeclaration lookupTypeDeclaration(String name) {
+ if (name == null) {
+ return null;
+ }
+ // NOTE: it is possible to search using the context find methods... it
+ // would be nicer but it may be slower, so we do it this way... to be
+ // thought of
+ Set possibleNames = new LinkedHashSet();
+ String mainModuleName = "";
+ if (getRoot() instanceof CompilationUnit) {
+ mainModuleName = ((CompilationUnit) getRoot()).getMainModule().getName();
+ }
+
+ // lookup in current compilation unit
+ for (int i = 0; i < getStack().size(); i++) {
+ String containerName = getContainerNameAtIndex(i);
+ String declFullName = StringUtils.isBlank(containerName) ? name : containerName + "." + name;
+ if (declFullName.startsWith(mainModuleName)) {
+ possibleNames.add(declFullName.substring(mainModuleName.length() + 1));
+ }
+ TypeDeclaration match = context.getTypeDeclaration(declFullName);
+ if (match != null) {
+ return new QualifiedDeclaration<>(match, declFullName);
+ }
+ }
+
+ // lookup in all compilation units
+ for (CompilationUnit compilUnit : context.compilationUnits) {
+ for (String rootRelativeName : possibleNames) {
+ TypeDeclaration match = context
+ .getTypeDeclaration(compilUnit.getMainModule().getName() + "." + rootRelativeName);
+ if (match != null) {
+ return new QualifiedDeclaration<>(match,
+ compilUnit.getMainModule().getName() + "." + rootRelativeName);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ protected QualifiedDeclaration lookupModuleDeclaration(String name) {
+ Set possibleNames = new LinkedHashSet();
+ String mainModuleName = "";
+ if (getRoot() instanceof CompilationUnit) {
+ mainModuleName = ((CompilationUnit) getRoot()).getMainModule().getName();
+ }
+
+ // lookup in current compilation unit
+ for (int i = 0; i < getStack().size(); i++) {
+ String containerName = getContainerNameAtIndex(i);
+ String declFullName = StringUtils.isBlank(containerName) ? name : containerName + "." + name;
+
+ if (declFullName.startsWith(mainModuleName)) {
+ possibleNames.add(declFullName.substring(mainModuleName.length() + 1));
+ }
+ List> matches = context.findDeclarations(ModuleDeclaration.class,
+ declFullName);
+ for (QualifiedDeclaration m : matches) {
+ return m;
+ }
+ }
+
+ // lookup in all compilation units
+ for (CompilationUnit compilUnit : context.compilationUnits) {
+ for (String rootRelativeName : possibleNames) {
+ List> matches = context.findDeclarations(
+ ModuleDeclaration.class, compilUnit.getMainModule().getName() + "." + rootRelativeName);
+ for (QualifiedDeclaration m : matches) {
+ return m;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ protected Type lookupType(TypeReference reference) {
+ return lookupType(reference, null, false, false);
+ }
+
+ protected Type lookupType(TypeReference reference, String modName) {
+ return lookupType(reference, modName, false, false);
+ }
+
+ protected boolean isFunctionalTypeReference(TypeReference typeReference) {
+ Type t = lookupType(typeReference, null);
+ if (t == null || !(t instanceof TypeDeclaration)) {
+ return false;
+ }
+ TypeDeclaration td = (TypeDeclaration) t;
+ if (context.getTypeName(td).startsWith(JSweetDefTranslatorConfig.FUNCTION_CLASSES_PACKAGE)
+ || context.getTypeName(td).startsWith("java.util.function")) {
+ return true;
+ }
+ if (td.isAnnotationPresent(FunctionalInterface.class)) {
+ return true;
+ }
+ return false;
+ }
+
+ protected boolean isSuperTypeReference(TypeReference typeReference) {
+ if (!(getParent() instanceof TypeDeclaration)) {
+ return false;
+ }
+
+ TypeDeclaration parentDeclaration = (TypeDeclaration) getParent();
+ if (!ArrayUtils.contains(parentDeclaration.getSuperTypes(), typeReference)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ protected boolean isTypeArgumentTypeReference(TypeReference typeReference) {
+ if (!(getParent() instanceof TypeReference)) {
+ return false;
+ }
+
+ TypeReference parentReference = (TypeReference) getParent();
+ if (!ArrayUtils.contains(parentReference.typeArguments, typeReference)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ protected TypeDeclaration extraLookup(TypeReference reference, String modName) {
+ if (reference.getName() == null) {
+ return null;
+ }
+
+ QualifiedDeclaration type = context.findFirstDeclaration(TypeDeclaration.class,
+ reference.getName(), getParent(CompilationUnit.class));
+ if (type != null) {
+ return type.getDeclaration();
+ }
+ type = context.findFirstDeclaration(TypeDeclaration.class, "*." + reference.getName(),
+ getParent(CompilationUnit.class));
+ if (type != null) {
+ return type.getDeclaration();
+ }
+ return null;
+
+ // return lookupInLibModules(context.getLibModule(modName),
+ // context.getLibRelativePath(modName), reference);
+ }
+
+ protected Type lookupType(TypeReference reference, String modName, boolean createIfNotFound,
+ boolean verboseIfNotFound) {
+ if (reference.getDeclaration() != null) {
+ return reference.getDeclaration();
+ }
+ if (reference.isTypeOf()) {
+ return null;
+ }
+ if (reference.isObjectType()) {
+ reference.setDeclaration(reference.getObjectType());
+ return reference.getObjectType();
+ } else {
+ // lookup in the global type repository
+ if (modName == null) {
+ modName = getCurrentModuleName();
+ }
+ TypeDeclaration t = context.getTypeDeclaration(modName + "." + reference.getName());
+ if (t == null) {
+ t = context.getTypeDeclaration(reference.getName());
+ if (t == null) {
+ String containerName = getCurrentContainerName();
+ t = context.getTypeDeclaration(containerName + "." + reference.getName());
+ if (t == null) {
+ if (!JSweetDefTranslatorConfig.isJDKReplacementMode()) {
+ t = context.getTypeDeclaration("java.lang." + reference.getName());
+ }
+ if (t == null) {
+ t = context.getTypeDeclaration(
+ JSweetDefTranslatorConfig.GLOBALS_PACKAGE_NAME + "." + reference.getName());
+ if (t == null) {
+ t = context.getTypeDeclaration(
+ JSweetDefTranslatorConfig.LANG_PACKAGE + "." + reference.getName());
+ if (t == null) {
+ t = context.getTypeDeclaration(
+ JSweetDefTranslatorConfig.DOM_PACKAGE + "." + reference.getName());
+ if (t == null) {
+ String[] subNames = modName.split("\\.");
+ String partialModName;
+ for (int i = subNames.length - 1; i > 0; i--) {
+ String[] a = ArrayUtils.subarray(subNames, 0, i);
+ partialModName = StringUtils.join(a, ".");
+ t = context.getTypeDeclaration(partialModName + "." + reference.getName());
+ if (t != null) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ // lookup in type parameters
+ if (t == null) {
+ TypeParameterizedElement tpe = getParent(TypeParameterizedElement.class, true);
+ while (tpe != null) {
+ if (tpe.getTypeParameters() != null) {
+ for (TypeParameterDeclaration d : tpe.getTypeParameters()) {
+ if (d.getName() != null && d.getName().equals(reference.getName())) {
+ reference.setDeclaration(d);
+ return d;
+ }
+ }
+ }
+ tpe = getParent(TypeParameterizedElement.class, tpe);
+ }
+ }
+
+ if (t == null) {
+ t = extraLookup(reference, modName);
+ }
+
+ if (t == null) {
+ QualifiedDeclaration match = lookupTypeDeclaration(reference.getName());
+ if (match != null) {
+ t = match.getDeclaration();
+ }
+ }
+
+ if (t == null) {
+ if (createIfNotFound) {
+ Token token = getCurrentToken();
+ System.err.println("WARNING: creating unknown reference " + reference + " at "
+ + (token == null ? "" : token.getLocation()));
+ String[] names = reference.getName().split("\\.");
+ TypeDeclaration type = new TypeDeclaration(null, "class", names[names.length - 1], null, null,
+ null);
+ ModuleDeclaration module;
+ if (names.length > 1) {
+ module = new ModuleDeclaration(null,
+ StringUtils.join(ArrayUtils.subarray(names, 0, names.length - 1), "."),
+ new Declaration[] { type });
+ context.registerModule(module.getName(), module);
+ } else {
+ module = new ModuleDeclaration(null, JSweetDefTranslatorConfig.GLOBALS_PACKAGE_NAME,
+ new Declaration[] { type });
+ }
+ context.compilationUnits.get(0).addMember(module);
+ context.registerType(module.getName() + "." + type.getName(), type);
+ } else {
+ if (verboseIfNotFound) {
+ Token token = getCurrentToken();
+ context.reportError("cannot find reference " + reference + " (" + getCurrentContainerName()
+ + "." + reference.getName() + ")" + " at "
+ + (token == null ? "" : token.getLocation()));
+ }
+ }
+ }
+
+ reference.setDeclaration(t);
+ return t;
+ }
+ }
+
+ protected QualifiedDeclaration lookupFunctionDeclaration(String name) {
+ Set possibleNames = new LinkedHashSet();
+ String mainModuleName = "";
+ if (getRoot() instanceof CompilationUnit) {
+ ModuleDeclaration mainModule = ((CompilationUnit) getRoot()).getMainModule();
+ if (mainModule != null) {
+ mainModuleName = mainModule.getName();
+ }
+ }
+
+ // lookup in current compilation unit
+ for (int i = 0; i < getStack().size(); i++) {
+ String containerName = getContainerNameAtIndex(i);
+ String declFullName = StringUtils.isBlank(containerName) ? name : containerName + "." + name;
+
+ if (declFullName.startsWith(mainModuleName)) {
+ possibleNames.add(declFullName.substring(mainModuleName.length() + 1));
+ }
+ List> matches = context
+ .findDeclarations(FunctionDeclaration.class, declFullName);
+ if (matches.size() > 0) {
+ return matches.get(0);
+ }
+ }
+
+ // lookup in all compilation units
+ for (CompilationUnit compilUnit : context.compilationUnits) {
+ if (compilUnit.getMainModule() == null) {
+ continue;
+ }
+ for (String rootRelativeName : possibleNames) {
+ List> matches = context.findDeclarations(
+ FunctionDeclaration.class, compilUnit.getMainModule().getName() + "." + rootRelativeName);
+ if (matches.size() > 0) {
+ return matches.get(0);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ protected QualifiedDeclaration lookupVariableDeclaration(String name) {
+ Set possibleNames = new LinkedHashSet();
+ String mainModuleName = "";
+ if (getRoot() instanceof CompilationUnit) {
+ ModuleDeclaration mainModule = ((CompilationUnit) getRoot()).getMainModule();
+ if (mainModule != null) {
+ mainModuleName = mainModule.getName();
+ }
+ }
+
+ // lookup in current compilation unit
+ for (int i = 0; i < getStack().size(); i++) {
+ String containerName = getContainerNameAtIndex(i);
+ String declFullName = StringUtils.isBlank(containerName) ? name : containerName + "." + name;
+
+ if (declFullName.startsWith(mainModuleName)) {
+ possibleNames.add(declFullName.substring(mainModuleName.length() + 1));
+ }
+ List> matches = context
+ .findDeclarations(VariableDeclaration.class, declFullName);
+ if (matches.size() > 0) {
+ return matches.get(0);
+ }
+ }
+
+ // lookup in all compilation units
+ for (CompilationUnit compilUnit : context.compilationUnits) {
+ if (compilUnit.getMainModule() == null) {
+ continue;
+ }
+ for (String rootRelativeName : possibleNames) {
+ List> matches = context.findDeclarations(
+ VariableDeclaration.class, compilUnit.getMainModule().getName() + "." + rootRelativeName);
+ if (matches.size() > 0) {
+ return matches.get(0);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ protected FunctionDeclaration lookupFunctionDeclaration(TypeReference typeReference, String name,
+ TypeReference... argTypes) {
+ TypeDeclaration type = (TypeDeclaration) lookupType(typeReference, null);
+ if (type == null) {
+ return null;
+ }
+ boolean found = false;
+ for (Declaration d : type.getMembers()) {
+ if (name.equals(d.getName())) {
+ if (d instanceof FunctionDeclaration) {
+ FunctionDeclaration function = (FunctionDeclaration) d;
+ if (argTypes.length == function.getParameters().length) {
+ found = true;
+ for (int i = 0; i < argTypes.length; i++) {
+ if (!argTypes[i].equals(function.getParameters()[i].getType())) {
+ found = false;
+ }
+ }
+ if (found) {
+ return function;
+ }
+ }
+ }
+ }
+ }
+ if (type.getSuperTypes() != null) {
+ for (TypeReference t : type.getSuperTypes()) {
+ FunctionDeclaration f = lookupFunctionDeclaration(t, name, argTypes);
+ if (f != null) {
+ return f;
+ }
+ }
+ }
+ return null;
+ }
+
+ public void printStackTrace(PrintStream out) {
+ out.println("Dumping scanner stack: " + this.getClass().getSimpleName() + " - " + stack.size());
+ for (int i = stack.size() - 1; i >= 0; i--) {
+ if (stack.get(i) instanceof AstNode) {
+ AstNode node = (AstNode) stack.get(i);
+ out.println(" " + node.getClass().getSimpleName() + " - "
+ + (node.getToken() == null ? "N/A" : node.getToken() + " " + node.getToken().getLocation()));
+ }
+ }
+ }
+
+ public Token getCurrentToken() {
+ for (int i = stack.size() - 1; i >= 0; i--) {
+ if (stack.get(i) instanceof AstNode) {
+ AstNode node = (AstNode) stack.get(i);
+ if (node.getToken() != null) {
+ return node.getToken();
+ }
+ }
+ }
+ return null;
+ }
+
+ protected void enter(Visitable element) {
+ if (!stack.isEmpty() && stack.peek() == element) {
+ printStackTrace(System.err);
+ logger.error("FATAL ERROR: duplicate entry: " + element);
+ throw new RuntimeException("FATAL ERROR: duplicate entry: " + element);
+ }
+ stack.push(element);
+ }
+
+ protected void exit() {
+ stack.pop();
+ }
+
+ public Stack getStack() {
+ return this.stack;
+ }
+
+ /**
+ * Gets the current parent AST node from the stack.
+ */
+ public Visitable getParent() {
+ return this.stack.get(this.stack.size() - 2);
+ }
+
+ /**
+ * Gets the nth level parent AST node from the stack (getParent(1) ==
+ * getParent()).
+ */
+ public Visitable getParent(int level) {
+ return this.stack.get(this.stack.size() - (level + 1));
+ }
+
+ public T getParent(Predicate predicate) {
+ return getParent(predicate, false);
+ }
+
+ public T getParent(Class type) {
+ return getParent(type, false);
+ }
+
+ @SuppressWarnings("unchecked")
+ public T getParent(Class type, boolean includeCurrent) {
+ for (int i = this.stack.size() - (includeCurrent ? 1 : 2); i >= 0; i--) {
+ if (type.isAssignableFrom(this.stack.get(i).getClass())) {
+ return (T) this.stack.get(i);
+ }
+ }
+ return null;
+ }
+
+ public List getParents(Class type) {
+ List parents = new ArrayList();
+ for (int i = this.stack.size() - 1; i >= 0; i--) {
+ if (type.isAssignableFrom(this.stack.get(i).getClass())) {
+ @SuppressWarnings("unchecked")
+ T t = (T) this.stack.get(i);
+ parents.add(t);
+ }
+ }
+ return parents;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List getParents(Predicate predicate) {
+ List parents = new ArrayList();
+ for (int i = this.stack.size() - 1; i >= 0; i--) {
+ if (predicate.test(this.stack.get(i))) {
+ T t = (T) this.stack.get(i);
+ parents.add(t);
+ }
+ }
+ return parents;
+ }
+
+ @SuppressWarnings("unchecked")
+ public T getParent(Predicate predicate, boolean includeCurrent) {
+ for (int i = this.stack.size() - (includeCurrent ? 1 : 2); i >= 0; i--) {
+ if (predicate.test(this.stack.get(i))) {
+ return (T) this.stack.get(i);
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public T getParent(Class type, Visitable from) {
+ for (int i = this.stack.size() - 1; i >= 0; i--) {
+ if (this.stack.get(i) == from) {
+ for (int j = i - 1; j >= 0; j--) {
+ if (type.isAssignableFrom(this.stack.get(j).getClass())) {
+ return (T) this.stack.get(j);
+ }
+ }
+ return null;
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public T getParent(Predicate predicate, Visitable from) {
+ for (int i = this.stack.size() - 1; i >= 0; i--) {
+ if (this.stack.get(i) == from) {
+ for (int j = i - 1; j >= 0; j--) {
+ if (predicate.test(this.stack.get(j))) {
+ return (T) this.stack.get(j);
+ }
+ }
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public void scan(Visitable visitable) {
+ if (visitable != null && !visitable.isHidden()) {
+ enter(visitable);
+ try {
+ visitable.accept(this);
+ } finally {
+ exit();
+ }
+ }
+ }
+
+ public void scan(Visitable[] visitables) {
+ if (visitables != null) {
+ for (Visitable visitable : visitables) {
+ scan(visitable);
+ }
+ }
+ }
+
+ public void scan(List extends Visitable> visitables) {
+ if (visitables != null) {
+ for (Visitable visitable : visitables) {
+ scan(visitable);
+ }
+ }
+ }
+
+ @Override
+ public void visitCompilationUnit(CompilationUnit compilationUnit) {
+ scan(compilationUnit.getDeclarations());
+ }
+
+ @Override
+ public void visitModuleDeclaration(ModuleDeclaration moduleDeclaration) {
+ scan(moduleDeclaration.getMembers());
+ }
+
+ @Override
+ public void visitTypeDeclaration(TypeDeclaration typeDeclaration) {
+ scan(typeDeclaration.getTypeParameters());
+ scan(typeDeclaration.getSuperTypes());
+ scan(typeDeclaration.getMergedSuperTypes());
+ scan(typeDeclaration.getMembers());
+ }
+
+ @Override
+ public void visitFunctionDeclaration(FunctionDeclaration functionDeclaration) {
+ scan(functionDeclaration.getTypeParameters());
+ scan(functionDeclaration.getType());
+ scan(functionDeclaration.getParameters());
+ }
+
+ @Override
+ public void visitVariableDeclaration(VariableDeclaration variableDeclaration) {
+ scan(variableDeclaration.getType());
+ scan(variableDeclaration.getInitializer());
+ }
+
+ @Override
+ public void visitParameterDeclaration(ParameterDeclaration parameterDeclaration) {
+ scan(parameterDeclaration.getType());
+ }
+
+ @Override
+ public void visitTypeReference(TypeReference typeReference) {
+ scan(typeReference.getObjectType());
+ scan(typeReference.getTypeArguments());
+ }
+
+ @Override
+ public void visitTypeMacro(TypeMacroDeclaration typeMacroDeclaration) {
+ scan(typeMacroDeclaration.getTypeParameters());
+ scan(typeMacroDeclaration.getType());
+ }
+
+ @Override
+ public void visitFunctionalTypeReference(FunctionalTypeReference functionalTypeReference) {
+ scan(functionalTypeReference.getReturnType());
+ scan(functionalTypeReference.getParameters());
+ }
+
+ @Override
+ public void visitArrayTypeReference(ArrayTypeReference arrayTypeReference) {
+ scan(arrayTypeReference.getComponentType());
+ }
+
+ @Override
+ public void visitUnionTypeReference(UnionTypeReference unionTypeReference) {
+ switch (unionTypeReference.getSelected()) {
+ case LEFT:
+ scan(unionTypeReference.getLeftType());
+ break;
+ case RIGHT:
+ scan(unionTypeReference.getRightType());
+ break;
+ default:
+ scan(unionTypeReference.getLeftType());
+ scan(unionTypeReference.getRightType());
+ }
+ }
+
+ @Override
+ public void visitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration) {
+ scan(typeParameterDeclaration.getUpperBound());
+ }
+
+ @Override
+ public void visitLiteral(Literal literal) {
+ }
+
+ @Override
+ public void visitReferenceDeclaration(ReferenceDeclaration referenceDeclaration) {
+ }
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Token.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Token.java
new file mode 100644
index 00000000..92405f43
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Token.java
@@ -0,0 +1,80 @@
+package org.jsweet.input.typescriptdef.ast;
+
+/**
+ * @author Renaud Pawlak
+ */
+public class Token {
+
+ public int type;
+
+ /**
+ * Creates a new token
+ *
+ * @param type
+ * the type as defined in the lexer
+ * @param fileName
+ * the name of the file from where the token was extracted
+ * @param text
+ * the text of the token
+ * @param line
+ * the line number where the token appears in the file
+ * @param charBegin
+ * the character where it begins in the file
+ * @param charEnd
+ * the character where it ends in the file
+ */
+ public Token(int type, String fileName, String text, int line,
+ int charBegin, int charEnd) {
+
+ this.type = type;
+ this.fileName = fileName;
+ this.text = text;
+ this.line = line;
+ this.charBegin = charBegin;
+ this.charEnd = charEnd;
+ }
+
+ public String getLocation() {
+ return "" + fileName + ":" + line + "(" + charBegin + ")";
+ }
+
+ String fileName;
+ String text;
+ int line;
+ int charBegin;
+ int charEnd;
+
+ // public boolean equals(Object o) {
+ // System.err.println("equals("+this+","+o+")");
+ // return text.equals(o.toString());
+ // }
+
+ public String toString() {
+ return text;
+ }
+
+ public int getCharBegin() {
+ return charBegin;
+ }
+
+ public int getCharEnd() {
+ return charEnd;
+ }
+
+ public int getLine() {
+ return line;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Type.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Type.java
new file mode 100644
index 00000000..51a3aebc
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Type.java
@@ -0,0 +1,9 @@
+package org.jsweet.input.typescriptdef.ast;
+
+public interface Type {
+
+ String getName();
+
+ boolean isSubtypeOf(Type type);
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeDeclaration.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeDeclaration.java
new file mode 100644
index 00000000..ccaa3b59
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeDeclaration.java
@@ -0,0 +1,247 @@
+package org.jsweet.input.typescriptdef.ast;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.apache.commons.lang3.ArrayUtils;
+
+public class TypeDeclaration extends AbstractDeclaration
+ implements Type, TypeParameterizedElement, DeclarationContainer {
+
+ private Declaration[] members;
+ private TypeReference[] superTypes;
+ private TypeReference[] mergedSuperTypes;
+ private TypeParameterDeclaration[] typeParameters;
+ private String kind;
+ private String originalKind;
+ private boolean external = false;
+
+ public static TypeDeclaration createExternalTypeDeclaration(String simpleName) {
+ return createExternalTypeDeclaration("class", simpleName);
+ }
+
+ public static TypeDeclaration createExternalTypeDeclaration(String kind, String simpleName) {
+ TypeDeclaration t = new TypeDeclaration(null, kind, simpleName, null, null, new Declaration[0]);
+ t.setExternal(true);
+ return t;
+ }
+
+ public static TypeDeclaration createTypeDeclaration(String simpleName) {
+ TypeDeclaration t = new TypeDeclaration(null, "class", simpleName, null, null, new Declaration[0]);
+ return t;
+ }
+
+ public TypeDeclaration(Token token, String kind, String name, TypeParameterDeclaration[] typeParameters,
+ TypeReference[] superTypes, Declaration[] members) {
+ super(token, name);
+ this.kind = this.originalKind = kind;
+ this.typeParameters = typeParameters;
+ this.setSuperTypes(superTypes);
+ if (members != null) {
+ this.members = members;
+ } else {
+ this.members = new Declaration[0];
+ }
+ // System.out.println("new TypeDeclaration: " + this);
+ }
+
+ @Override
+ public void accept(Visitor v) {
+ v.visitTypeDeclaration(this);
+ }
+
+ @Override
+ public Declaration[] getMembers() {
+ return members;
+ }
+
+ @Override
+ public void addMember(Declaration declaration) {
+ members = DeclarationHelper.addMember(this, declaration);
+ }
+
+ @Override
+ public void removeMember(Declaration declaration) {
+ members = DeclarationHelper.removeMember(this, declaration);
+ }
+
+ @Override
+ public void replaceMember(Declaration existingDeclaration, Declaration withNewDeclaration) {
+ members = DeclarationHelper.replaceMember(this, existingDeclaration, withNewDeclaration);
+ }
+
+ @Override
+ public void clearMembers() {
+ members = new Declaration[0];
+ }
+
+ public TypeReference[] getSuperTypes() {
+ return superTypes;
+ }
+
+ public void setSuperTypes(TypeReference[] superTypes) {
+ this.superTypes = superTypes;
+ }
+
+ @Override
+ public TypeParameterDeclaration[] getTypeParameters() {
+ return this.typeParameters;
+ }
+
+ @Override
+ public void setTypeParameters(TypeParameterDeclaration[] typeParameters) {
+ this.typeParameters = typeParameters;
+ }
+
+ public FunctionDeclaration findFirstConstructor() {
+ return DeclarationHelper.findFirstConstructor(this);
+ }
+
+ public List findConstructors() {
+ return DeclarationHelper.findConstructors(this);
+ }
+
+ public boolean isStatic() {
+ return DeclarationHelper.isStatic(this);
+ }
+
+ public FunctionDeclaration findFirstFunction(String name) {
+ return DeclarationHelper.findFirstFunction(this, name);
+ }
+
+ public List findFunctions(String name) {
+ return DeclarationHelper.findFunctions(this, name);
+ }
+
+ public VariableDeclaration findVariable(String name) {
+ return DeclarationHelper.findVariable(this, name);
+ }
+
+ @Override
+ public VariableDeclaration findVariableIgnoreCase(String name) {
+ return DeclarationHelper.findVariableIgnoreCase(this, name);
+ }
+
+ @Override
+ public TypeDeclaration findType(String name) {
+ return DeclarationHelper.findType(this, name);
+ }
+
+ @Override
+ public TypeDeclaration findTypeIgnoreCase(String name) {
+ return DeclarationHelper.findTypeIgnoreCase(this, name);
+ }
+
+ @Override
+ public Declaration findDeclaration(String name) {
+ return DeclarationHelper.findDeclaration(this, name);
+ }
+
+ @Override
+ public void addMembers(Declaration[] declarations) {
+ DeclarationHelper.addMembers(this, declarations);
+ }
+
+ @Override
+ public Declaration findDeclaration(Declaration declaration) {
+ return DeclarationHelper.findDeclaration(this, declaration);
+ }
+
+ public String getKind() {
+ return kind;
+ }
+
+ public void setKind(String kind) {
+ this.originalKind = this.kind;
+ this.kind = kind;
+ }
+
+ @Override
+ public TypeDeclaration copy() {
+ TypeDeclaration copy = new TypeDeclaration(null, getKind(), getName(),
+ DeclarationHelper.copy(getTypeParameters()), DeclarationHelper.copyReferences(superTypes),
+ DeclarationHelper.copy(members));
+ copy.setDocumentation(getDocumentation());
+ copy.setModifiers(this.getModifiers() == null ? null : new HashSet(getModifiers()));
+ copy.setStringAnnotations(
+ this.getStringAnnotations() == null ? null : new ArrayList(getStringAnnotations()));
+ copy.originalKind = this.originalKind;
+ return copy;
+ }
+
+ public boolean isExternal() {
+ boolean external = this.external || (getDocumentation() != null && isInputAnnotatedWith("External"));
+ return external;
+ }
+
+ public void setExternal(boolean external) {
+ this.external = external;
+ }
+
+ @Override
+ public boolean isSubtypeOf(Type type) {
+ if (type == null) {
+ return false;
+ }
+ if (getSuperTypes() != null) {
+ for (TypeReference tref : getSuperTypes()) {
+ TypeDeclaration t = (TypeDeclaration) tref.getDeclaration();
+ if (type == t) {
+ return true;
+ } else {
+ if (t != null) {
+ return t.isSubtypeOf(type);
+ }
+ }
+ }
+ }
+ return false;
+
+ }
+
+ public boolean isInterface() {
+ return getKind() != null && getKind().equals("interface");
+ }
+
+ public boolean isFunctionalInterface() {
+ return isInterface() && getMembers().length == 1;
+ }
+
+ @Override
+ public String toString() {
+ if (name != null) {
+ return super.toString();
+ } else {
+ // print inlined toString (probably an object type)
+ StringBuilder sb = new StringBuilder();
+ sb.append("{");
+ for (Declaration d : getMembers()) {
+ sb.append(d.toString()).append(";");
+ }
+ sb.append("}");
+ return sb.toString();
+ }
+ }
+
+ public TypeReference[] getMergedSuperTypes() {
+ return mergedSuperTypes;
+ }
+
+ public void setMergedSuperTypes(TypeReference[] mergedSuperTypes) {
+ this.mergedSuperTypes = mergedSuperTypes;
+ }
+
+ public void addMergedSuperType(TypeReference mergedSuperType) {
+ if (this.mergedSuperTypes == null) {
+ this.mergedSuperTypes = new TypeReference[] { mergedSuperType };
+ } else {
+ this.mergedSuperTypes = ArrayUtils.add(mergedSuperTypes, mergedSuperType);
+ }
+ }
+
+ public final String getOriginalKind() {
+ return originalKind;
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeMacroDeclaration.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeMacroDeclaration.java
new file mode 100644
index 00000000..ff13f68a
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeMacroDeclaration.java
@@ -0,0 +1,45 @@
+package org.jsweet.input.typescriptdef.ast;
+
+import java.util.HashSet;
+
+public class TypeMacroDeclaration extends TypeDeclaration implements TypedDeclaration {
+
+ private TypeReference type;
+
+ public TypeMacroDeclaration(Token token, String aliasName, TypeParameterDeclaration[] typeParameters, TypeReference type) {
+ super(token, "type", aliasName, typeParameters, null, null);
+ this.type = type;
+ }
+
+ @Override
+ public void accept(Visitor v) {
+ v.visitTypeMacro(this);
+ }
+
+ @Override
+ public TypeMacroDeclaration copy() {
+ TypeMacroDeclaration copy = new TypeMacroDeclaration(null, getName(), getTypeParameters(), getType());
+ copy.setDocumentation(getDocumentation());
+ copy.setModifiers(this.getModifiers() == null ? null : new HashSet(getModifiers()));
+ return copy;
+ }
+
+ @Override
+ public boolean isSubtypeOf(Type type) {
+ if (type == null) {
+ return false;
+ }
+
+ return type.isSubtypeOf(getType().getDeclaration());
+ }
+
+ @Override
+ public TypeReference getType() {
+ return type;
+ }
+
+ @Override
+ public void setType(TypeReference type) {
+ this.type = type;
+ }
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeParameterDeclaration.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeParameterDeclaration.java
new file mode 100644
index 00000000..b0ac1186
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeParameterDeclaration.java
@@ -0,0 +1,47 @@
+package org.jsweet.input.typescriptdef.ast;
+
+
+public class TypeParameterDeclaration extends AbstractDeclaration implements Type, TypedDeclaration {
+
+ protected TypeReference upperBound;
+
+ public TypeParameterDeclaration(Token token, String name) {
+ super(token, name);
+ }
+
+ @Override
+ public void accept(Visitor visitor) {
+ visitor.visitTypeParameterDeclaration(this);
+ }
+
+ public TypeReference getUpperBound() {
+ return upperBound;
+ }
+
+ public void setUpperBound(TypeReference upperBound) {
+ this.upperBound = upperBound;
+ }
+
+ @Override
+ public TypeParameterDeclaration copy() {
+ TypeParameterDeclaration copy = new TypeParameterDeclaration(null, getName());
+ copy.upperBound = upperBound == null ? null : upperBound.copy();
+ return copy;
+ }
+
+ @Override
+ public void setType(TypeReference type) {
+ upperBound = type;
+ }
+
+ @Override
+ public TypeReference getType() {
+ return upperBound;
+ }
+
+ @Override
+ public boolean isSubtypeOf(Type type) {
+ return false;
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeParameterizedElement.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeParameterizedElement.java
new file mode 100644
index 00000000..2b76dcd8
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeParameterizedElement.java
@@ -0,0 +1,9 @@
+package org.jsweet.input.typescriptdef.ast;
+
+public interface TypeParameterizedElement extends AstNode {
+
+ TypeParameterDeclaration[] getTypeParameters();
+
+ void setTypeParameters(TypeParameterDeclaration[] typeParameters);
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeReference.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeReference.java
new file mode 100644
index 00000000..74e746b6
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypeReference.java
@@ -0,0 +1,231 @@
+package org.jsweet.input.typescriptdef.ast;
+
+import org.apache.commons.lang3.StringUtils;
+import org.jsweet.JSweetDefTranslatorConfig;
+import org.jsweet.input.typescriptdef.util.Util;
+
+public class TypeReference extends AbstractAstNode implements NamedElement {
+
+ protected TypeReference[] typeArguments;
+ protected String name;
+ protected TypeDeclaration objectType;
+ // cache to the declaration
+ transient private Type declaration;
+ private boolean typeOf = false;
+
+ public boolean isTypeOf() {
+ return typeOf;
+ }
+
+ public void setTypeOf(boolean typeOf) {
+ this.typeOf = typeOf;
+ }
+
+ public TypeReference(Token token, String name, TypeReference[] typeArguments) {
+ super(token);
+ if ("$tuple$".equals(name)) {
+ name = JSweetDefTranslatorConfig.TUPLE_CLASSES_PACKAGE + "."
+ + JSweetDefTranslatorConfig.TUPLE_CLASSES_PREFIX + typeArguments.length;
+ }
+ this.name = name;
+ this.typeArguments = typeArguments;
+ }
+
+ public TypeReference(Token token, Type type, TypeReference[] typeArguments) {
+ super(token);
+ this.name = type.getName();
+ this.typeArguments = typeArguments;
+ this.declaration = type;
+ }
+
+ public TypeReference(Token token, Declaration[] members) {
+ super(token);
+ this.objectType = new TypeDeclaration(token, "object_type", null, null, null, members);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ if (objectType != null) {
+ sb.append(objectType.toString());
+ } else {
+ sb.append(name);
+ if (typeArguments != null && typeArguments.length > 0) {
+ sb.append("<");
+ for (TypeReference t : typeArguments) {
+ sb.append(t);
+ sb.append(",");
+ }
+ sb.deleteCharAt(sb.length() - 1);
+ sb.append(">");
+ }
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public void accept(Visitor visitor) {
+ visitor.visitTypeReference(this);
+ }
+
+ public TypeReference[] getTypeArguments() {
+ return this.typeArguments;
+ }
+
+ public void setTypeArguments(TypeReference[] typeArguments) {
+ this.typeArguments = typeArguments;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isObjectType() {
+ return objectType != null;
+ }
+
+ public TypeDeclaration getObjectType() {
+ return objectType;
+ }
+
+ @Override
+ public boolean isAnonymous() {
+ return name == null;
+ }
+
+ public boolean isStringType() {
+ return name != null && (name.startsWith("\"") && name.endsWith("\""));
+ }
+
+ public boolean isPrimitive() {
+ return DeclarationHelper.isPrimitiveType(name);
+ }
+
+ public String getWrappingTypeName() {
+ if ("any".equals(name)) {
+ return "java.lang.Object";
+ } else if (isPrimitive()) {
+ return StringUtils.capitalize(name);
+ } else {
+ return name;
+ }
+ }
+
+ public String getSimpleName() {
+ return Util.getSimpleName(name);
+ }
+
+ public String getQualifier() {
+ return Util.getQualifier(name);
+ }
+
+ public boolean isQualified() {
+ return Util.isQualified(name);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!obj.getClass().equals(getClass())) {
+ return false;
+ }
+ TypeReference tr = (TypeReference) obj;
+ if (name == null && tr.name == null) {
+ if (objectType != null && tr.objectType != null) {
+ return DeclarationHelper.areDeclarationsEqual(objectType.getMembers(), tr.objectType.getMembers());
+ }
+ return false;
+ }
+
+ if (name == null && tr.name != null) {
+ return false;
+ }
+ if (!name.equals(tr.name)) {
+ return false;
+ }
+ return true;
+ }
+
+ public TypeReference copy(boolean copyDeclarations) {
+ TypeReference copy = new TypeReference(null, getName(), DeclarationHelper.copyReferences(typeArguments, copyDeclarations));
+ if (objectType != null) {
+ copy.objectType = objectType.copy();
+ }
+ if (copyDeclarations) {
+ copy.declaration = declaration;
+ }
+ return copy;
+ }
+
+ public TypeReference copy() {
+ return copy(false);
+ }
+
+ public Type getDeclaration() {
+ return declaration;
+ }
+
+ public void setDeclaration(Type type) {
+ this.declaration = type;
+ }
+
+ public boolean isArray() {
+ return false;
+ }
+
+ public TypeReference getComponentType() {
+ return this;
+ }
+
+ public boolean isSubtypeOf(TypeReference type) {
+ if (declaration == null) {
+ throw new RuntimeException("unattributed type reference: " + this);
+ }
+ if (!type.isArray() && type.declaration == null) {
+ throw new RuntimeException("unattributed type reference: " + type);
+ }
+ return declaration.isSubtypeOf(type.declaration);
+ }
+
+ /**
+ * Substitutes a type reference if found in the node.
+ *
+ * @param targetType
+ * the type reference to be substituted, if found in the node
+ * @param newType
+ * the new type reference that will be substituted to target type
+ * @return true if the target type was found and substituted
+ */
+ public boolean substituteTypeReference(TypeReference targetType, TypeReference newType) {
+ if (typeArguments != null) {
+ for (int i = 0; i < typeArguments.length; i++) {
+ if (typeArguments[i] == targetType) {
+ typeArguments[i] = newType;
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getOriginalName() {
+ return name;
+ }
+
+ @Override
+ public void setOriginalName(String name) {
+ this.name = name;
+ }
+
+ public boolean isTuple() {
+ return name != null && name.startsWith(
+ JSweetDefTranslatorConfig.TUPLE_CLASSES_PACKAGE + "." + JSweetDefTranslatorConfig.TUPLE_CLASSES_PREFIX);
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypedDeclaration.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypedDeclaration.java
new file mode 100644
index 00000000..03c230f6
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/TypedDeclaration.java
@@ -0,0 +1,10 @@
+package org.jsweet.input.typescriptdef.ast;
+
+public interface TypedDeclaration extends Declaration {
+
+ TypeReference getType();
+
+ void setType(TypeReference type);
+
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/UnionTypeReference.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/UnionTypeReference.java
new file mode 100644
index 00000000..dcd9bffd
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/UnionTypeReference.java
@@ -0,0 +1,352 @@
+package org.jsweet.input.typescriptdef.ast;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class UnionTypeReference extends TypeReference {
+
+ public enum Selected {
+ NONE, PENDING, LEFT, RIGHT;
+ public Selected inverse() {
+ switch (this) {
+ case LEFT:
+ return RIGHT;
+ case RIGHT:
+ return LEFT;
+ default:
+ return NONE;
+ }
+ }
+ }
+
+ private TypeReference leftType;
+ private TypeReference rightType;
+ private Selected selected = Selected.NONE;
+ private boolean intersection = false;
+
+ public UnionTypeReference(Token token, TypeReference leftType, TypeReference rightType) {
+ this(token, leftType, rightType, false);
+ }
+
+ public UnionTypeReference(Token token, TypeReference leftType, TypeReference rightType, boolean intersection) {
+ super(token, intersection ? "&" : "|", null);
+ setLeftType(leftType);
+ setRightType(rightType);
+ }
+
+ @Override
+ public void accept(Visitor visitor) {
+ visitor.visitUnionTypeReference(this);
+ }
+
+ public TypeReference getLeftType() {
+ return leftType;
+ }
+
+ public void setLeftType(TypeReference leftType) {
+ this.leftType = leftType;
+ if (leftType != null && leftType.getName() != null && leftType.getName().equals("void")) {
+ selected = Selected.RIGHT;
+ }
+ }
+
+ public TypeReference getRightType() {
+ return rightType;
+ }
+
+ public void setRightType(TypeReference rightType) {
+ this.rightType = rightType;
+ if (rightType != null && rightType.getName() != null && rightType.getName().equals("void")) {
+ selected = Selected.LEFT;
+ }
+ }
+
+ @Override
+ public UnionTypeReference copy(boolean copyDeclarations) {
+ UnionTypeReference copy = new UnionTypeReference(null, leftType.copy(copyDeclarations),
+ rightType.copy(copyDeclarations));
+ copy.typeArguments = DeclarationHelper.copyReferences(typeArguments, copyDeclarations);
+ copy.selected = this.selected;
+ return copy;
+ }
+
+ @Override
+ public UnionTypeReference copy() {
+ return copy(false);
+ }
+
+ @Override
+ public String toString() {
+ switch (selected) {
+ case LEFT:
+ return leftType.toString();
+ case RIGHT:
+ return rightType.toString();
+ case PENDING:
+ return leftType.toString() + " |? " + rightType.toString();
+ default:
+ return leftType.toString() + " | " + rightType.toString();
+ }
+ }
+
+ public Selected getSelected() {
+ // if (leftT)
+
+ return selected;
+ }
+
+ public void setSelected(Selected selected) {
+ this.selected = selected;
+ }
+
+ public TypeReference getOperand(Selected selected) {
+ switch (selected) {
+ case LEFT:
+ return leftType;
+ case RIGHT:
+ return rightType;
+ default:
+ return null;
+ }
+ }
+
+ public TypeReference getSelectedType() {
+ switch (selected) {
+ case LEFT:
+ return leftType;
+ case RIGHT:
+ return rightType;
+ default:
+ return null;
+ }
+ }
+
+ public List getTypes() {
+ List types = new LinkedList<>();
+ TypeReference selectedType = getSelectedType();
+ if (selectedType != null) {
+ if (selectedType instanceof UnionTypeReference) {
+ types.addAll(((UnionTypeReference) selectedType).getTypes());
+ } else {
+ types.add(selectedType);
+ }
+ } else {
+ // add both types if union hasn't been resolved
+ if (leftType instanceof UnionTypeReference) {
+ types.addAll(((UnionTypeReference) leftType).getTypes());
+ } else {
+ types.add(leftType);
+ }
+
+ if (rightType instanceof UnionTypeReference) {
+ types.addAll(((UnionTypeReference) rightType).getTypes());
+ } else {
+ types.add(rightType);
+ }
+ }
+
+ return types;
+ }
+
+ @Override
+ public Type getDeclaration() {
+ switch (selected) {
+ case LEFT:
+ return leftType.getDeclaration();
+ case RIGHT:
+ return rightType.getDeclaration();
+ default:
+ return super.getDeclaration();
+ }
+ }
+
+ @Override
+ public String getName() {
+ switch (selected) {
+ case LEFT:
+ return leftType.getName();
+ case RIGHT:
+ return rightType.getName();
+ default:
+ return super.getName();
+ }
+ }
+
+ @Override
+ public String getSimpleName() {
+ switch (selected) {
+ case LEFT:
+ return leftType.getSimpleName();
+ case RIGHT:
+ return rightType.getSimpleName();
+ default:
+ return super.getSimpleName();
+ }
+ }
+
+ @Override
+ public TypeDeclaration getObjectType() {
+ switch (selected) {
+ case LEFT:
+ return leftType.getObjectType();
+ case RIGHT:
+ return rightType.getObjectType();
+ default:
+ return super.getObjectType();
+ }
+ }
+
+ @Override
+ public TypeReference[] getTypeArguments() {
+ switch (selected) {
+ case LEFT:
+ return leftType.getTypeArguments();
+ case RIGHT:
+ return rightType.getTypeArguments();
+ default:
+ return super.getTypeArguments();
+ }
+ }
+
+ @Override
+ public String getWrappingTypeName() {
+ switch (selected) {
+ case LEFT:
+ return leftType.getWrappingTypeName();
+ case RIGHT:
+ return rightType.getWrappingTypeName();
+ default:
+ return super.getWrappingTypeName();
+ }
+ }
+
+ @Override
+ public boolean isAnonymous() {
+ switch (selected) {
+ case LEFT:
+ return leftType.isAnonymous();
+ case RIGHT:
+ return rightType.isAnonymous();
+ default:
+ return super.isAnonymous();
+ }
+ }
+
+ @Override
+ public boolean isHidden() {
+ switch (selected) {
+ case LEFT:
+ return leftType.isHidden();
+ case RIGHT:
+ return rightType.isHidden();
+ default:
+ return super.isHidden();
+ }
+ }
+
+ @Override
+ public boolean isObjectType() {
+ switch (selected) {
+ case LEFT:
+ return leftType.isObjectType();
+ case RIGHT:
+ return rightType.isObjectType();
+ default:
+ return super.isObjectType();
+ }
+ }
+
+ @Override
+ public boolean isPrimitive() {
+ switch (selected) {
+ case LEFT:
+ return leftType.isPrimitive();
+ case RIGHT:
+ return rightType.isPrimitive();
+ default:
+ return super.isPrimitive();
+ }
+ }
+
+ @Override
+ public boolean isStringType() {
+ switch (selected) {
+ case LEFT:
+ return leftType.isStringType();
+ case RIGHT:
+ return rightType.isStringType();
+ default:
+ return super.isStringType();
+ }
+ }
+
+ @Override
+ public boolean isArray() {
+ switch (selected) {
+ case LEFT:
+ return leftType.isArray();
+ case RIGHT:
+ return rightType.isArray();
+ default:
+ return super.isArray();
+ }
+ }
+
+ @Override
+ public TypeReference getComponentType() {
+ switch (selected) {
+ case LEFT:
+ return leftType.getComponentType();
+ case RIGHT:
+ return rightType.getComponentType();
+ default:
+ return super.getComponentType();
+ }
+ }
+
+ @Override
+ public boolean isSubtypeOf(TypeReference type) {
+ switch (selected) {
+ case LEFT:
+ return leftType.isSubtypeOf(type);
+ case RIGHT:
+ return rightType.isSubtypeOf(type);
+ default:
+ return super.isSubtypeOf(type);
+ }
+ }
+
+ @Override
+ public boolean substituteTypeReference(TypeReference targetType, TypeReference newType) {
+ if (getLeftType() == targetType) {
+ setLeftType(newType);
+ return true;
+ }
+ if (getRightType() == targetType) {
+ setRightType(newType);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ switch (selected) {
+ case LEFT:
+ return leftType.equals(obj);
+ case RIGHT:
+ return rightType.equals(obj);
+ default:
+ return super.equals(obj);
+ }
+ }
+
+ public boolean isIntersection() {
+ return intersection;
+ }
+
+ public void setIntersection(boolean intersection) {
+ this.intersection = intersection;
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/VariableDeclaration.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/VariableDeclaration.java
new file mode 100644
index 00000000..3a131989
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/VariableDeclaration.java
@@ -0,0 +1,59 @@
+package org.jsweet.input.typescriptdef.ast;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+public class VariableDeclaration extends AbstractTypedDeclaration {
+
+ private boolean optional = false;
+ private boolean readonly = false;
+ private Literal initializer = null;
+
+ public VariableDeclaration(Token token, String name, TypeReference type, boolean optional, boolean readonly) {
+ super(token, name, type);
+ this.optional = optional;
+ this.readonly = readonly;
+ // System.out.println("new VariableDeclaration: " + this);
+ }
+
+ @Override
+ public void accept(Visitor v) {
+ v.visitVariableDeclaration(this);
+ }
+
+ public boolean isOptional() {
+ return optional;
+ }
+
+ public void setOptional(boolean optional) {
+ this.optional = optional;
+ }
+
+ @Override
+ public VariableDeclaration copy() {
+ VariableDeclaration copy = new VariableDeclaration(null, name, getType().copy(), optional, readonly);
+ copy.setModifiers(this.getModifiers() == null ? null : new HashSet(this.getModifiers()));
+ copy.setStringAnnotations(
+ this.getStringAnnotations() == null ? null : new ArrayList(getStringAnnotations()));
+ copy.setDocumentation(this.getDocumentation());
+ copy.setInitializer(initializer == null ? null : initializer.copy());
+ return copy;
+ }
+
+ public Literal getInitializer() {
+ return initializer;
+ }
+
+ public void setInitializer(Literal initializer) {
+ this.initializer = initializer;
+ }
+
+ public final boolean isReadonly() {
+ return readonly;
+ }
+
+ public final void setReadonly(boolean readonly) {
+ this.readonly = readonly;
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Visitable.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Visitable.java
new file mode 100644
index 00000000..21c187f1
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Visitable.java
@@ -0,0 +1,12 @@
+package org.jsweet.input.typescriptdef.ast;
+
+
+public interface Visitable {
+
+ void setHidden(boolean hidden);
+
+ boolean isHidden();
+
+ void accept(Visitor visitor);
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Visitor.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Visitor.java
new file mode 100644
index 00000000..791bf044
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/ast/Visitor.java
@@ -0,0 +1,33 @@
+package org.jsweet.input.typescriptdef.ast;
+
+
+public interface Visitor {
+
+ void visitCompilationUnit(CompilationUnit compilationUnit);
+
+ void visitModuleDeclaration(ModuleDeclaration moduleDeclaration);
+
+ void visitReferenceDeclaration(ReferenceDeclaration referenceDeclaration);
+
+ void visitTypeDeclaration(TypeDeclaration typeDeclaration);
+
+ void visitFunctionDeclaration(FunctionDeclaration functionDeclaration);
+
+ void visitVariableDeclaration(VariableDeclaration variableDeclaration);
+
+ void visitParameterDeclaration(ParameterDeclaration parameterDeclaration);
+
+ void visitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration);
+
+ void visitTypeReference(TypeReference typeReference);
+
+ void visitFunctionalTypeReference(FunctionalTypeReference functionalTypeReference);
+
+ void visitArrayTypeReference(ArrayTypeReference arrayTypeReference);
+
+ void visitUnionTypeReference(UnionTypeReference unionTypeReference);
+
+ void visitLiteral(Literal literal);
+
+ void visitTypeMacro(TypeMacroDeclaration typeMacroDeclaration);
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/GenParser.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/GenParser.java
new file mode 100644
index 00000000..6ea56369
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/GenParser.java
@@ -0,0 +1,11 @@
+package org.jsweet.input.typescriptdef.parser;
+
+public class GenParser {
+
+ public static void main(String[] args) throws Exception {
+ java_cup.Main.main(new String[] { "-expect", "0", "-package", "org.jsweet.input.typescriptdef.parser", "-expect", "0", "-parser", "TypescriptDefParser",
+ "typescriptdef.cup" });
+ JFlex.Main.main(new String[] { "typescriptdef.lex" });
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/SyntaxError.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/SyntaxError.java
new file mode 100644
index 00000000..867b09c2
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/SyntaxError.java
@@ -0,0 +1,34 @@
+package org.jsweet.input.typescriptdef.parser;
+
+import java.io.PrintStream;
+
+import org.jsweet.input.typescriptdef.ast.Token;
+
+public class SyntaxError {
+
+ public Token origin;
+ public String message;
+ public Exception exception;
+
+ public SyntaxError(Token origin, String message) {
+ super();
+ this.origin = origin;
+ this.message = message;
+ this.exception = new Exception();
+ //this.exception.printStackTrace();
+ }
+
+ @Override
+ public String toString() {
+ return "SYNTAX ERROR"
+ + ": "
+ + message
+ + (origin != null ? " at '" + origin.toString() + "'" + " "
+ + origin.getLocation() : "");
+ }
+
+ public void printStackTrace(PrintStream stream) {
+ exception.printStackTrace(stream);
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/TestParser.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/TestParser.java
new file mode 100644
index 00000000..1f015f11
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/TestParser.java
@@ -0,0 +1,11 @@
+package org.jsweet.input.typescriptdef.parser;
+
+import java.io.File;
+
+public class TestParser {
+
+ public static void main(String[] args) throws Exception {
+ TypescriptDefParser.parseFile(new File("test.d.ts"));
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/TypescriptDefParser.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/TypescriptDefParser.java
new file mode 100644
index 00000000..caaf7ac0
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/TypescriptDefParser.java
@@ -0,0 +1,3291 @@
+
+//----------------------------------------------------
+// The following code was generated by CUP v0.10k
+// Sun Jul 24 16:44:06 CEST 2016
+//----------------------------------------------------
+
+package org.jsweet.input.typescriptdef.parser;
+
+import java.util.*;
+import java.io.*;
+import org.apache.commons.lang3.*;
+import org.jsweet.input.typescriptdef.ast.*;
+
+/** CUP v0.10k generated parser.
+ * @version Sun Jul 24 16:44:06 CEST 2016
+ */
+@SuppressWarnings("all")
+public class TypescriptDefParser extends java_cup.runtime.lr_parser {
+
+ /** Default constructor. */
+ public TypescriptDefParser() {super();}
+
+ /** Constructor which sets the default scanner. */
+ public TypescriptDefParser(java_cup.runtime.Scanner s) {super(s);}
+
+ /** Production table. */
+ protected static final short _production_table[][] =
+ unpackFromStrings(new String[] {
+ "\000\257\000\002\002\004\000\002\003\003\000\002\004" +
+ "\005\000\002\004\003\000\002\005\005\000\002\005\003" +
+ "\000\002\006\003\000\002\006\003\000\002\007\003\000" +
+ "\002\007\003\000\002\010\003\000\002\010\003\000\002" +
+ "\010\003\000\002\010\003\000\002\010\003\000\002\010" +
+ "\003\000\002\010\003\000\002\010\003\000\002\021\006" +
+ "\000\002\021\007\000\002\114\006\000\002\114\003\000" +
+ "\002\115\003\000\002\115\005\000\002\111\003\000\002" +
+ "\111\002\000\002\022\005\000\002\065\007\000\002\065" +
+ "\005\000\002\065\010\000\002\011\010\000\002\011\010" +
+ "\000\002\012\015\000\002\012\014\000\002\063\003\000" +
+ "\002\063\002\000\002\113\003\000\002\113\002\000\002" +
+ "\035\012\000\002\035\013\000\002\037\005\000\002\037" +
+ "\003\000\002\036\006\000\002\036\003\000\002\036\005" +
+ "\000\002\036\006\000\002\036\007\000\002\040\003\000" +
+ "\002\040\003\000\002\041\005\000\002\041\003\000\002" +
+ "\042\003\000\002\042\005\000\002\110\003\000\002\013" +
+ "\003\000\002\013\003\000\002\074\004\000\002\074\002" +
+ "\000\002\075\005\000\002\075\002\000\002\104\006\000" +
+ "\002\104\003\000\002\030\005\000\002\030\003\000\002" +
+ "\076\004\000\002\076\003\000\002\101\003\000\002\101" +
+ "\002\000\002\077\004\000\002\077\003\000\002\077\003" +
+ "\000\002\100\003\000\002\100\002\000\002\102\004\000" +
+ "\002\102\003\000\002\102\004\000\002\102\003\000\002" +
+ "\102\003\000\002\103\003\000\002\103\002\000\002\031" +
+ "\005\000\002\031\003\000\002\032\003\000\002\032\003" +
+ "\000\002\033\003\000\002\033\003\000\002\105\005\000" +
+ "\002\105\004\000\002\106\003\000\002\106\002\000\002" +
+ "\107\003\000\002\107\002\000\002\034\003\000\002\034" +
+ "\003\000\002\034\003\000\002\034\003\000\002\015\011" +
+ "\000\002\015\010\000\002\112\003\000\002\112\003\000" +
+ "\002\014\010\000\002\014\007\000\002\014\007\000\002" +
+ "\014\007\000\002\026\003\000\002\026\002\000\002\016" +
+ "\012\000\002\016\013\000\002\016\012\000\002\017\010" +
+ "\000\002\017\011\000\002\020\010\000\002\020\011\000" +
+ "\002\023\005\000\002\023\003\000\002\024\007\000\002" +
+ "\024\003\000\002\025\012\000\002\027\003\000\002\027" +
+ "\002\000\002\043\003\000\002\043\002\000\002\044\007" +
+ "\000\002\045\003\000\002\045\003\000\002\045\003\000" +
+ "\002\045\003\000\002\045\003\000\002\045\003\000\002" +
+ "\045\003\000\002\045\003\000\002\045\003\000\002\047" +
+ "\006\000\002\047\005\000\002\050\006\000\002\050\005" +
+ "\000\002\054\004\000\002\060\005\000\002\051\004\000" +
+ "\002\051\004\000\002\051\004\000\002\051\006\000\002" +
+ "\051\004\000\002\051\006\000\002\052\010\000\002\052" +
+ "\011\000\002\052\005\000\002\055\005\000\002\055\005" +
+ "\000\002\056\004\000\002\056\006\000\002\057\005\000" +
+ "\002\057\007\000\002\061\003\000\002\061\003\000\002" +
+ "\061\003\000\002\061\003\000\002\061\003\000\002\061" +
+ "\004\000\002\061\004\000\002\061\003\000\002\061\004" +
+ "\000\002\061\002\000\002\064\003\000\002\064\005\000" +
+ "\002\071\005\000\002\071\002\000\002\072\005\000\002" +
+ "\072\003\000\002\066\005\000\002\066\002\000\002\067" +
+ "\005\000\002\067\003\000\002\070\003\000\002\070\005" +
+ "" });
+
+ /** Access to production table. */
+ public short[][] production_table() {return _production_table;}
+
+ /** Parse-action table. */
+ protected static final short[][] _action_table =
+ unpackFromStrings(new String[] {
+ "\000\u015c\000\066\002\uffbe\003\uffbe\036\uffbe\051\uffbe\055" +
+ "\uffbe\060\uffbe\061\uffbe\062\uffbe\063\uffbe\064\uffbe\065\uffbe" +
+ "\066\uffbe\067\uffbe\070\uffbe\071\uffbe\072\uffbe\073\uffbe\074" +
+ "\uffbe\075\uffbe\076\uffbe\077\uffbe\102\uffbe\103\uffbe\105\uffbe" +
+ "\111\uffbe\112\006\001\002\000\004\002\000\001\002\000" +
+ "\122\002\uffbf\003\uffbf\004\uffbf\005\uffbf\010\uffbf\011\uffbf" +
+ "\012\uffbf\013\uffbf\014\uffbf\015\uffbf\016\uffbf\017\uffbf\021" +
+ "\uffbf\036\uffbf\051\uffbf\055\uffbf\060\uffbf\061\uffbf\062\uffbf" +
+ "\063\uffbf\064\uffbf\065\uffbf\066\uffbf\067\uffbf\070\uffbf\071" +
+ "\uffbf\072\uffbf\073\uffbf\074\uffbf\075\uffbf\076\uffbf\077\uffbf" +
+ "\102\uffbf\103\uffbf\104\uffbf\105\uffbf\111\uffbf\112\250\113" +
+ "\uffbf\114\uffbf\001\002\000\122\002\uffc0\003\uffc0\004\uffc0" +
+ "\005\uffc0\010\uffc0\011\uffc0\012\uffc0\013\uffc0\014\uffc0\015" +
+ "\uffc0\016\uffc0\017\uffc0\021\uffc0\036\uffc0\051\uffc0\055\uffc0" +
+ "\060\uffc0\061\uffc0\062\uffc0\063\uffc0\064\uffc0\065\uffc0\066" +
+ "\uffc0\067\uffc0\070\uffc0\071\uffc0\072\uffc0\073\uffc0\074\uffc0" +
+ "\075\uffc0\076\uffc0\077\uffc0\102\uffc0\103\uffc0\104\uffc0\105" +
+ "\uffc0\111\uffc0\112\uffc0\113\uffc0\114\uffc0\001\002\000\004" +
+ "\002\u015e\001\002\000\066\002\ufffe\003\033\015\ufffe\036" +
+ "\015\051\uff5f\055\uff5f\060\uffe8\061\035\062\uff5f\063\020" +
+ "\064\031\065\024\066\uff5f\067\041\070\023\071\036\072" +
+ "\uff5f\073\uff5f\074\032\075\uff5f\076\uff5f\077\uff5f\102\uff5f" +
+ "\103\026\105\uff5f\111\uff5f\001\002\000\012\002\ufff4\011" +
+ "\ufff4\015\ufff4\112\ufff4\001\002\000\012\002\ufffb\011\ufffb" +
+ "\015\ufffb\112\ufffb\001\002\000\004\060\u0150\001\002\000" +
+ "\012\002\ufff7\011\ufff7\015\ufff7\112\ufff7\001\002\000\012" +
+ "\002\ufff8\011\ufff8\015\ufff8\112\ufff8\001\002\000\012\002" +
+ "\ufff5\011\ufff5\015\ufff5\112\ufff5\001\002\000\012\002\ufff6" +
+ "\011\ufff6\015\ufff6\112\ufff6\001\002\000\042\012\uff65\016" +
+ "\uff65\021\uff65\051\uff65\055\uff65\062\uff65\066\uff65\072\uff65" +
+ "\073\uff65\075\uff65\076\uff65\077\uff65\102\uff65\103\u014f\105" +
+ "\uff65\111\uff65\001\002\000\012\002\ufff9\011\ufff9\015\ufff9" +
+ "\112\ufff9\001\002\000\012\002\ufff0\011\ufff0\015\ufff0\112" +
+ "\ufff0\001\002\000\004\055\271\001\002\000\042\012\uff61" +
+ "\016\uff61\021\uff61\051\uff61\055\uff61\062\uff61\066\uff61\072" +
+ "\uff61\073\uff61\075\uff61\076\uff61\077\uff61\102\uff61\103\u0149" +
+ "\105\uff61\111\uff61\001\002\000\012\002\ufff3\011\ufff3\015" +
+ "\ufff3\112\ufff3\001\002\000\040\012\uff66\016\uff66\021\uff66" +
+ "\051\uff66\055\uff66\062\uff66\066\uff66\072\uff66\073\uff66\075" +
+ "\uff66\076\uff66\077\uff66\102\uff66\105\uff66\111\uff66\001\002" +
+ "\000\012\002\ufff1\011\ufff1\015\ufff1\112\ufff1\001\002\000" +
+ "\012\002\uffb9\011\u0146\015\uffb9\112\006\001\002\000\042" +
+ "\012\uff64\016\uff64\021\uff64\051\uff64\055\uff64\062\uff64\066" +
+ "\uff64\072\uff64\073\uff64\075\uff64\076\uff64\077\uff64\102\uff64" +
+ "\103\u0142\105\uff64\111\uff64\001\002\000\004\055\u013d\001" +
+ "\002\000\012\002\ufffa\011\ufffa\015\ufffa\112\ufffa\001\002" +
+ "\000\012\002\ufff2\011\ufff2\015\ufff2\112\ufff2\001\002\000" +
+ "\042\014\u012a\025\u012c\051\uff68\055\uff68\060\uffe9\062\uff68" +
+ "\066\uff68\072\uff68\073\uff68\074\u012b\075\uff68\076\uff68\077" +
+ "\uff68\102\uff68\105\uff68\111\uff68\001\002\000\004\055\u0123" +
+ "\001\002\000\032\051\043\055\052\062\053\066\044\072" +
+ "\054\073\045\075\uffdc\076\uffdc\077\051\102\046\105\055" +
+ "\111\uffde\001\002\000\012\002\ufffc\011\ufffc\015\ufffc\112" +
+ "\ufffc\001\002\000\040\012\uff67\016\uff67\021\uff67\051\uff67" +
+ "\055\uff67\062\uff67\066\uff67\072\uff67\073\uff67\075\uff67\076" +
+ "\uff67\077\uff67\102\uff67\105\uff67\111\uff67\001\002\000\004" +
+ "\111\u011c\001\002\000\020\002\uff98\004\uff98\005\uff98\011" +
+ "\uff98\015\uff98\056\143\112\uff98\001\002\000\006\075\uffdd" +
+ "\076\uffdd\001\002\000\004\055\373\001\002\000\016\002" +
+ "\uff98\004\uff98\011\uff98\015\uff98\056\143\112\uff98\001\002" +
+ "\000\006\075\360\076\361\001\002\000\004\055\354\001" +
+ "\002\000\004\055\uff9f\001\002\000\024\002\uff98\004\uff98" +
+ "\011\uff98\012\uff98\015\uff98\021\uff98\055\271\056\143\112" +
+ "\uff98\001\002\000\004\055\340\001\002\000\004\055\056" +
+ "\001\002\000\006\055\uff9e\111\uffdf\001\002\000\014\014" +
+ "\uff57\021\057\100\uff57\101\uff57\112\uff57\001\002\000\022" +
+ "\012\072\014\105\016\110\021\057\055\070\102\103\104" +
+ "\076\113\uff57\001\002\000\012\014\uffc8\100\061\101\uffc8" +
+ "\112\uffc8\001\002\000\022\012\072\014\105\016\110\021" +
+ "\057\055\070\102\103\104\076\113\uff57\001\002\000\010" +
+ "\014\uffc6\101\064\112\uffc6\001\002\000\006\014\uffbe\112" +
+ "\006\001\002\000\024\012\uffbe\014\uffbe\016\uffbe\021\uffbe" +
+ "\055\uffbe\102\uffbe\104\uffbe\112\006\113\uffbe\001\002\000" +
+ "\022\012\072\014\105\016\110\021\057\055\070\102\103" +
+ "\104\076\113\uff57\001\002\000\040\002\uff85\005\uff85\011" +
+ "\uff85\013\uff85\014\uff85\015\uff85\017\uff85\024\uff85\036\uff85" +
+ "\042\uff85\044\uff85\100\uff85\101\uff85\112\uff85\114\uff85\001" +
+ "\002\000\020\005\uffc4\014\uffc4\017\uffc4\042\116\044\117" +
+ "\101\uffc4\112\uffc4\001\002\000\050\002\uff5e\005\uff5e\006" +
+ "\272\011\uff5e\013\uff5e\014\uff5e\015\uff5e\017\uff5e\020\uff5e" +
+ "\021\uff5e\024\uff5e\036\uff5e\042\uff5e\044\uff5e\100\uff5e\101" +
+ "\uff5e\106\321\112\uff5e\114\uff5e\001\002\000\042\002\uff7e" +
+ "\005\uff7e\011\uff7e\013\uff7e\014\uff7e\015\uff7e\017\uff7e\020" +
+ "\320\024\uff7e\036\uff7e\042\uff7e\044\uff7e\100\uff7e\101\uff7e" +
+ "\112\uff7e\114\uff7e\001\002\000\022\012\072\014\105\016" +
+ "\110\021\057\055\277\102\103\104\302\113\uff57\001\002" +
+ "\000\042\002\uff81\005\uff81\011\uff81\013\uff81\014\uff81\015" +
+ "\uff81\017\uff81\020\275\024\uff81\036\uff81\042\uff81\044\uff81" +
+ "\100\uff81\101\uff81\112\uff81\114\uff81\001\002\000\040\002" +
+ "\uff86\005\uff86\011\uff86\013\uff86\014\uff86\015\uff86\017\uff86" +
+ "\024\uff86\036\uff86\042\uff86\044\uff86\100\uff86\101\uff86\112" +
+ "\uff86\114\uff86\001\002\000\042\002\uff7f\005\uff7f\011\uff7f" +
+ "\013\uff7f\014\uff7f\015\uff7f\017\uff7f\020\274\024\uff7f\036" +
+ "\uff7f\042\uff7f\044\uff7f\100\uff7f\101\uff7f\112\uff7f\114\uff7f" +
+ "\001\002\000\004\055\271\001\002\000\040\002\uff82\005" +
+ "\uff82\011\uff82\013\uff82\014\uff82\015\uff82\017\uff82\024\uff82" +
+ "\036\uff82\042\uff82\044\uff82\100\uff82\101\uff82\112\uff82\114" +
+ "\uff82\001\002\000\040\002\uff84\005\uff84\011\uff84\013\uff84" +
+ "\014\uff84\015\uff84\017\uff84\024\uff84\036\uff84\042\uff84\044" +
+ "\uff84\100\uff84\101\uff84\112\uff84\114\uff84\001\002\000\044" +
+ "\002\uff5b\005\uff5b\011\uff5b\013\uff5b\014\uff5b\015\uff5b\017" +
+ "\uff5b\020\uff5b\021\261\024\uff5b\036\uff5b\042\uff5b\044\uff5b" +
+ "\100\uff5b\101\uff5b\112\uff5b\114\uff5b\001\002\000\010\005" +
+ "\112\014\uffc7\112\uffc7\001\002\000\006\021\057\113\uff57" +
+ "\001\002\000\040\002\uff83\005\uff83\011\uff83\013\uff83\014" +
+ "\uff83\015\uff83\017\uff83\024\uff83\036\uff83\042\uff83\044\uff83" +
+ "\100\uff83\101\uff83\112\uff83\114\uff83\001\002\000\052\003" +
+ "\uffbe\012\uffbe\015\uffbe\016\uffbe\021\uffbe\036\uffbe\051\uffbe" +
+ "\055\uffbe\061\uffbe\062\uffbe\063\uffbe\064\uffbe\065\uffbe\067" +
+ "\uffbe\071\uffbe\077\uffbe\102\uffbe\103\uffbe\105\uffbe\112\006" +
+ "\001\002\000\042\002\uff80\005\uff80\011\uff80\013\uff80\014" +
+ "\uff80\015\uff80\017\uff80\020\161\024\uff80\036\uff80\042\uff80" +
+ "\044\uff80\100\uff80\101\uff80\112\uff80\114\uff80\001\002\000" +
+ "\004\113\124\001\002\000\022\012\072\014\105\016\110" +
+ "\021\057\055\070\102\103\104\076\113\uff57\001\002\000" +
+ "\006\005\112\017\113\001\002\000\024\012\uffbe\014\uffbe" +
+ "\016\uffbe\021\uffbe\055\uffbe\102\uffbe\104\uffbe\112\006\113" +
+ "\uffbe\001\002\000\042\002\uff78\005\uff78\011\uff78\013\uff78" +
+ "\014\uff78\015\uff78\017\uff78\020\uff78\024\uff78\036\uff78\042" +
+ "\uff78\044\uff78\100\uff78\101\uff78\112\uff78\114\uff78\001\002" +
+ "\000\022\012\072\014\105\016\110\021\057\055\070\102" +
+ "\103\104\076\113\uff57\001\002\000\020\005\uffc5\014\uffc5" +
+ "\017\uffc5\042\116\044\117\101\uffc5\112\uffc5\001\002\000" +
+ "\024\012\uffbe\014\uffbe\016\uffbe\021\uffbe\055\uffbe\102\uffbe" +
+ "\104\uffbe\112\006\113\uffbe\001\002\000\024\012\uffbe\014" +
+ "\uffbe\016\uffbe\021\uffbe\055\uffbe\102\uffbe\104\uffbe\112\006" +
+ "\113\uffbe\001\002\000\022\012\072\014\105\016\110\021" +
+ "\057\055\070\102\103\104\076\113\uff57\001\002\000\040" +
+ "\002\uff7d\005\uff7d\011\uff7d\013\uff7d\014\uff7d\015\uff7d\017" +
+ "\uff7d\024\uff7d\036\uff7d\042\uff7d\044\uff7d\100\uff7d\101\uff7d" +
+ "\112\uff7d\114\uff7d\001\002\000\022\012\072\014\105\016" +
+ "\110\021\057\055\070\102\103\104\076\113\uff57\001\002" +
+ "\000\040\002\uff7b\005\uff7b\011\uff7b\013\uff7b\014\uff7b\015" +
+ "\uff7b\017\uff7b\024\uff7b\036\uff7b\042\uff7b\044\uff7b\100\uff7b" +
+ "\101\uff7b\112\uff7b\114\uff7b\001\002\000\014\010\uffbe\036" +
+ "\uffbe\055\uffbe\112\006\114\uffbe\001\002\000\016\010\uffa6" +
+ "\013\uff8f\036\134\055\uffa6\112\uffa6\114\uff8f\001\002\000" +
+ "\004\114\127\001\002\000\004\045\130\001\002\000\022" +
+ "\012\072\014\105\016\110\021\057\055\070\102\103\104" +
+ "\076\113\uff57\001\002\000\040\002\uff71\005\uff71\011\uff71" +
+ "\013\uff71\014\uff71\015\uff71\017\uff71\024\uff71\036\uff71\042" +
+ "\116\044\117\100\uff71\101\uff71\112\uff71\114\uff71\001\002" +
+ "\000\012\005\uffbe\013\uffbe\112\006\114\uffbe\001\002\000" +
+ "\010\010\uffbe\055\uffbe\112\006\001\002\000\036\005\uffa7" +
+ "\010\uffa7\012\uffa7\013\uffa7\014\uffa7\016\uffa7\017\uffa7\021" +
+ "\uffa7\055\uffa7\102\uffa7\104\uffa7\112\uffa7\113\uffa7\114\uffa7" +
+ "\001\002\000\012\005\uff8d\013\uff8d\112\uff8d\114\uff8d\001" +
+ "\002\000\006\010\137\055\uff8a\001\002\000\004\055\uff8b" +
+ "\001\002\000\004\055\141\001\002\000\022\004\uff98\005" +
+ "\uff98\013\uff98\017\uff98\036\uff98\056\143\112\uff98\114\uff98" +
+ "\001\002\000\020\004\144\005\uff88\013\uff88\017\uff88\036" +
+ "\uff88\112\uff88\114\uff88\001\002\000\032\002\uff99\004\uff99" +
+ "\005\uff99\011\uff99\012\uff99\013\uff99\015\uff99\017\uff99\021" +
+ "\uff99\036\uff99\112\uff99\114\uff99\001\002\000\026\012\uffbe" +
+ "\014\uffbe\016\uffbe\021\uffbe\036\uffbe\055\uffbe\102\uffbe\104" +
+ "\uffbe\112\006\113\uffbe\001\002\000\016\005\uffa6\013\uffa6" +
+ "\017\uffa6\036\134\112\uffa6\114\uffa6\001\002\000\024\002" +
+ "\uff89\005\uff89\011\uff89\013\uff89\015\uff89\017\uff89\036\uff89" +
+ "\112\uff89\114\uff89\001\002\000\014\005\uffbe\013\uffbe\017" +
+ "\uffbe\112\006\114\uffbe\001\002\000\014\005\uff8c\013\uff8c" +
+ "\017\uff8c\112\uff8c\114\uff8c\001\002\000\026\012\uffa6\014" +
+ "\uffa6\016\uffa6\021\uffa6\036\134\055\uffa6\102\uffa6\104\uffa6" +
+ "\112\uffa6\113\uffa6\001\002\000\024\012\uffbe\014\uffbe\016" +
+ "\uffbe\021\uffbe\055\uffbe\102\uffbe\104\uffbe\112\006\113\uffbe" +
+ "\001\002\000\022\012\072\014\105\016\110\021\057\055" +
+ "\070\102\103\104\076\113\uff57\001\002\000\030\002\uff87" +
+ "\005\uff87\011\uff87\013\uff87\015\uff87\017\uff87\036\uff87\042" +
+ "\116\044\117\112\uff87\114\uff87\001\002\000\010\005\156" +
+ "\013\uff90\114\uff90\001\002\000\012\010\uffbe\036\uffbe\055" +
+ "\uffbe\112\006\001\002\000\012\010\uffa6\036\134\055\uffa6" +
+ "\112\uffa6\001\002\000\012\005\uff8e\013\uff8e\112\uff8e\114" +
+ "\uff8e\001\002\000\042\002\uff73\005\uff73\011\uff73\013\uff73" +
+ "\014\uff73\015\uff73\017\uff73\020\uff73\024\uff73\036\uff73\042" +
+ "\uff73\044\uff73\100\uff73\101\uff73\112\uff73\114\uff73\001\002" +
+ "\000\004\015\252\001\002\000\050\003\173\012\uff5f\015" +
+ "\uffc2\016\uff5f\021\uff5f\036\165\051\uff5f\055\uff5f\061\176" +
+ "\062\uff5f\063\020\064\031\065\024\067\041\071\036\077" +
+ "\uff5f\102\uff5f\103\026\105\uff5f\001\002\000\012\005\241" +
+ "\011\243\015\uffb2\112\006\001\002\000\012\005\uffac\011" +
+ "\uffac\015\uffac\112\uffac\001\002\000\012\005\uffa2\011\uffa2" +
+ "\015\uffa2\112\uffa2\001\002\000\012\005\uffa3\011\uffa3\015" +
+ "\uffa3\112\uffa3\001\002\000\012\005\uffaf\011\uffaf\015\uffaf" +
+ "\112\uffaf\001\002\000\012\005\uffa5\011\uffa5\015\uffa5\112" +
+ "\uffa5\001\002\000\012\005\uffad\011\uffad\015\uffad\112\uffad" +
+ "\001\002\000\012\005\uffae\011\uffae\015\uffae\112\uffae\001" +
+ "\002\000\012\005\uffb0\011\uffb0\015\uffb0\112\uffb0\001\002" +
+ "\000\012\005\uffa4\011\uffa4\015\uffa4\112\uffa4\001\002\000" +
+ "\024\012\uff68\016\uff68\021\uff68\051\uff68\055\uff68\062\uff68" +
+ "\077\uff68\102\uff68\105\uff68\001\002\000\024\012\uff57\016" +
+ "\uff57\021\057\051\043\055\202\062\053\077\051\102\200" +
+ "\105\203\001\002\000\022\004\uff98\005\uff98\011\uff98\012" +
+ "\uff57\015\uff98\021\057\056\143\112\uff98\001\002\000\006" +
+ "\012\222\016\221\001\002\000\022\004\uff98\005\uff98\011" +
+ "\uff98\012\uff98\015\uff98\021\uff98\056\143\112\uff98\001\002" +
+ "\000\010\016\uff57\021\057\055\uff9e\001\002\000\004\016" +
+ "\205\001\002\000\012\010\uffa6\036\134\055\uffa6\112\uffa6" +
+ "\001\002\000\004\017\207\001\002\000\014\004\144\005" +
+ "\uff88\011\uff88\015\uff88\112\uff88\001\002\000\012\005\uff91" +
+ "\011\uff91\015\uff91\112\uff91\001\002\000\022\002\uffbe\004" +
+ "\uffbe\005\uffbe\011\uffbe\012\uff57\015\uffbe\021\057\112\006" +
+ "\001\002\000\004\012\215\001\002\000\016\002\uff88\004" +
+ "\144\005\uff88\011\uff88\015\uff88\112\uff88\001\002\000\014" +
+ "\002\uff9c\005\uff9c\011\uff9c\015\uff9c\112\uff9c\001\002\000" +
+ "\014\010\uffbe\013\uffbe\036\uffbe\055\uffbe\112\006\001\002" +
+ "\000\004\013\217\001\002\000\016\002\uff88\004\144\005" +
+ "\uff88\011\uff88\015\uff88\112\uff88\001\002\000\014\002\uff97" +
+ "\005\uff97\011\uff97\015\uff97\112\uff97\001\002\000\012\010" +
+ "\uffa6\036\134\055\uffa6\112\uffa6\001\002\000\014\010\uffbe" +
+ "\013\uffbe\036\uffbe\055\uffbe\112\006\001\002\000\004\013" +
+ "\224\001\002\000\014\004\144\005\uff88\011\uff88\015\uff88" +
+ "\112\uff88\001\002\000\012\005\uff94\011\uff94\015\uff94\112" +
+ "\uff94\001\002\000\004\017\227\001\002\000\014\004\144" +
+ "\005\uff88\011\uff88\015\uff88\112\uff88\001\002\000\012\005" +
+ "\uff92\011\uff92\015\uff92\112\uff92\001\002\000\004\012\235" +
+ "\001\002\000\016\002\uffbe\004\uffbe\005\uffbe\011\uffbe\015" +
+ "\uffbe\112\006\001\002\000\016\002\uff88\004\144\005\uff88" +
+ "\011\uff88\015\uff88\112\uff88\001\002\000\014\002\uff9a\005" +
+ "\uff9a\011\uff9a\015\uff9a\112\uff9a\001\002\000\014\010\uffbe" +
+ "\013\uffbe\036\uffbe\055\uffbe\112\006\001\002\000\004\013" +
+ "\237\001\002\000\014\004\144\005\uff88\011\uff88\015\uff88" +
+ "\112\uff88\001\002\000\012\005\uff93\011\uff93\015\uff93\112" +
+ "\uff93\001\002\000\052\003\uffb5\012\uffb5\015\uffb5\016\uffb5" +
+ "\021\uffb5\036\uffb5\051\uffb5\055\uffb5\061\uffb5\062\uffb5\063" +
+ "\uffb5\064\uffb5\065\uffb5\067\uffb5\071\uffb5\077\uffb5\102\uffb5" +
+ "\103\uffb5\105\uffb5\112\006\001\002\000\052\003\uffb4\012" +
+ "\uffb4\015\uffb4\016\uffb4\021\uffb4\036\uffb4\051\uffb4\055\uffb4" +
+ "\061\uffb4\062\uffb4\063\uffb4\064\uffb4\065\uffb4\067\uffb4\071" +
+ "\uffb4\077\uffb4\102\uffb4\103\uffb4\105\uffb4\112\250\001\002" +
+ "\000\052\003\uffb7\012\uffb7\015\uffb7\016\uffb7\021\uffb7\036" +
+ "\uffb7\051\uffb7\055\uffb7\061\uffb7\062\uffb7\063\uffb7\064\uffb7" +
+ "\065\uffb7\067\uffb7\071\uffb7\077\uffb7\102\uffb7\103\uffb7\105" +
+ "\uffb7\112\006\001\002\000\050\003\173\012\uff5f\015\uffb3" +
+ "\016\uff5f\021\uff5f\036\165\051\uff5f\055\uff5f\061\176\062" +
+ "\uff5f\063\020\064\031\065\024\067\041\071\036\077\uff5f" +
+ "\102\uff5f\103\026\105\uff5f\001\002\000\004\015\uffc3\001" +
+ "\002\000\012\005\uffb1\011\uffb1\015\uffb1\112\uffb1\001\002" +
+ "\000\052\003\uffb8\012\uffb8\015\uffb8\016\uffb8\021\uffb8\036" +
+ "\uffb8\051\uffb8\055\uffb8\061\uffb8\062\uffb8\063\uffb8\064\uffb8" +
+ "\065\uffb8\067\uffb8\071\uffb8\077\uffb8\102\uffb8\103\uffb8\105" +
+ "\uffb8\112\250\001\002\000\122\002\uffc1\003\uffc1\004\uffc1" +
+ "\005\uffc1\010\uffc1\011\uffc1\012\uffc1\013\uffc1\014\uffc1\015" +
+ "\uffc1\016\uffc1\017\uffc1\021\uffc1\036\uffc1\051\uffc1\055\uffc1" +
+ "\060\uffc1\061\uffc1\062\uffc1\063\uffc1\064\uffc1\065\uffc1\066" +
+ "\uffc1\067\uffc1\070\uffc1\071\uffc1\072\uffc1\073\uffc1\074\uffc1" +
+ "\075\uffc1\076\uffc1\077\uffc1\102\uffc1\103\uffc1\104\uffc1\105" +
+ "\uffc1\111\uffc1\112\uffc1\113\uffc1\114\uffc1\001\002\000\052" +
+ "\003\uffb6\012\uffb6\015\uffb6\016\uffb6\021\uffb6\036\uffb6\051" +
+ "\uffb6\055\uffb6\061\uffb6\062\uffb6\063\uffb6\064\uffb6\065\uffb6" +
+ "\067\uffb6\071\uffb6\077\uffb6\102\uffb6\103\uffb6\105\uffb6\112" +
+ "\250\001\002\000\042\002\uff6e\005\uff6e\011\uff6e\013\uff6e" +
+ "\014\uff6e\015\uff6e\017\uff6e\020\uff6e\024\uff6e\036\uff6e\042" +
+ "\uff6e\044\uff6e\100\uff6e\101\uff6e\112\uff6e\114\uff6e\001\002" +
+ "\000\004\113\254\001\002\000\014\010\uffbe\036\uffbe\055" +
+ "\uffbe\112\006\114\uffbe\001\002\000\004\114\256\001\002" +
+ "\000\004\045\257\001\002\000\022\012\072\014\105\016" +
+ "\110\021\057\055\070\102\103\104\076\113\uff57\001\002" +
+ "\000\040\002\uff70\005\uff70\011\uff70\013\uff70\014\uff70\015" +
+ "\uff70\017\uff70\024\uff70\036\uff70\042\116\044\117\100\uff70" +
+ "\101\uff70\112\uff70\114\uff70\001\002\000\022\012\072\014" +
+ "\105\016\110\021\057\055\070\102\103\104\076\113\uff57" +
+ "\001\002\000\042\002\uff79\005\uff79\011\uff79\013\uff79\014" +
+ "\uff79\015\uff79\017\uff79\020\uff79\024\uff79\036\uff79\042\uff79" +
+ "\044\uff79\100\uff79\101\uff79\112\uff79\114\uff79\001\002\000" +
+ "\012\005\uff59\024\uff59\042\116\044\117\001\002\000\006" +
+ "\005\265\024\266\001\002\000\022\012\072\014\105\016" +
+ "\110\021\057\055\070\102\103\104\076\113\uff57\001\002" +
+ "\000\042\002\uff5c\005\uff5c\011\uff5c\013\uff5c\014\uff5c\015" +
+ "\uff5c\017\uff5c\020\uff5c\024\uff5c\036\uff5c\042\uff5c\044\uff5c" +
+ "\100\uff5c\101\uff5c\112\uff5c\114\uff5c\001\002\000\012\005" +
+ "\uff5a\024\uff5a\042\116\044\117\001\002\000\040\002\uff6c" +
+ "\005\uff6c\011\uff6c\013\uff6c\014\uff6c\015\uff6c\017\uff6c\024" +
+ "\uff6c\036\uff6c\042\uff6c\044\uff6c\100\uff6c\101\uff6c\112\uff6c" +
+ "\114\uff6c\001\002\000\046\002\uff5e\005\uff5e\006\272\011" +
+ "\uff5e\013\uff5e\014\uff5e\015\uff5e\017\uff5e\020\uff5e\021\uff5e" +
+ "\024\uff5e\036\uff5e\042\uff5e\044\uff5e\100\uff5e\101\uff5e\112" +
+ "\uff5e\114\uff5e\001\002\000\004\055\271\001\002\000\044" +
+ "\002\uff5d\005\uff5d\011\uff5d\013\uff5d\014\uff5d\015\uff5d\017" +
+ "\uff5d\020\uff5d\021\uff5d\024\uff5d\036\uff5d\042\uff5d\044\uff5d" +
+ "\100\uff5d\101\uff5d\112\uff5d\114\uff5d\001\002\000\042\002" +
+ "\uff77\005\uff77\011\uff77\013\uff77\014\uff77\015\uff77\017\uff77" +
+ "\020\uff77\024\uff77\036\uff77\042\uff77\044\uff77\100\uff77\101" +
+ "\uff77\112\uff77\114\uff77\001\002\000\042\002\uff76\005\uff76" +
+ "\011\uff76\013\uff76\014\uff76\015\uff76\017\uff76\020\uff76\024" +
+ "\uff76\036\uff76\042\uff76\044\uff76\100\uff76\101\uff76\112\uff76" +
+ "\114\uff76\001\002\000\006\042\116\044\117\001\002\000" +
+ "\016\006\272\020\uff5e\021\uff5e\042\uff5e\044\uff5e\106\315" +
+ "\001\002\000\012\013\314\020\275\042\uff81\044\uff81\001" +
+ "\002\000\010\013\312\042\uff86\044\uff86\001\002\000\004" +
+ "\055\271\001\002\000\010\013\307\042\uff82\044\uff82\001" +
+ "\002\000\010\013\305\042\uff83\044\uff83\001\002\000\042" +
+ "\002\uff7c\005\uff7c\011\uff7c\013\uff7c\014\uff7c\015\uff7c\017" +
+ "\uff7c\020\306\024\uff7c\036\uff7c\042\uff7c\044\uff7c\100\uff7c" +
+ "\101\uff7c\112\uff7c\114\uff7c\001\002\000\042\002\uff72\005" +
+ "\uff72\011\uff72\013\uff72\014\uff72\015\uff72\017\uff72\020\uff72" +
+ "\024\uff72\036\uff72\042\uff72\044\uff72\100\uff72\101\uff72\112" +
+ "\uff72\114\uff72\001\002\000\040\002\uff7a\005\uff7a\011\uff7a" +
+ "\013\uff7a\014\uff7a\015\uff7a\017\uff7a\024\uff7a\036\uff7a\042" +
+ "\uff7a\044\uff7a\100\uff7a\101\uff7a\112\uff7a\114\uff7a\001\002" +
+ "\000\010\013\311\042\uff6c\044\uff6c\001\002\000\040\002" +
+ "\uff6b\005\uff6b\011\uff6b\013\uff6b\014\uff6b\015\uff6b\017\uff6b" +
+ "\024\uff6b\036\uff6b\042\uff6b\044\uff6b\100\uff6b\101\uff6b\112" +
+ "\uff6b\114\uff6b\001\002\000\042\002\uff6f\005\uff6f\011\uff6f" +
+ "\013\uff6f\014\uff6f\015\uff6f\017\uff6f\020\313\024\uff6f\036" +
+ "\uff6f\042\uff6f\044\uff6f\100\uff6f\101\uff6f\112\uff6f\114\uff6f" +
+ "\001\002\000\042\002\uff74\005\uff74\011\uff74\013\uff74\014" +
+ "\uff74\015\uff74\017\uff74\020\uff74\024\uff74\036\uff74\042\uff74" +
+ "\044\uff74\100\uff74\101\uff74\112\uff74\114\uff74\001\002\000" +
+ "\042\002\uff6d\005\uff6d\011\uff6d\013\uff6d\014\uff6d\015\uff6d" +
+ "\017\uff6d\020\uff6d\024\uff6d\036\uff6d\042\uff6d\044\uff6d\100" +
+ "\uff6d\101\uff6d\112\uff6d\114\uff6d\001\002\000\022\012\072" +
+ "\014\105\016\110\021\057\055\070\102\103\104\076\113" +
+ "\uff57\001\002\000\010\013\317\042\116\044\117\001\002" +
+ "\000\040\002\uff69\005\uff69\011\uff69\013\uff69\014\uff69\015" +
+ "\uff69\017\uff69\024\uff69\036\uff69\042\uff69\044\uff69\100\uff69" +
+ "\101\uff69\112\uff69\114\uff69\001\002\000\042\002\uff75\005" +
+ "\uff75\011\uff75\013\uff75\014\uff75\015\uff75\017\uff75\020\uff75" +
+ "\024\uff75\036\uff75\042\uff75\044\uff75\100\uff75\101\uff75\112" +
+ "\uff75\114\uff75\001\002\000\022\012\072\014\105\016\110" +
+ "\021\057\055\070\102\103\104\076\113\uff57\001\002\000" +
+ "\040\002\uff6a\005\uff6a\011\uff6a\013\uff6a\014\uff6a\015\uff6a" +
+ "\017\uff6a\024\uff6a\036\uff6a\042\116\044\117\100\uff6a\101" +
+ "\uff6a\112\uff6a\114\uff6a\001\002\000\004\014\324\001\002" +
+ "\000\052\003\uffbe\012\uffbe\015\uffbe\016\uffbe\021\uffbe\036" +
+ "\uffbe\051\uffbe\055\uffbe\061\uffbe\062\uffbe\063\uffbe\064\uffbe" +
+ "\065\uffbe\067\uffbe\071\uffbe\077\uffbe\102\uffbe\103\uffbe\105" +
+ "\uffbe\112\006\001\002\000\004\015\326\001\002\000\012" +
+ "\002\uffe0\011\uffe0\015\uffe0\112\uffe0\001\002\000\012\005" +
+ "\112\014\uffc9\101\uffc9\112\uffc9\001\002\000\006\005\335" +
+ "\024\336\001\002\000\014\005\uff54\024\uff54\042\116\044" +
+ "\117\100\333\001\002\000\006\005\uff55\024\uff55\001\002" +
+ "\000\022\012\072\014\105\016\110\021\057\055\070\102" +
+ "\103\104\076\113\uff57\001\002\000\012\005\uff53\024\uff53" +
+ "\042\116\044\117\001\002\000\022\012\072\014\105\016" +
+ "\110\021\057\055\070\102\103\104\076\113\uff57\001\002" +
+ "\000\022\012\uff58\014\uff58\016\uff58\025\uff58\100\uff58\101" +
+ "\uff58\112\uff58\113\uff58\001\002\000\006\005\uff56\024\uff56" +
+ "\001\002\000\010\012\uff98\021\uff98\056\143\001\002\000" +
+ "\006\012\uff57\021\057\001\002\000\004\012\343\001\002" +
+ "\000\014\010\uffbe\013\uffbe\036\uffbe\055\uffbe\112\006\001" +
+ "\002\000\004\013\345\001\002\000\016\002\uff88\004\144" +
+ "\005\uff88\011\uff88\015\uff88\112\uff88\001\002\000\014\002" +
+ "\uff96\005\uff96\011\uff96\015\uff96\112\uff96\001\002\000\006" +
+ "\014\uffbe\112\006\001\002\000\004\014\351\001\002\000" +
+ "\066\003\uffbe\015\uffbe\036\uffbe\051\uffbe\055\uffbe\060\uffbe" +
+ "\061\uffbe\062\uffbe\063\uffbe\064\uffbe\065\uffbe\066\uffbe\067" +
+ "\uffbe\070\uffbe\071\uffbe\072\uffbe\073\uffbe\074\uffbe\075\uffbe" +
+ "\076\uffbe\077\uffbe\102\uffbe\103\uffbe\105\uffbe\111\uffbe\112" +
+ "\006\001\002\000\004\015\353\001\002\000\012\002\uffa1" +
+ "\011\uffa1\015\uffa1\112\uffa1\001\002\000\020\002\uff98\004" +
+ "\uff98\005\uff98\011\uff98\015\uff98\056\143\112\uff98\001\002" +
+ "\000\016\002\uffbe\004\uffbe\005\uffbe\011\uffbe\015\uffbe\112" +
+ "\006\001\002\000\016\002\uff88\004\144\005\uff88\011\uff88" +
+ "\015\uff88\112\uff88\001\002\000\014\002\uff9d\005\uff9d\011" +
+ "\uff9d\015\uff9d\112\uff9d\001\002\000\004\055\uffcb\001\002" +
+ "\000\004\055\uffca\001\002\000\004\055\363\001\002\000" +
+ "\014\014\uff57\021\057\100\uff57\101\uff57\112\uff57\001\002" +
+ "\000\012\014\uffc8\100\061\101\uffc8\112\uffc8\001\002\000" +
+ "\010\014\uffc6\101\064\112\uffc6\001\002\000\006\014\uffbe" +
+ "\112\006\001\002\000\004\014\370\001\002\000\052\003" +
+ "\uffbe\012\uffbe\015\uffbe\016\uffbe\021\uffbe\036\uffbe\051\uffbe" +
+ "\055\uffbe\061\uffbe\062\uffbe\063\uffbe\064\uffbe\065\uffbe\067" +
+ "\uffbe\071\uffbe\077\uffbe\102\uffbe\103\uffbe\105\uffbe\112\006" +
+ "\001\002\000\004\015\372\001\002\000\012\002\uffe1\011" +
+ "\uffe1\015\uffe1\112\uffe1\001\002\000\010\014\uff57\021\057" +
+ "\112\uff57\001\002\000\006\014\uffbe\112\006\001\002\000" +
+ "\004\014\376\001\002\000\014\003\uffbe\015\uffbe\036\uffbe" +
+ "\055\uffbe\112\006\001\002\000\012\003\u0105\015\uffd8\036" +
+ "\u0107\055\u0108\001\002\000\004\015\u0101\001\002\000\012" +
+ "\002\uffdb\011\uffdb\015\uffdb\112\uffdb\001\002\000\012\005" +
+ "\uffcf\015\uffcf\036\uffcf\112\uffcf\001\002\000\012\005\uffd6" +
+ "\015\uffd6\036\uffd6\112\uffd6\001\002\000\012\005\uffd2\015" +
+ "\uffd2\036\uffd2\112\uffd2\001\002\000\012\005\uffd1\015\uffd1" +
+ "\036\uffd1\112\uffd1\001\002\000\012\005\u0111\015\uffbe\036" +
+ "\uffbe\112\006\001\002\000\014\005\uffbe\015\uffbe\036\uffbe" +
+ "\055\uffbe\112\006\001\002\000\014\005\uffce\015\uffce\025" +
+ "\u010c\036\uffce\112\uffce\001\002\000\006\055\uffbe\112\006" +
+ "\001\002\000\004\055\u0108\001\002\000\012\005\uffd0\015" +
+ "\uffd0\036\uffd0\112\uffd0\001\002\000\004\051\u010e\001\002" +
+ "\000\012\005\uffcd\015\uffcd\036\uffcd\112\uffcd\001\002\000" +
+ "\012\005\uffcc\015\uffcc\036\uffcc\112\uffcc\001\002\000\014" +
+ "\005\uffaa\015\uffaa\036\u0107\055\uffaa\112\uffaa\001\002\000" +
+ "\014\005\uffab\015\uffab\036\uffab\055\uffab\112\uffab\001\002" +
+ "\000\016\003\uffbe\005\uffbe\015\uffbe\036\uffbe\055\uffbe\112" +
+ "\006\001\002\000\006\015\uffd9\036\u0107\001\002\000\012" +
+ "\005\uffbe\015\uffbe\036\uffbe\112\006\001\002\000\012\005" +
+ "\uffd4\015\uffd4\036\uffd4\112\uffd4\001\002\000\016\003\u0105" +
+ "\005\uffd5\015\uffd5\036\u0107\055\u0108\112\uffd5\001\002\000" +
+ "\012\005\uffd7\015\uffd7\036\uffd7\112\uffd7\001\002\000\014" +
+ "\005\uffbe\015\uffbe\036\uffbe\055\uffbe\112\006\001\002\000" +
+ "\014\005\uffd3\015\uffd3\036\uffd3\055\u0108\112\uffd3\001\002" +
+ "\000\016\002\uffbe\004\uffbe\005\uffbe\011\uffbe\015\uffbe\112" +
+ "\006\001\002\000\016\002\uff88\004\144\005\uff88\011\uff88" +
+ "\015\uff88\112\uff88\001\002\000\014\002\uff9b\005\uff9b\011" +
+ "\uff9b\015\uff9b\112\uff9b\001\002\000\004\055\u011d\001\002" +
+ "\000\010\014\uff57\021\057\112\uff57\001\002\000\006\014" +
+ "\uffbe\112\006\001\002\000\004\014\u0120\001\002\000\014" +
+ "\003\uffbe\015\uffbe\036\uffbe\055\uffbe\112\006\001\002\000" +
+ "\004\015\u0122\001\002\000\012\002\uffda\011\uffda\015\uffda" +
+ "\112\uffda\001\002\000\010\012\uff98\021\uff98\056\143\001" +
+ "\002\000\006\012\uff57\021\057\001\002\000\004\012\u0126" +
+ "\001\002\000\014\010\uffbe\013\uffbe\036\uffbe\055\uffbe\112" +
+ "\006\001\002\000\004\013\u0128\001\002\000\016\002\uff88" +
+ "\004\144\005\uff88\011\uff88\015\uff88\112\uff88\001\002\000" +
+ "\014\002\uff95\005\uff95\011\uff95\015\uff95\112\uff95\001\002" +
+ "\000\004\055\u0134\001\002\000\004\055\u012f\001\002\000" +
+ "\004\055\u012d\001\002\000\012\002\uffbe\011\uffbe\015\uffbe" +
+ "\112\006\001\002\000\012\002\uffef\011\uffef\015\uffef\112" +
+ "\uffef\001\002\000\006\021\057\025\uff57\001\002\000\004" +
+ "\025\u0131\001\002\000\022\012\072\014\105\016\110\021" +
+ "\057\055\070\102\103\104\076\113\uff57\001\002\000\016" +
+ "\002\uffe2\011\uffe2\015\uffe2\042\116\044\117\112\uffe2\001" +
+ "\002\000\006\005\u0138\015\u0139\001\002\000\010\005\uffeb" +
+ "\015\uffeb\107\u0136\001\002\000\006\005\uffec\015\uffec\001" +
+ "\002\000\004\055\u0137\001\002\000\006\005\uffea\015\uffea" +
+ "\001\002\000\006\055\uffbe\112\006\001\002\000\012\002" +
+ "\uffbe\011\uffbe\015\uffbe\112\006\001\002\000\012\002\uffee" +
+ "\011\uffee\015\uffee\112\uffee\001\002\000\004\055\u0134\001" +
+ "\002\000\006\005\uffed\015\uffed\001\002\000\006\021\057" +
+ "\025\uff57\001\002\000\004\025\u013f\001\002\000\024\012" +
+ "\uffbe\014\uffbe\016\uffbe\021\uffbe\055\uffbe\102\uffbe\104\uffbe" +
+ "\112\006\113\uffbe\001\002\000\022\012\072\014\105\016" +
+ "\110\021\057\055\070\102\103\104\076\113\uff57\001\002" +
+ "\000\016\002\uffe3\011\uffe3\015\uffe3\042\116\044\117\112" +
+ "\uffe3\001\002\000\040\012\uff62\016\uff62\021\uff62\051\uff62" +
+ "\055\uff62\062\uff62\066\uff62\072\uff62\073\uff62\075\uff62\076" +
+ "\uff62\077\uff62\102\uff62\105\uff62\111\uff62\001\002\000\066" +
+ "\002\uffba\003\033\015\uffba\036\015\051\uff5f\055\uff5f\060" +
+ "\uffe8\061\035\062\uff5f\063\020\064\031\065\024\066\uff5f" +
+ "\067\041\070\023\071\036\072\uff5f\073\uff5f\074\032\075" +
+ "\uff5f\076\uff5f\077\uff5f\102\uff5f\103\026\105\uff5f\111\uff5f" +
+ "\001\002\000\070\002\uffbb\003\uffbb\015\uffbb\036\uffbb\051" +
+ "\uffbb\055\uffbb\060\uffbb\061\uffbb\062\uffbb\063\uffbb\064\uffbb" +
+ "\065\uffbb\066\uffbb\067\uffbb\070\uffbb\071\uffbb\072\uffbb\073" +
+ "\uffbb\074\uffbb\075\uffbb\076\uffbb\077\uffbb\102\uffbb\103\uffbb" +
+ "\105\uffbb\111\uffbb\112\250\001\002\000\006\002\uffff\015" +
+ "\uffff\001\002\000\070\002\uffbc\003\uffbc\015\uffbc\036\uffbc" +
+ "\051\uffbc\055\uffbc\060\uffbc\061\uffbc\062\uffbc\063\uffbc\064" +
+ "\uffbc\065\uffbc\066\uffbc\067\uffbc\070\uffbc\071\uffbc\072\uffbc" +
+ "\073\uffbc\074\uffbc\075\uffbc\076\uffbc\077\uffbc\102\uffbc\103" +
+ "\uffbc\105\uffbc\111\uffbc\112\006\001\002\000\070\002\uffbd" +
+ "\003\uffbd\015\uffbd\036\uffbd\051\uffbd\055\uffbd\060\uffbd\061" +
+ "\uffbd\062\uffbd\063\uffbd\064\uffbd\065\uffbd\066\uffbd\067\uffbd" +
+ "\070\uffbd\071\uffbd\072\uffbd\073\uffbd\074\uffbd\075\uffbd\076" +
+ "\uffbd\077\uffbd\102\uffbd\103\uffbd\105\uffbd\111\uffbd\112\250" +
+ "\001\002\000\012\002\ufffd\011\ufffd\015\ufffd\112\ufffd\001" +
+ "\002\000\040\012\uff60\016\uff60\021\uff60\051\uff60\055\uff60" +
+ "\062\uff60\066\uff60\072\uff60\073\uff60\075\uff60\076\uff60\077" +
+ "\uff60\102\uff60\105\uff60\111\uff60\001\002\000\006\014\uffbe" +
+ "\112\006\001\002\000\004\014\u014c\001\002\000\066\003" +
+ "\uffbe\015\uffbe\036\uffbe\051\uffbe\055\uffbe\060\uffbe\061\uffbe" +
+ "\062\uffbe\063\uffbe\064\uffbe\065\uffbe\066\uffbe\067\uffbe\070" +
+ "\uffbe\071\uffbe\072\uffbe\073\uffbe\074\uffbe\075\uffbe\076\uffbe" +
+ "\077\uffbe\102\uffbe\103\uffbe\105\uffbe\111\uffbe\112\006\001" +
+ "\002\000\004\015\u014e\001\002\000\012\002\uffa0\011\uffa0" +
+ "\015\uffa0\112\uffa0\001\002\000\040\012\uff63\016\uff63\021" +
+ "\uff63\051\uff63\055\uff63\062\uff63\066\uff63\072\uff63\073\uff63" +
+ "\075\uff63\076\uff63\077\uff63\102\uff63\105\uff63\111\uff63\001" +
+ "\002\000\006\030\u0152\055\u0153\001\002\000\012\002\uffe7" +
+ "\011\uffe7\015\uffe7\112\uffe7\001\002\000\004\107\u015a\001" +
+ "\002\000\004\025\u0154\001\002\000\004\055\u0156\001\002" +
+ "\000\012\002\uffe5\011\uffe5\015\uffe5\112\uffe5\001\002\000" +
+ "\016\002\uff5e\006\272\011\uff5e\012\u0157\015\uff5e\112\uff5e" +
+ "\001\002\000\004\055\271\001\002\000\004\013\u0159\001" +
+ "\002\000\012\002\uffe4\011\uffe4\015\uffe4\112\uffe4\001\002" +
+ "\000\004\055\u015b\001\002\000\004\110\u015c\001\002\000" +
+ "\004\055\271\001\002\000\012\002\uffe6\011\uffe6\015\uffe6" +
+ "\112\uffe6\001\002\000\004\002\001\001\002" });
+
+ /** Access to parse-action table. */
+ public short[][] action_table() {return _action_table;}
+
+ /** reduce_goto table. */
+ protected static final short[][] _reduce_table =
+ unpackFromStrings(new String[] {
+ "\000\u015c\000\012\003\006\004\003\076\004\101\007\001" +
+ "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+ "\000\002\001\001\000\036\005\027\006\037\007\011\010" +
+ "\020\011\013\012\016\014\024\015\010\016\033\021\026" +
+ "\022\021\035\015\061\036\111\012\001\001\000\002\001" +
+ "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\002\001\001\000\002\001\001\000\004" +
+ "\064\u0149\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\002\001\001\000\010\076\u0143\077\u0142" +
+ "\100\u0144\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\002\001\001\000\002\001\001\000\002" +
+ "\001\001\000\010\063\041\112\047\113\046\001\001\000" +
+ "\002\001\001\000\002\001\001\000\002\001\001\000\004" +
+ "\026\u0118\001\001\000\002\001\001\000\002\001\001\000" +
+ "\004\026\231\001\001\000\004\013\361\001\001\000\002" +
+ "\001\001\000\002\001\001\000\006\026\210\064\346\001" +
+ "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+ "\000\004\066\057\001\001\000\036\045\330\047\103\050" +
+ "\076\051\105\052\073\054\074\055\072\056\065\057\077" +
+ "\060\070\064\100\066\106\067\327\070\331\001\001\000" +
+ "\004\074\061\001\001\000\034\045\066\047\103\050\076" +
+ "\051\105\052\073\054\074\055\072\056\065\057\077\060" +
+ "\070\064\100\066\106\104\326\001\001\000\004\075\062" +
+ "\001\001\000\006\076\004\101\322\001\001\000\006\076" +
+ "\004\101\064\001\001\000\034\045\066\047\103\050\076" +
+ "\051\105\052\073\054\074\055\072\056\065\057\077\060" +
+ "\070\064\100\066\106\104\101\001\001\000\002\001\001" +
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+ "\032\045\275\047\303\050\302\051\105\052\300\054\074" +
+ "\055\277\056\065\057\077\060\070\064\100\066\106\001" +
+ "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+ "\000\004\064\267\001\001\000\002\001\001\000\002\001" +
+ "\001\000\004\071\261\001\001\000\002\001\001\000\004" +
+ "\066\252\001\001\000\002\001\001\000\010\030\161\076" +
+ "\004\101\162\001\001\000\002\001\001\000\002\001\001" +
+ "\000\034\045\066\047\103\050\076\051\105\052\073\054" +
+ "\074\055\072\056\065\057\077\060\070\064\100\066\106" +
+ "\104\110\001\001\000\002\001\001\000\006\076\004\101" +
+ "\113\001\001\000\002\001\001\000\032\045\114\047\103" +
+ "\050\076\051\105\052\073\054\074\055\072\056\065\057" +
+ "\077\060\070\064\100\066\106\001\001\000\002\001\001" +
+ "\000\006\076\004\101\121\001\001\000\006\076\004\101" +
+ "\117\001\001\000\032\045\120\047\103\050\076\051\105" +
+ "\052\073\054\074\055\072\056\065\057\077\060\070\064" +
+ "\100\066\106\001\001\000\002\001\001\000\032\045\122" +
+ "\047\103\050\076\051\105\052\073\054\074\055\072\056" +
+ "\065\057\077\060\070\064\100\066\106\001\001\000\002" +
+ "\001\001\000\010\023\125\076\004\101\124\001\001\000" +
+ "\010\024\131\025\134\107\132\001\001\000\002\001\001" +
+ "\000\002\001\001\000\032\045\130\047\103\050\076\051" +
+ "\105\052\073\054\074\055\072\056\065\057\077\060\070" +
+ "\064\100\066\106\001\001\000\002\001\001\000\006\076" +
+ "\004\101\154\001\001\000\006\076\004\101\135\001\001" +
+ "\000\002\001\001\000\002\001\001\000\004\027\137\001" +
+ "\001\000\002\001\001\000\002\001\001\000\004\026\141" +
+ "\001\001\000\006\043\144\044\145\001\001\000\002\001" +
+ "\001\000\006\076\004\101\150\001\001\000\004\107\146" +
+ "\001\001\000\002\001\001\000\006\076\004\101\147\001" +
+ "\001\000\002\001\001\000\004\107\151\001\001\000\006" +
+ "\076\004\101\152\001\001\000\032\045\153\047\103\050" +
+ "\076\051\105\052\073\054\074\055\072\056\065\057\077" +
+ "\060\070\064\100\066\106\001\001\000\002\001\001\000" +
+ "\002\001\001\000\006\076\004\101\156\001\001\000\006" +
+ "\025\157\107\132\001\001\000\002\001\001\000\002\001" +
+ "\001\000\002\001\001\000\024\014\170\016\174\017\165" +
+ "\020\166\031\163\032\173\033\167\034\171\061\176\001" +
+ "\001\000\010\076\241\102\243\103\244\001\001\000\002" +
+ "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
+ "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+ "\006\066\200\112\047\001\001\000\006\026\231\066\230" +
+ "\001\001\000\002\001\001\000\004\026\210\001\001\000" +
+ "\004\066\203\001\001\000\002\001\001\000\006\025\205" +
+ "\107\132\001\001\000\002\001\001\000\006\043\207\044" +
+ "\145\001\001\000\002\001\001\000\010\066\211\076\004" +
+ "\101\212\001\001\000\002\001\001\000\006\043\213\044" +
+ "\145\001\001\000\002\001\001\000\010\023\215\076\004" +
+ "\101\124\001\001\000\002\001\001\000\006\043\217\044" +
+ "\145\001\001\000\002\001\001\000\006\025\225\107\132" +
+ "\001\001\000\010\023\222\076\004\101\124\001\001\000" +
+ "\002\001\001\000\006\043\224\044\145\001\001\000\002" +
+ "\001\001\000\002\001\001\000\006\043\227\044\145\001" +
+ "\001\000\002\001\001\000\002\001\001\000\006\076\004" +
+ "\101\232\001\001\000\006\043\233\044\145\001\001\000" +
+ "\002\001\001\000\010\023\235\076\004\101\124\001\001" +
+ "\000\002\001\001\000\006\043\237\044\145\001\001\000" +
+ "\002\001\001\000\004\076\250\001\001\000\002\001\001" +
+ "\000\004\076\246\001\001\000\022\014\170\016\174\017" +
+ "\165\020\166\032\245\033\167\034\171\061\176\001\001" +
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\002\001\001\000\002\001\001\000\002" +
+ "\001\001\000\010\023\254\076\004\101\124\001\001\000" +
+ "\002\001\001\000\002\001\001\000\032\045\257\047\103" +
+ "\050\076\051\105\052\073\054\074\055\072\056\065\057" +
+ "\077\060\070\064\100\066\106\001\001\000\002\001\001" +
+ "\000\034\045\262\047\103\050\076\051\105\052\073\054" +
+ "\074\055\072\056\065\057\077\060\070\064\100\066\106" +
+ "\072\263\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\032\045\266\047\103\050\076\051\105" +
+ "\052\073\054\074\055\072\056\065\057\077\060\070\064" +
+ "\100\066\106\001\001\000\002\001\001\000\002\001\001" +
+ "\000\002\001\001\000\002\001\001\000\004\064\272\001" +
+ "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\004\064\307\001\001\000\002\001\001" +
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\002\001\001\000\002\001\001\000\002" +
+ "\001\001\000\002\001\001\000\002\001\001\000\032\045" +
+ "\315\047\103\050\076\051\105\052\073\054\074\055\072" +
+ "\056\065\057\077\060\070\064\100\066\106\001\001\000" +
+ "\002\001\001\000\002\001\001\000\002\001\001\000\032" +
+ "\045\321\047\103\050\076\051\105\052\073\054\074\055" +
+ "\072\056\065\057\077\060\070\064\100\066\106\001\001" +
+ "\000\002\001\001\000\002\001\001\000\010\030\324\076" +
+ "\004\101\162\001\001\000\002\001\001\000\002\001\001" +
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\032\045\333\047\103\050\076\051\105" +
+ "\052\073\054\074\055\072\056\065\057\077\060\070\064" +
+ "\100\066\106\001\001\000\002\001\001\000\034\045\330" +
+ "\047\103\050\076\051\105\052\073\054\074\055\072\056" +
+ "\065\057\077\060\070\064\100\066\106\070\336\001\001" +
+ "\000\002\001\001\000\002\001\001\000\004\026\340\001" +
+ "\001\000\004\066\341\001\001\000\002\001\001\000\010" +
+ "\023\343\076\004\101\124\001\001\000\002\001\001\000" +
+ "\006\043\345\044\145\001\001\000\002\001\001\000\006" +
+ "\076\004\101\347\001\001\000\002\001\001\000\010\004" +
+ "\351\076\004\101\007\001\001\000\002\001\001\000\002" +
+ "\001\001\000\004\026\354\001\001\000\006\076\004\101" +
+ "\355\001\001\000\006\043\356\044\145\001\001\000\002" +
+ "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
+ "\001\000\004\066\363\001\001\000\004\074\364\001\001" +
+ "\000\004\075\365\001\001\000\006\076\004\101\366\001" +
+ "\001\000\002\001\001\000\010\030\370\076\004\101\162" +
+ "\001\001\000\002\001\001\000\002\001\001\000\004\066" +
+ "\373\001\001\000\006\076\004\101\374\001\001\000\002" +
+ "\001\001\000\010\037\377\076\004\101\376\001\001\000" +
+ "\014\036\u0105\040\u0102\041\u0103\042\u0101\105\u0108\001\001" +
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\002\001\001\000\002\001\001\000\006" +
+ "\076\004\101\u0111\001\001\000\006\076\004\101\u010e\001" +
+ "\001\000\002\001\001\000\006\076\004\101\u0109\001\001" +
+ "\000\004\042\u010a\001\001\000\002\001\001\000\004\110" +
+ "\u010c\001\001\000\002\001\001\000\002\001\001\000\004" +
+ "\105\u010f\001\001\000\002\001\001\000\006\076\004\101" +
+ "\u0114\001\001\000\004\105\u0112\001\001\000\006\076\004" +
+ "\101\u0113\001\001\000\002\001\001\000\012\040\u0115\041" +
+ "\u0103\042\u0101\105\u0116\001\001\000\002\001\001\000\006" +
+ "\076\004\101\u0117\001\001\000\004\042\u010a\001\001\000" +
+ "\006\076\004\101\u0119\001\001\000\006\043\u011a\044\145" +
+ "\001\001\000\002\001\001\000\002\001\001\000\004\066" +
+ "\u011d\001\001\000\006\076\004\101\u011e\001\001\000\002" +
+ "\001\001\000\010\037\u0120\076\004\101\376\001\001\000" +
+ "\002\001\001\000\002\001\001\000\004\026\u0123\001\001" +
+ "\000\004\066\u0124\001\001\000\002\001\001\000\010\023" +
+ "\u0126\076\004\101\124\001\001\000\002\001\001\000\006" +
+ "\043\u0128\044\145\001\001\000\002\001\001\000\006\114" +
+ "\u0132\115\u0134\001\001\000\002\001\001\000\002\001\001" +
+ "\000\006\076\004\101\u012d\001\001\000\002\001\001\000" +
+ "\004\066\u012f\001\001\000\002\001\001\000\032\045\u0131" +
+ "\047\103\050\076\051\105\052\073\054\074\055\072\056" +
+ "\065\057\077\060\070\064\100\066\106\001\001\000\002" +
+ "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
+ "\001\000\002\001\001\000\002\001\001\000\006\076\004" +
+ "\101\u013a\001\001\000\006\076\004\101\u0139\001\001\000" +
+ "\002\001\001\000\004\115\u013b\001\001\000\002\001\001" +
+ "\000\004\066\u013d\001\001\000\002\001\001\000\006\076" +
+ "\004\101\u013f\001\001\000\032\045\u0140\047\103\050\076" +
+ "\051\105\052\073\054\074\055\072\056\065\057\077\060" +
+ "\070\064\100\066\106\001\001\000\002\001\001\000\002" +
+ "\001\001\000\034\006\u0147\007\011\010\020\011\013\012" +
+ "\016\014\024\015\010\016\033\021\026\022\021\035\015" +
+ "\061\036\111\012\001\001\000\002\001\001\000\002\001" +
+ "\001\000\004\076\u0146\001\001\000\002\001\001\000\002" +
+ "\001\001\000\002\001\001\000\006\076\004\101\u014a\001" +
+ "\001\000\002\001\001\000\010\004\u014c\076\004\101\007" +
+ "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
+ "\001\000\004\065\u0150\001\001\000\002\001\001\000\002" +
+ "\001\001\000\002\001\001\000\004\064\u0154\001\001\000" +
+ "\002\001\001\000\002\001\001\000\004\064\u0157\001\001" +
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\004\064\u015c\001\001\000\002\001\001" +
+ "\000\002\001\001" });
+
+ /** Access to reduce_goto table. */
+ public short[][] reduce_table() {return _reduce_table;}
+
+ /** Instance of action encapsulation class. */
+ protected CUP$TypescriptDefParser$actions action_obj;
+
+ /** Action encapsulation object initializer. */
+ protected void init_actions()
+ {
+ action_obj = new CUP$TypescriptDefParser$actions(this);
+ }
+
+ /** Invoke a user supplied parse action. */
+ public java_cup.runtime.Symbol do_action(
+ int act_num,
+ java_cup.runtime.lr_parser parser,
+ java.util.Stack stack,
+ int top)
+ throws java.lang.Exception
+ {
+ /* call code in generated class */
+ return action_obj.CUP$TypescriptDefParser$do_action(act_num, parser, stack, top);
+ }
+
+ /** Indicates start state. */
+ public int start_state() {return 0;}
+ /** Indicates start production. */
+ public int start_production() {return 0;}
+
+ /** EOF Symbol index. */
+ public int EOF_sym() {return 0;}
+
+ /** error Symbol index. */
+ public int error_sym() {return 1;}
+
+
+
+
+ public PrintStream out = System.out;
+ public PrintStream err = System.err;
+ public CompilationUnit compilationUnit;
+ public Stack comments = new Stack();
+
+ protected static TypescriptDefParser createParser(File file) throws java.io.FileNotFoundException {
+ TypescriptDefScanner scanner= new TypescriptDefScanner(new java.io.FileReader(file));
+ scanner.setFileName(file.getPath());
+ TypescriptDefParser parser= new TypescriptDefParser(scanner);
+ parser.compilationUnit = new CompilationUnit(file);
+ return parser;
+ }
+
+ public static TypescriptDefParser parseFile(File file) throws java.io.FileNotFoundException {
+ TypescriptDefParser parser= createParser(file);
+ try {
+ parser.parse();
+ } catch(Exception e) {
+ e.printStackTrace();
+ parser.errors.add(new SyntaxError(null, "internal parser error"));
+ }
+ return parser;
+ }
+
+ public List errors = new ArrayList();
+
+ public void syntax_error(java_cup.runtime.Symbol current) {
+ //errors.add(new SyntaxError("syntax error: '"+current.value + "' is not expected", at " + (current.left+1)+"("+(current.right+1)+")" );
+ SyntaxError e = new SyntaxError((Token)current.value, "'"+current.value + "' is not expected");
+ errors.add(e);
+ System.err.println(e);
+ }
+
+ public void syntax_error(Token current) {
+ SyntaxError e = new SyntaxError(current, "'"+current + "' is not expected");
+ errors.add(e);
+ System.err.println(e);
+ }
+
+ public void unrecovered_syntax_error(java_cup.runtime.Symbol current) {
+ System.err.println("unable to recover from previous error(s)... giving up!");
+ }
+
+ public void printErrors(PrintStream out) {
+ for (SyntaxError error : errors) {
+ out.println(error.toString());
+ }
+ }
+
+ public boolean hasErrors() {
+ return !errors.isEmpty();
+ }
+
+
+
+
+}
+
+/** Cup generated class to encapsulate user supplied action code.*/
+@SuppressWarnings("all")
+class CUP$TypescriptDefParser$actions {
+ private final TypescriptDefParser parser;
+
+ /** Constructor */
+ CUP$TypescriptDefParser$actions(TypescriptDefParser parser) {
+ this.parser = parser;
+ }
+
+ /** Method with the actual generated action code. */
+ public final java_cup.runtime.Symbol CUP$TypescriptDefParser$do_action(
+ int CUP$TypescriptDefParser$act_num,
+ java_cup.runtime.lr_parser CUP$TypescriptDefParser$parser,
+ java.util.Stack CUP$TypescriptDefParser$stack,
+ int CUP$TypescriptDefParser$top)
+ throws java.lang.Exception
+ {
+ /* Symbol object for return from actions */
+ java_cup.runtime.Symbol CUP$TypescriptDefParser$result;
+
+ /* select the action based on the action number */
+ switch (CUP$TypescriptDefParser$act_num)
+ {
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 174: // type_param ::= type EXTENDS type
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int sleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int sright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object s = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT=new TypeParameterDeclaration(((TypeReference)t).getToken(), ((TypeReference)t).getName());
+ ((TypeParameterDeclaration)RESULT).setUpperBound((TypeReference)s);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(54/*type_param*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 173: // type_param ::= type
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT=new TypeParameterDeclaration(((TypeReference)t).getToken(), ((TypeReference)t).getName());
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(54/*type_param*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 172: // type_param_list ::= type_param
+ {
+ Object RESULT = null;
+ int pleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int pright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object p = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT=new TypeParameterDeclaration[] { (TypeParameterDeclaration)p };
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(53/*type_param_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 171: // type_param_list ::= type_param_list COMMA type_param
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int pleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int pright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object p = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ TypeParameterDeclaration[] list = (TypeParameterDeclaration[])l;
+ RESULT = ArrayUtils.add(list, (TypeParameterDeclaration)p);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(53/*type_param_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 170: // type_param_list_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(52/*type_param_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 169: // type_param_list_opt ::= LT type_param_list GT
+ {
+ Object RESULT = null;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT = tparams;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(52/*type_param_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 168: // type_arg_list ::= type
+ {
+ Object RESULT = null;
+ int pleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int pright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object p = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT=new TypeReference[] { (TypeReference)p };
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(56/*type_arg_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 167: // type_arg_list ::= type_arg_list COMMA type
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int pleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int pright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object p = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ TypeReference[] list = (TypeReference[])l;
+ RESULT = ArrayUtils.add(list, (TypeReference)p);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(56/*type_arg_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 166: // type_arg_list_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(55/*type_arg_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 165: // type_arg_list_opt ::= LT type_arg_list GT
+ {
+ Object RESULT = null;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT = tparams;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(55/*type_arg_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 164: // qual_id ::= IDENTIFIER DOT qual_id
+ {
+ Object RESULT = null;
+ int ileft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int iright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object i = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int qleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int qright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object q = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=i.toString()+"."+q.toString();
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(50/*qual_id*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 163: // qual_id ::= IDENTIFIER
+ {
+ Object RESULT = null;
+ int ileft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int iright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object i = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=i.toString();
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(50/*qual_id*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 162: // declare_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(47/*declare_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 161: // declare_opt ::= PUBLIC STATIC
+ {
+ Object RESULT = null;
+ RESULT = "public static";
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(47/*declare_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 160: // declare_opt ::= PUBLIC
+ {
+ Object RESULT = null;
+ RESULT = "public";
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(47/*declare_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 159: // declare_opt ::= PROTECTED STATIC
+ {
+ Object RESULT = null;
+ RESULT = "protected static";
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(47/*declare_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 158: // declare_opt ::= PRIVATE STATIC
+ {
+ Object RESULT = null;
+ RESULT = "private static";
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(47/*declare_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 157: // declare_opt ::= PROTECTED
+ {
+ Object RESULT = null;
+ RESULT = "protected";
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(47/*declare_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 156: // declare_opt ::= PRIVATE
+ {
+ Object RESULT = null;
+ RESULT = "private";
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(47/*declare_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 155: // declare_opt ::= STATIC
+ {
+ Object RESULT = null;
+ RESULT = "static";
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(47/*declare_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 154: // declare_opt ::= DECLARE
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(47/*declare_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 153: // declare_opt ::= EXPORT
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(47/*declare_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 152: // is_type ::= LPAREN IDENTIFIER IS type RPAREN
+ {
+ Object RESULT = null;
+ RESULT=new TypeReference(null, "boolean", null);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(45/*is_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 151: // is_type ::= IDENTIFIER IS type
+ {
+ Object RESULT = null;
+ RESULT=new TypeReference(null, "boolean", null);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(45/*is_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 150: // typeof_type ::= LPAREN TYPEOF qual_id RPAREN
+ {
+ Object RESULT = null;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ TypeReference t = new TypeReference(null, (String)name, null); t.setTypeOf(true); RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(44/*typeof_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 149: // typeof_type ::= TYPEOF qual_id
+ {
+ Object RESULT = null;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ TypeReference t = new TypeReference(null, (String)name, null); t.setTypeOf(true); RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(44/*typeof_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 148: // object_type ::= LPAREN object_type RPAREN
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(43/*object_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 147: // object_type ::= LCPAREN member_list_opt RCPAREN
+ {
+ Object RESULT = null;
+ int tokenleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int tokenright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object token = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int membersleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int membersright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object members = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT=new TypeReference((Token)token, (Declaration[])members);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(43/*object_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 146: // functional_type ::= LPAREN functional_type RPAREN
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(40/*functional_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 145: // functional_type ::= NEW type_param_list_opt LPAREN_FUNC param_list_opt RPAREN_FUNC IMPLIES type
+ {
+ Object RESULT = null;
+ int ileft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).left;
+ int iright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).right;
+ Object i = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int paramsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int paramsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object params = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT=new FunctionalTypeReference((Token)i, true, (TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(40/*functional_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 144: // functional_type ::= type_param_list_opt LPAREN_FUNC param_list_opt RPAREN_FUNC IMPLIES type
+ {
+ Object RESULT = null;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int tokenleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int tokenright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object token = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int paramsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int paramsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object params = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT=new FunctionalTypeReference((Token)token, (TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(40/*functional_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 143: // array_type ::= LPAREN union_type RPAREN SQUARE
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ RESULT=new ArrayTypeReference(null, (TypeReference)t);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(39/*array_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 142: // array_type ::= array_type SQUARE
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT=new ArrayTypeReference(null, (TypeReference)t);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(39/*array_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 141: // array_type ::= LPAREN functional_type RPAREN SQUARE
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ RESULT=new ArrayTypeReference(null, (TypeReference)t);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(39/*array_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 140: // array_type ::= tuple_type SQUARE
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT=new ArrayTypeReference( null, (TypeReference)t);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(39/*array_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 139: // array_type ::= object_type SQUARE
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT=new ArrayTypeReference( null, (TypeReference)t);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(39/*array_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 138: // array_type ::= simple_type SQUARE
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT=new ArrayTypeReference( null, (TypeReference)t);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(39/*array_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 137: // tuple_type ::= LSPAREN type_list RSPAREN
+ {
+ Object RESULT = null;
+ int typesleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int typesright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object types = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT=new TypeReference(null, "$tuple$", (TypeReference[])types);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(46/*tuple_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 136: // simple_type ::= qual_id type_arg_list_opt
+ {
+ Object RESULT = null;
+ int qleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int qright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object q = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=new TypeReference(null, (String)q, (TypeReference[])tparams);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(42/*simple_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 135: // intersection_type ::= LPAREN intersection_type RPAREN
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(38/*intersection_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 134: // intersection_type ::= type AND lf_opt type
+ {
+ Object RESULT = null;
+ int t1left = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int t1right = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object t1 = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int t2left = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int t2right = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t2 = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=new UnionTypeReference((Token)t, (TypeReference)t1, (TypeReference)t2, true);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(38/*intersection_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 133: // union_type ::= LPAREN union_type RPAREN
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(37/*union_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 132: // union_type ::= type TUBE lf_opt type
+ {
+ Object RESULT = null;
+ int t1left = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int t1right = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object t1 = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int t2left = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int t2right = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t2 = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=new UnionTypeReference((Token)t, (TypeReference)t1, (TypeReference)t2);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(37/*union_type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 131: // type ::= tuple_type
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(35/*type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 130: // type ::= simple_type
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(35/*type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 129: // type ::= array_type
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(35/*type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 128: // type ::= object_type
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(35/*type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 127: // type ::= intersection_type
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(35/*type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 126: // type ::= union_type
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(35/*type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 125: // type ::= is_type
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(35/*type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 124: // type ::= typeof_type
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(35/*type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 123: // type ::= functional_type
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(35/*type*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 122: // type_annotation ::= COL lf_opt doc_opt lf_opt type
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(34/*type_annotation*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 121: // type_annotation_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(33/*type_annotation_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 120: // type_annotation_opt ::= type_annotation
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(33/*type_annotation_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 119: // varargs_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(21/*varargs_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 118: // varargs_opt ::= DOTDOTDOT
+ {
+ Object RESULT = null;
+ int varargsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int varargsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object varargs = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=varargs;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(21/*varargs_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 117: // param ::= doc_opt lf_opt varargs_opt IDENTIFIER optional_opt type_annotation_opt doc_opt lf_opt
+ {
+ Object RESULT = null;
+ int varargsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int varargsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object varargs = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int ileft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int iright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object i = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int optleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int optright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object opt = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+
+ RESULT = new ParameterDeclaration( (Token)i, i.toString(), (TypeReference)t, (Boolean)opt, varargs!=null);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(19/*param*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-7)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 116: // param_list ::= param
+ {
+ Object RESULT = null;
+ int pleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int pright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object p = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT=new ParameterDeclaration[] { (ParameterDeclaration)p };
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(18/*param_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 115: // param_list ::= param_list lf_opt COMMA lf_opt param
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int pleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int pright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object p = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ ParameterDeclaration[] list = (ParameterDeclaration[])l;
+ RESULT = ArrayUtils.add(list, (ParameterDeclaration)p);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(18/*param_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 114: // param_list_opt ::= lf_opt
+ {
+ Object RESULT = null;
+ RESULT = new ParameterDeclaration[0];
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(17/*param_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 113: // param_list_opt ::= lf_opt param_list lf_opt
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT = l;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(17/*param_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 112: // index_sig_decl ::= declare_opt CONST type_param_list_opt LSPAREN param RSPAREN type_annotation_opt
+ {
+ Object RESULT = null;
+ int readonlyleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int readonlyright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object readonly = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int tokenleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int tokenright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object token = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int paramleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int paramright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object param = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT = new FunctionDeclaration((Token)token,FunctionDeclaration.INDEXSIG_RESERVED_NAME,(TypeReference)t, new ParameterDeclaration[] {(ParameterDeclaration)param}, (TypeParameterDeclaration[])tparams);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(14/*index_sig_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 111: // index_sig_decl ::= declare_opt type_param_list_opt LSPAREN param RSPAREN type_annotation_opt
+ {
+ Object RESULT = null;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int tokenleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int tokenright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object token = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int paramleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int paramright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object param = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT = new FunctionDeclaration((Token)token,FunctionDeclaration.INDEXSIG_RESERVED_NAME,(TypeReference)t, new ParameterDeclaration[] {(ParameterDeclaration)param}, (TypeParameterDeclaration[])tparams);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(14/*index_sig_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 110: // constructor_decl ::= declare_opt NEW type_param_list_opt LPAREN param_list_opt RPAREN type_annotation_opt
+ {
+ Object RESULT = null;
+ int modleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).left;
+ int modright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).right;
+ Object mod = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int tokenleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int tokenright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object token = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int paramsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int paramsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object params = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ //System.err.println("5");
+ RESULT = new FunctionDeclaration((Token)token,FunctionDeclaration.NEW_FUNCTION_RESERVED_NAME,(TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(13/*constructor_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 109: // constructor_decl ::= declare_opt type_param_list_opt LPAREN param_list_opt RPAREN type_annotation_opt
+ {
+ Object RESULT = null;
+ int modleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int modright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object mod = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int tokenleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int tokenright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object token = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int paramsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int paramsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object params = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ //System.err.println("4");
+ RESULT = new FunctionDeclaration((Token)token,FunctionDeclaration.ANONYMOUS_FUNCTION_RESERVED_NAME,(TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(13/*constructor_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 108: // func_decl ::= DECLARE_FUNCTION IDENTIFIER optional_opt type_param_list_opt LPAREN param_list_opt RPAREN type_annotation_opt
+ {
+ Object RESULT = null;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).value;
+ int optleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int optright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object opt = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int paramsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int paramsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object params = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ //System.err.println("3");
+ RESULT = new FunctionDeclaration((Token)name,name.toString(),(TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(12/*func_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-7)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 107: // func_decl ::= declare_opt FUNCTION IDENTIFIER optional_opt type_param_list_opt LPAREN param_list_opt RPAREN type_annotation_opt
+ {
+ Object RESULT = null;
+ int modleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-8)).left;
+ int modright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-8)).right;
+ Object mod = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-8)).value;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).value;
+ int optleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int optright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object opt = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int paramsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int paramsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object params = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ //System.err.println("2");
+ FunctionDeclaration func = new FunctionDeclaration((Token)name,name.toString(),(TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+ if(mod!=null) func.addModifier((String)mod);
+ func.setHidden(func.hasModifier("private"));
+ RESULT = func;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(12/*func_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-8)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 106: // func_decl ::= declare_opt IDENTIFIER optional_opt type_param_list_opt LPAREN param_list_opt RPAREN type_annotation_opt
+ {
+ Object RESULT = null;
+ int modleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-7)).left;
+ int modright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-7)).right;
+ Object mod = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-7)).value;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).value;
+ int optleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int optright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object opt = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int paramsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int paramsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object params = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ //System.err.println("1");
+ FunctionDeclaration func = new FunctionDeclaration((Token)name,name.toString(),(TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+ if(mod!=null) func.addModifier((String)mod);
+ func.setHidden(func.hasModifier("private"));
+ RESULT = func;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(12/*func_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-7)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 105: // optional_opt ::=
+ {
+ Object RESULT = null;
+ RESULT=false;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(20/*optional_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 104: // optional_opt ::= QUESTION
+ {
+ Object RESULT = null;
+ RESULT=true;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(20/*optional_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 103: // var_decl ::= declare_opt NEW optional_opt lf_opt type_annotation_opt
+ {
+ Object RESULT = null;
+ int modleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int modright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object mod = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int optleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int optright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object opt = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ VariableDeclaration var = new VariableDeclaration((Token)name,name.toString(),(TypeReference)t, (Boolean)opt, false);
+ if(mod!=null) var.addModifier((String)mod);
+ var.setHidden(var.hasModifier("private"));
+ RESULT = var;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(10/*var_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 102: // var_decl ::= declare_opt INT optional_opt lf_opt type_annotation_opt
+ {
+ Object RESULT = null;
+ int modleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int modright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object mod = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int optleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int optright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object opt = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ VariableDeclaration var = new VariableDeclaration((Token)name,name.toString(),(TypeReference)t, (Boolean)opt, false);
+ if(mod!=null) var.addModifier((String)mod);
+ var.setHidden(var.hasModifier("private"));
+ RESULT = var;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(10/*var_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 101: // var_decl ::= declare_opt IDENTIFIER optional_opt lf_opt type_annotation_opt
+ {
+ Object RESULT = null;
+ int modleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int modright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object mod = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int optleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int optright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object opt = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ VariableDeclaration var = new VariableDeclaration((Token)name,name.toString(),(TypeReference)t, (Boolean)opt, false);
+ if(mod!=null) var.addModifier((String)mod);
+ var.setHidden(var.hasModifier("private"));
+ RESULT = var;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(10/*var_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 100: // var_decl ::= declare_opt var_or_const IDENTIFIER optional_opt lf_opt type_annotation_opt
+ {
+ Object RESULT = null;
+ int modleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int modright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object mod = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int readonlyleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int readonlyright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object readonly = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int optleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int optright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object opt = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ VariableDeclaration var = new VariableDeclaration((Token)name,name.toString(),(TypeReference)t, (Boolean)opt, (Boolean)readonly);
+ if(mod!=null) var.addModifier((String)mod);
+ var.setHidden(var.hasModifier("private"));
+ RESULT = var;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(10/*var_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 99: // var_or_const ::= CONST
+ {
+ Object RESULT = null;
+ RESULT = true;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(72/*var_or_const*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 98: // var_or_const ::= VAR
+ {
+ Object RESULT = null;
+ RESULT=false;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(72/*var_or_const*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 97: // module_decl ::= DECLARE_MODULE qual_id lf_opt LCPAREN declaration_list_opt RCPAREN
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int declarationsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int declarationsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object declarations = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+
+ RESULT = ModuleDeclaration.createQualifiedModuleDeclaration((Token)t,name.toString(),(Declaration[])declarations);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(11/*module_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 96: // module_decl ::= declare_opt IDENTIFIER qual_id lf_opt LCPAREN declaration_list_opt RCPAREN
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int declarationsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int declarationsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object declarations = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+
+ if(!(t.toString().equals("module")||t.toString().equals("namespace"))) {
+ parser.syntax_error((Token)t);
+ }
+ RESULT = ModuleDeclaration.createQualifiedModuleDeclaration((Token)t,name.toString(),(Declaration[])declarations);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(11/*module_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 95: // member_elt_nodoc ::= constructor_decl
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(26/*member_elt_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 94: // member_elt_nodoc ::= index_sig_decl
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(26/*member_elt_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 93: // member_elt_nodoc ::= func_decl
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(26/*member_elt_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 92: // member_elt_nodoc ::= var_decl
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(26/*member_elt_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 91: // doc_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(69/*doc_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 90: // doc_opt ::= DOC
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(69/*doc_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 89: // doc_list_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(68/*doc_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 88: // doc_list_opt ::= doc_list
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=l;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(68/*doc_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 87: // doc_list ::= DOC lf_opt
+ {
+ Object RESULT = null;
+ int docleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int docright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object doc = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT=doc;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(67/*doc_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 86: // doc_list ::= DOC lf_opt doc_list
+ {
+ Object RESULT = null;
+ int docleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int docright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object doc = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ RESULT=doc;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(67/*doc_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 85: // member_elt ::= DOC
+ {
+ Object RESULT = null;
+ int docleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int docright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object doc = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT=doc;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(25/*member_elt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 84: // member_elt ::= member_elt_nodoc
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT=d;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(25/*member_elt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 83: // member_elt_with_error ::= error
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(24/*member_elt_with_error*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 82: // member_elt_with_error ::= member_elt
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(24/*member_elt_with_error*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 81: // member_list ::= member_elt_with_error
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ if(d instanceof Declaration) {
+ parser.comments.push(new Token[] { null });
+ RESULT = new Declaration[] { (Declaration)d };
+ } else {
+ parser.comments.push(new Token[] { (Token)d });
+ RESULT = new Declaration[0];
+ }
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(23/*member_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 80: // member_list ::= member_list semi_or_comma_or_lf member_elt_with_error
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ if(d instanceof Declaration) {
+ Declaration[] list = (Declaration[])l;
+ Token doc = parser.comments.peek()[0];
+ if(doc!=null) {
+ ((Declaration)d).setDocumentation(doc.toString());
+ parser.comments.peek()[0]=null;
+ }
+ RESULT = ArrayUtils.add(list, (Declaration)d);
+ } else {
+ if(d instanceof Token) {
+ parser.comments.peek()[0] = (Token)d;
+ }
+ RESULT=l;
+ }
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(23/*member_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 79: // semi_or_comma_or_lf_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(65/*semi_or_comma_or_lf_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 78: // semi_or_comma_or_lf_opt ::= semi_or_comma_or_lf
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(65/*semi_or_comma_or_lf_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 77: // semi_or_comma_or_lf ::= lf
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(64/*semi_or_comma_or_lf*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 76: // semi_or_comma_or_lf ::= COMMA
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(64/*semi_or_comma_or_lf*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 75: // semi_or_comma_or_lf ::= COMMA lf
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(64/*semi_or_comma_or_lf*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 74: // semi_or_comma_or_lf ::= SEMI
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(64/*semi_or_comma_or_lf*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 73: // semi_or_comma_or_lf ::= SEMI lf
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(64/*semi_or_comma_or_lf*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 72: // semi_or_lf_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(62/*semi_or_lf_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 71: // semi_or_lf_opt ::= semi_or_lf
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(62/*semi_or_lf_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 70: // semi_or_lf ::= lf
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(61/*semi_or_lf*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 69: // semi_or_lf ::= SEMI
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(61/*semi_or_lf*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 68: // semi_or_lf ::= SEMI lf
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(61/*semi_or_lf*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 67: // lf_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(63/*lf_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 66: // lf_opt ::= lf
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(63/*lf_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 65: // lf ::= LF
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(60/*lf*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 64: // lf ::= lf LF
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(60/*lf*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 63: // member_list_opt ::= lf_opt
+ {
+ Object RESULT = null;
+ RESULT = new Declaration[0];
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(22/*member_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 62: // member_list_opt ::= lf_opt member_list semi_or_comma_or_lf_opt
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+
+ parser.comments.pop();
+ RESULT = l;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(22/*member_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 61: // type_list ::= type
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT=new TypeReference[] { (TypeReference)t };
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(66/*type_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 60: // type_list ::= type_list COMMA lf_opt type
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ TypeReference[] list = (TypeReference[])l;
+ RESULT = ArrayUtils.add(list, (TypeReference)t);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(66/*type_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 59: // implements_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(59/*implements_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 58: // implements_opt ::= IMPLEMENTS lf_opt type_list
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT = t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(59/*implements_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 57: // extends_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(58/*extends_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 56: // extends_opt ::= EXTENDS type_list
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT = t;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(58/*extends_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 55: // type_kind ::= CLASS
+ {
+ Object RESULT = null;
+ int defleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int defright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object def = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=def;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(9/*type_kind*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 54: // type_kind ::= INTERFACE
+ {
+ Object RESULT = null;
+ int defleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int defright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object def = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=def;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(9/*type_kind*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 53: // literal ::= INT
+ {
+ Object RESULT = null;
+ int ileft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int iright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object i = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=i;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(70/*literal*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 52: // enum_member_elt_nodoc ::= IDENTIFIER ASSIGN literal
+ {
+ Object RESULT = null;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int valueleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int valueright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object value = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ Literal literal = new Literal((Token)value, value.toString());
+ VariableDeclaration var = new VariableDeclaration((Token)name, name.toString(), null, false, true);
+ var.setInitializer(literal);
+ RESULT = var;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(32/*enum_member_elt_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 51: // enum_member_elt_nodoc ::= IDENTIFIER
+ {
+ Object RESULT = null;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT = new VariableDeclaration((Token)name, name.toString(), null, false, true);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(32/*enum_member_elt_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 50: // enum_member_elt ::= enum_member_elt_nodoc
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT=d;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(31/*enum_member_elt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 49: // enum_member_elt ::= doc_list lf_opt enum_member_elt_nodoc
+ {
+ Object RESULT = null;
+ int docleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int docright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object doc = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ if(d!=null) {
+ Declaration decl = (Declaration)d;
+ decl.setDocumentation(doc.toString());
+ RESULT=d;
+ }
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(31/*enum_member_elt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 48: // enum_member_elt_with_error ::= error
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(30/*enum_member_elt_with_error*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 47: // enum_member_elt_with_error ::= enum_member_elt
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(30/*enum_member_elt_with_error*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 46: // enum_member_list ::= enum_member_list COMMA lf_opt doc_list lf_opt
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+
+ RESULT=l;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(28/*enum_member_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 45: // enum_member_list ::= enum_member_list lf_opt doc_list lf_opt
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+
+ RESULT=l;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(28/*enum_member_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 44: // enum_member_list ::= enum_member_list COMMA lf_opt
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+
+ RESULT=l;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(28/*enum_member_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 43: // enum_member_list ::= enum_member_elt_with_error
+ {
+ Object RESULT = null;
+ int eleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int eright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object e = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ if(e!=null) {
+ RESULT=new Declaration[] { (Declaration)e };
+ } else {
+ RESULT=new Declaration[0];
+ }
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(28/*enum_member_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 42: // enum_member_list ::= enum_member_list COMMA lf_opt enum_member_elt_with_error
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int eleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int eright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object e = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ if(e!=null) {
+ Declaration[] list = (Declaration[])l;
+ RESULT = ArrayUtils.add(list, (Declaration)e);
+ } else {
+ RESULT=l;
+ }
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(28/*enum_member_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 41: // enum_member_list_opt ::= lf_opt
+ {
+ Object RESULT = null;
+ RESULT = new Declaration[0];
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(29/*enum_member_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 40: // enum_member_list_opt ::= lf_opt enum_member_list lf_opt
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT = l;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(29/*enum_member_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 39: // enum_decl ::= declare_opt const_opt ENUM IDENTIFIER type_param_list_opt lf_opt LCPAREN enum_member_list_opt RCPAREN
+ {
+ Object RESULT = null;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int membersleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int membersright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object members = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+
+ RESULT = new TypeDeclaration((Token)name,"enum",name.toString(),(TypeParameterDeclaration[])tparams,null,(Declaration[])members);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(27/*enum_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-8)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 38: // enum_decl ::= declare_opt DECLARE_ENUM IDENTIFIER type_param_list_opt lf_opt LCPAREN enum_member_list_opt RCPAREN
+ {
+ Object RESULT = null;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int membersleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int membersright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object members = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+
+ RESULT = new TypeDeclaration((Token)name,"enum",name.toString(),(TypeParameterDeclaration[])tparams,null,(Declaration[])members);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(27/*enum_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-7)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 37: // abstract_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(73/*abstract_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 36: // abstract_opt ::= ABSTRACT
+ {
+ Object RESULT = null;
+ RESULT = "abstract";
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(73/*abstract_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 35: // const_opt ::=
+ {
+ Object RESULT = null;
+ RESULT = false;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(49/*const_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 34: // const_opt ::= CONST
+ {
+ Object RESULT = null;
+ RESULT = true;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(49/*const_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 33: // type_decl ::= declare_opt DECLARE_CLASS IDENTIFIER type_param_list_opt extends_opt implements_opt lf_opt LCPAREN member_list_opt RCPAREN
+ {
+ Object RESULT = null;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-7)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-7)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-7)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int t2left = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int t2right = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object t2 = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int membersleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int membersright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object members = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+
+ RESULT = new TypeDeclaration((Token)name,"class",name.toString(),(TypeParameterDeclaration[])tparams,t==null?(TypeReference[])t2:ArrayUtils.addAll((TypeReference[])t,(TypeReference[])t2),(Declaration[])members);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(8/*type_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-9)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 32: // type_decl ::= declare_opt abstract_opt type_kind IDENTIFIER type_param_list_opt extends_opt implements_opt lf_opt LCPAREN member_list_opt RCPAREN
+ {
+ Object RESULT = null;
+ int defleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-8)).left;
+ int defright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-8)).right;
+ Object def = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-8)).value;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-7)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-7)).right;
+ Object name = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-7)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-6)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int t2left = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int t2right = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object t2 = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int membersleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int membersright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object members = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+
+ RESULT = new TypeDeclaration((Token)name,def.toString(),name.toString(),(TypeParameterDeclaration[])tparams,t==null?(TypeReference[])t2:ArrayUtils.addAll((TypeReference[])t,(TypeReference[])t2),(Declaration[])members);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(8/*type_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-10)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 31: // type_macro ::= EXPORT TYPE_MACRO IDENTIFIER type_param_list_opt ASSIGN type
+ {
+ Object RESULT = null;
+ int aliasleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int aliasright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object alias = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int typeleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int typeright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object type = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT = new TypeMacroDeclaration((Token)alias, alias.toString(), (TypeParameterDeclaration[])tparams, (TypeReference)type);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(7/*type_macro*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 30: // type_macro ::= TYPE_MACRO IDENTIFIER type_param_list_opt ASSIGN lf_opt type
+ {
+ Object RESULT = null;
+ int aliasleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left;
+ int aliasright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).right;
+ Object alias = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).value;
+ int tparamsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int tparamsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object tparams = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int typeleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int typeright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object type = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT = new TypeMacroDeclaration((Token)alias, alias.toString(), (TypeParameterDeclaration[])tparams, (TypeReference)type);
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(7/*type_macro*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 29: // import_spec ::= IDENTIFIER ASSIGN IDENTIFIER LPAREN qual_id RPAREN
+ {
+ Object RESULT = null;
+ int aliasleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left;
+ int aliasright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).right;
+ Object alias = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).value;
+ int requireleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int requireright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object require = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int importedleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int importedright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object imported = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+
+ if(!"require".equals(require.toString())) {
+ parser.syntax_error((Token)require);
+ } else {
+ RESULT = new ReferenceDeclaration((Token)alias, alias.toString(), imported.toString());
+ }
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(51/*import_spec*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-5)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 28: // import_spec ::= IDENTIFIER ASSIGN qual_id
+ {
+ Object RESULT = null;
+ int aliasleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int aliasright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object alias = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int importedleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int importedright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object imported = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT = new ReferenceDeclaration((Token)alias, alias.toString(), imported.toString());
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(51/*import_spec*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 27: // import_spec ::= MULT AS IDENTIFIER FROM qual_id
+ {
+ Object RESULT = null;
+ int aliasleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int aliasright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object alias = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int importedleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int importedright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object imported = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT = new ReferenceDeclaration((Token)alias, alias.toString(), imported.toString());
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(51/*import_spec*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 26: // import_decl ::= export_opt IMPORT import_spec
+ {
+ Object RESULT = null;
+ int sleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int sright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object s = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT = s;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(16/*import_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 25: // export_opt ::=
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(71/*export_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 24: // export_opt ::= EXPORT
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(71/*export_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 23: // export_element ::= IDENTIFIER AS IDENTIFIER
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(75/*export_element*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 22: // export_element ::= IDENTIFIER
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(75/*export_element*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 21: // export_element_list ::= export_element
+ {
+ Object RESULT = null;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(74/*export_element_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 20: // export_element_list ::= export_element_list COMMA lf_opt export_element
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).value;
+ int tleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int tright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object t = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(74/*export_element_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 19: // export_decl ::= EXPORT LCPAREN export_element_list RCPAREN lf_opt
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(15/*export_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-4)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 18: // export_decl ::= EXPORT ASSIGN IDENTIFIER lf_opt
+ {
+ Object RESULT = null;
+ int exportedIdentifierleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int exportedIdentifierright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object exportedIdentifier = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+
+ RESULT = new ReferenceDeclaration((Token)exportedIdentifier, null, exportedIdentifier.toString());
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(15/*export_decl*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 17: // declaration_nodoc ::= import_decl
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(6/*declaration_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 16: // declaration_nodoc ::= export_decl
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(6/*declaration_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 15: // declaration_nodoc ::= func_decl
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(6/*declaration_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 14: // declaration_nodoc ::= var_decl
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(6/*declaration_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 13: // declaration_nodoc ::= module_decl
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(6/*declaration_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 12: // declaration_nodoc ::= enum_decl
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(6/*declaration_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 11: // declaration_nodoc ::= type_decl
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(6/*declaration_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 10: // declaration_nodoc ::= type_macro
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(6/*declaration_nodoc*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 9: // declaration ::= DOC
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ RESULT=d;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(5/*declaration*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 8: // declaration ::= declaration_nodoc
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(5/*declaration*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 7: // declaration_with_error ::= error
+ {
+ Object RESULT = null;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(4/*declaration_with_error*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 6: // declaration_with_error ::= declaration
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ RESULT=d;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(4/*declaration_with_error*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 5: // declaration_list ::= declaration_with_error
+ {
+ Object RESULT = null;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ if(d instanceof Declaration) {
+ parser.comments.push(new Token[] { null });
+ RESULT = new Declaration[] { (Declaration)d };
+ } else {
+ parser.comments.push(new Token[] { (Token)d });
+ RESULT = new Declaration[0];
+ }
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(3/*declaration_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 4: // declaration_list ::= declaration_list semi_or_lf declaration_with_error
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).value;
+ int dleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int dright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object d = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+
+ if(d instanceof Declaration) {
+ Declaration[] list = (Declaration[])l;
+ Token doc = parser.comments.peek()[0];
+ if(doc!=null) {
+ ((Declaration)d).setDocumentation(doc.toString());
+ parser.comments.peek()[0]=null;
+ }
+ RESULT = ArrayUtils.add(list, (Declaration)d);
+ } else {
+ if(d instanceof Token) {
+ parser.comments.peek()[0] = (Token)d;
+ }
+ RESULT = l;
+ }
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(3/*declaration_list*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 3: // declaration_list_opt ::= lf_opt
+ {
+ Object RESULT = null;
+ RESULT = new Declaration[0];
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(2/*declaration_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 2: // declaration_list_opt ::= lf_opt declaration_list semi_or_lf_opt
+ {
+ Object RESULT = null;
+ int lleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object l = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+
+ parser.comments.pop();
+ RESULT = l;
+
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(2/*declaration_list_opt*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 1: // comp_unit ::= declaration_list_opt
+ {
+ Object RESULT = null;
+ int declsleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left;
+ int declsright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right;
+ Object decls = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).value;
+ parser.compilationUnit.setDeclarations((Declaration[])decls);
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(1/*comp_unit*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ return CUP$TypescriptDefParser$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 0: // $START ::= comp_unit EOF
+ {
+ Object RESULT = null;
+ int start_valleft = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left;
+ int start_valright = ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).right;
+ Object start_val = (Object)((java_cup.runtime.Symbol) CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).value;
+ RESULT = start_val;
+ CUP$TypescriptDefParser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TypescriptDefParser$stack.elementAt(CUP$TypescriptDefParser$top-0)).right, RESULT);
+ }
+ /* ACCEPT */
+ CUP$TypescriptDefParser$parser.done_parsing();
+ return CUP$TypescriptDefParser$result;
+
+ /* . . . . . .*/
+ default:
+ throw new Exception(
+ "Invalid action number found in internal parse table");
+
+ }
+ }
+}
+
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/TypescriptDefScanner.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/TypescriptDefScanner.java
new file mode 100644
index 00000000..cf7da73f
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/TypescriptDefScanner.java
@@ -0,0 +1,1329 @@
+/* The following code was generated by JFlex 1.3.5 on 7/24/16 4:44 PM */
+
+
+/*
+ * This source code file is the exclusive property of its author. No copy or
+ * usage of the source code is permitted unless the author contractually
+ * allows it under the terms of a well-defined agreement.
+ */
+
+package org.jsweet.input.typescriptdef.parser;
+
+import java_cup.runtime.*;
+import org.jsweet.input.typescriptdef.ast.Token;
+import java.util.*;
+
+
+/**
+ * This class is a scanner generated by
+ * JFlex 1.3.5
+ * on 7/24/16 4:44 PM from the specification file
+ * file:/Users/renaudpawlak/Documents/workspace/jsweet-def-translators/src/org/jsweet/input/typescriptdef/parser/typescriptdef.lex
+ */
+@SuppressWarnings("all")
+class TypescriptDefScanner implements java_cup.runtime.Scanner {
+
+ /** This character denotes the end of file */
+ final public static int YYEOF = -1;
+
+ /** initial size of the lookahead buffer */
+ final private static int YY_BUFFERSIZE = 16384;
+
+ /** lexical states */
+ final public static int EOL_COMMENT = 4;
+ final public static int STRING = 1;
+ final public static int YYINITIAL = 0;
+ final public static int TYPE_MACRO = 3;
+ final public static int CHAR = 2;
+
+ /**
+ * Translates characters to character classes
+ */
+ final private static String yycmap_packed =
+ "\11\0\1\3\1\2\1\0\1\3\1\1\22\0\1\3\1\61\1\5"+
+ "\1\0\1\14\1\0\1\65\1\23\1\11\1\10\1\7\1\20\1\60"+
+ "\1\21\1\22\1\6\1\15\11\16\1\53\1\54\1\57\1\12\1\13"+
+ "\1\64\1\66\6\17\21\14\1\52\2\14\1\24\1\4\1\56\1\0"+
+ "\1\14\1\0\1\33\1\47\1\34\1\37\1\30\1\32\2\14\1\25"+
+ "\2\14\1\35\1\40\1\26\1\41\1\43\1\14\1\31\1\36\1\27"+
+ "\1\42\1\46\1\51\1\45\1\44\1\14\1\50\1\63\1\55\1\62"+
+ "\ufe80\0\1\67\u0100\0";
+
+ /**
+ * Translates characters to character classes
+ */
+ final private static char [] yycmap = yy_unpack_cmap(yycmap_packed);
+
+ /**
+ * Translates a state to a row index in the transition table
+ */
+ final private static int yy_rowMap [] = {
+ 0, 56, 112, 168, 224, 280, 336, 392, 280, 280,
+ 448, 280, 504, 560, 616, 672, 728, 784, 840, 896,
+ 952, 1008, 280, 1064, 1120, 1176, 1232, 1288, 1344, 1400,
+ 1456, 1512, 1568, 1624, 1680, 1736, 1792, 280, 280, 280,
+ 280, 280, 1848, 280, 1904, 280, 1960, 280, 2016, 280,
+ 2072, 2128, 280, 2184, 2240, 2296, 2352, 2408, 2464, 2520,
+ 2576, 280, 392, 2632, 2688, 2744, 2800, 280, 2856, 504,
+ 2912, 560, 2968, 3024, 280, 280, 280, 3080, 280, 3136,
+ 280, 280, 3192, 1064, 280, 3248, 3304, 3360, 3416, 3472,
+ 3528, 3584, 3640, 3696, 3752, 3808, 3864, 3920, 3976, 4032,
+ 4088, 4144, 4200, 4256, 4312, 280, 280, 4368, 280, 4424,
+ 280, 280, 280, 280, 280, 280, 280, 280, 4480, 4536,
+ 4592, 4648, 4704, 4760, 4816, 4872, 4928, 280, 4984, 5040,
+ 3080, 280, 5096, 5152, 5208, 728, 5264, 5320, 5376, 5432,
+ 5488, 5544, 5600, 5656, 5712, 5768, 5824, 5880, 5936, 5992,
+ 6048, 6104, 6160, 6216, 6272, 6328, 6384, 6440, 6496, 6552,
+ 6608, 6664, 6720, 6776, 6832, 280, 6888, 6944, 280, 7000,
+ 7056, 7112, 7168, 7224, 7280, 7336, 7392, 7448, 280, 7504,
+ 7560, 7616, 7672, 7728, 7784, 7840, 7896, 7952, 8008, 280,
+ 8064, 8120, 8176, 8232, 8288, 280, 8344, 6776, 8400, 8456,
+ 8512, 8568, 8624, 8680, 8736, 8792, 8848, 8904, 8960, 9016,
+ 9072, 9128, 9184, 280, 9240, 9296, 9352, 9408, 9464, 9520,
+ 9576, 9632, 9688, 9744, 280, 9800, 9856, 9912, 9968, 10024,
+ 10080, 280, 10136, 10192, 10248, 280, 10304, 10360, 10416, 10472,
+ 10528, 10584, 10640, 10696, 10752, 10808, 280, 10864, 10920, 10976,
+ 11032, 11088, 280, 11144, 11200, 11256, 11312, 280, 11368, 11424,
+ 11480, 280, 280, 11536, 11592, 11648, 11704, 11760, 11816, 11872,
+ 280, 11928, 11984, 280, 12040, 12096, 12152, 280, 12208, 12264,
+ 12320, 12376, 12432, 12488, 12544, 12600, 12656, 280, 12712, 12768,
+ 12824, 12880, 12936, 12992, 13048, 13104, 13160, 13216, 13272, 13328,
+ 280, 13104, 13160, 13216, 13272, 13328, 13384, 13440, 13496, 13552,
+ 13608, 280, 13664, 13720, 13776, 13832, 13888, 280, 280, 13944,
+ 14000, 14056, 14112, 14168, 14224, 14280, 14336, 14392, 14448, 14504,
+ 280, 14560, 14616, 14672, 14728, 14784, 14840, 14896, 14952, 728,
+ 15008, 15064, 15120, 280, 280, 15176, 280, 15232, 15288, 15344,
+ 15400, 15456, 728, 15512, 15568, 15624, 280, 15680, 15736, 15792,
+ 728, 15848, 15904, 280, 15960, 16016, 16072, 16128, 728, 280
+ };
+
+ /**
+ * The packed transition table of the DFA (part 0)
+ */
+ final private static String yy_packed0 =
+ "\1\6\1\7\1\10\1\11\1\6\1\12\1\13\1\14"+
+ "\1\15\1\16\1\17\1\20\1\21\1\22\1\23\1\21"+
+ "\1\24\1\25\1\26\1\27\1\30\1\31\1\32\1\33"+
+ "\1\34\1\35\1\36\1\37\1\40\1\41\1\42\1\43"+
+ "\3\21\1\44\2\21\1\45\1\21\1\46\2\21\1\47"+
+ "\1\50\1\51\1\52\1\53\1\54\1\55\1\56\1\57"+
+ "\1\60\1\61\1\62\1\11\1\63\2\6\1\63\1\64"+
+ "\1\65\62\63\1\66\2\6\1\66\1\67\16\66\1\65"+
+ "\44\66\1\6\2\70\1\71\23\6\1\72\1\73\6\6"+
+ "\1\74\30\6\1\11\1\75\1\76\65\11\72\0\1\10"+
+ "\1\77\23\0\1\100\1\101\6\0\1\102\13\0\1\47"+
+ "\7\0\1\103\7\0\1\77\23\0\1\100\1\101\6\0"+
+ "\1\102\13\0\1\47\7\0\1\103\12\0\1\104\1\105"+
+ "\63\0\1\106\6\0\1\107\55\0\10\110\1\111\1\112"+
+ "\56\110\12\0\1\113\1\114\66\0\1\115\71\0\4\21"+
+ "\5\0\23\21\1\0\2\21\31\0\4\21\5\0\20\21"+
+ "\1\116\2\21\1\0\1\21\1\116\31\0\1\21\2\23"+
+ "\1\21\5\0\23\21\1\0\2\21\32\0\1\117\1\120"+
+ "\1\0\1\121\64\0\1\117\1\120\2\0\1\122\70\0"+
+ "\1\123\50\0\1\124\52\0\1\125\25\0\4\21\5\0"+
+ "\1\21\1\126\7\21\1\127\1\21\1\130\7\21\1\0"+
+ "\2\21\31\0\4\21\5\0\3\21\1\131\17\21\1\0"+
+ "\2\21\31\0\4\21\5\0\17\21\1\132\3\21\1\0"+
+ "\2\21\31\0\4\21\5\0\1\21\1\133\16\21\1\134"+
+ "\2\21\1\0\2\21\31\0\4\21\5\0\3\21\1\135"+
+ "\17\21\1\0\2\21\31\0\4\21\5\0\4\21\1\136"+
+ "\10\21\1\137\5\21\1\0\2\21\31\0\4\21\5\0"+
+ "\11\21\1\140\10\21\1\141\1\0\2\21\31\0\4\21"+
+ "\5\0\10\21\1\142\3\21\1\143\6\21\1\0\2\21"+
+ "\31\0\4\21\5\0\3\21\1\144\17\21\1\0\2\21"+
+ "\31\0\4\21\5\0\2\21\1\145\20\21\1\0\2\21"+
+ "\31\0\4\21\5\0\3\21\1\146\17\21\1\0\2\21"+
+ "\31\0\4\21\5\0\4\21\1\147\10\21\1\150\5\21"+
+ "\1\0\2\21\31\0\4\21\5\0\6\21\1\151\14\21"+
+ "\1\0\2\21\27\0\1\152\67\0\1\153\56\0\1\154"+
+ "\1\155\1\156\57\0\1\157\71\0\1\160\2\0\1\63"+
+ "\2\0\1\63\2\0\62\63\4\0\1\161\1\162\20\0"+
+ "\1\163\1\164\1\0\1\165\36\0\1\66\2\0\1\66"+
+ "\1\0\16\66\1\0\44\66\4\0\1\161\16\0\1\166"+
+ "\2\0\1\163\1\164\1\0\1\165\37\0\3\70\2\0"+
+ "\1\167\64\0\1\71\130\0\1\170\70\0\1\171\52\0"+
+ "\1\172\41\0\1\76\131\0\1\173\70\0\1\174\52\0"+
+ "\1\175\40\0\1\154\1\155\1\103\64\0\7\176\1\177"+
+ "\60\176\13\0\1\200\57\0\1\111\6\0\1\201\55\0"+
+ "\10\112\1\110\1\202\56\112\14\0\1\21\3\203\5\0"+
+ "\3\21\1\203\1\21\3\203\2\21\1\203\7\21\1\203"+
+ "\1\0\2\21\32\0\2\120\73\0\1\204\61\0\4\21"+
+ "\5\0\2\21\1\205\20\21\1\0\2\21\20\0\1\206"+
+ "\10\0\4\21\5\0\23\21\1\0\2\21\31\0\4\21"+
+ "\5\0\16\21\1\207\4\21\1\0\2\21\31\0\4\21"+
+ "\5\0\23\21\1\0\1\210\1\21\31\0\4\21\5\0"+
+ "\16\21\1\211\4\21\1\0\2\21\31\0\4\21\5\0"+
+ "\15\21\1\212\5\21\1\0\2\21\31\0\4\21\5\0"+
+ "\2\21\1\213\13\21\1\214\4\21\1\0\2\21\31\0"+
+ "\4\21\5\0\6\21\1\215\14\21\1\0\2\21\31\0"+
+ "\4\21\5\0\14\21\1\216\6\21\1\0\2\21\31\0"+
+ "\4\21\5\0\1\21\1\217\21\21\1\0\2\21\20\0"+
+ "\1\220\10\0\4\21\5\0\23\21\1\0\2\21\31\0"+
+ "\4\21\5\0\11\21\1\221\11\21\1\0\2\21\31\0"+
+ "\4\21\5\0\6\21\1\222\14\21\1\0\2\21\31\0"+
+ "\4\21\5\0\1\21\1\223\21\21\1\0\2\21\31\0"+
+ "\4\21\5\0\2\21\1\224\20\21\1\0\2\21\31\0"+
+ "\4\21\5\0\6\21\1\225\14\21\1\0\2\21\31\0"+
+ "\4\21\5\0\7\21\1\226\13\21\1\0\2\21\31\0"+
+ "\4\21\5\0\1\227\13\21\1\230\6\21\1\0\2\21"+
+ "\31\0\4\21\5\0\22\21\1\231\1\0\2\21\31\0"+
+ "\4\21\5\0\4\21\1\224\16\21\1\0\2\21\17\0"+
+ "\1\155\66\0\1\154\1\155\1\156\72\0\1\232\1\233"+
+ "\123\0\1\234\67\0\1\235\60\0\1\236\76\0\1\237"+
+ "\67\0\1\240\60\0\1\241\33\0\7\176\1\242\60\176"+
+ "\6\243\1\244\1\245\60\243\13\0\1\246\54\0\10\202"+
+ "\1\112\1\247\56\202\14\0\4\21\5\0\3\21\1\250"+
+ "\17\21\1\0\2\21\20\0\1\206\1\0\2\251\5\0"+
+ "\4\251\3\0\1\251\1\0\23\251\1\0\2\251\31\0"+
+ "\4\21\5\0\10\21\1\252\3\21\1\253\6\21\1\0"+
+ "\2\21\31\0\4\21\5\0\3\21\1\254\17\21\1\0"+
+ "\2\21\31\0\4\21\5\0\13\21\1\255\7\21\1\0"+
+ "\2\21\31\0\4\21\5\0\3\21\1\256\17\21\1\0"+
+ "\2\21\31\0\4\21\5\0\14\21\1\257\6\21\1\0"+
+ "\2\21\31\0\4\21\5\0\12\21\1\260\10\21\1\0"+
+ "\2\21\31\0\4\21\5\0\13\21\1\261\7\21\1\0"+
+ "\2\21\31\0\4\21\5\0\7\21\1\262\13\21\1\0"+
+ "\2\21\20\0\1\220\1\0\2\263\5\0\4\263\3\0"+
+ "\1\263\1\0\23\263\1\0\2\263\31\0\4\21\5\0"+
+ "\2\21\1\264\20\21\1\0\2\21\31\0\4\21\5\0"+
+ "\11\21\1\265\11\21\1\0\2\21\31\0\4\21\5\0"+
+ "\11\21\1\266\11\21\1\0\2\21\20\0\1\267\10\0"+
+ "\4\21\5\0\23\21\1\0\2\21\31\0\4\21\5\0"+
+ "\2\21\1\270\20\21\1\0\2\21\31\0\4\21\5\0"+
+ "\10\21\1\271\12\21\1\0\2\21\31\0\4\21\5\0"+
+ "\21\21\1\272\1\21\1\0\2\21\31\0\4\21\5\0"+
+ "\2\21\1\273\20\21\1\0\2\21\31\0\4\21\5\0"+
+ "\10\21\1\274\12\21\1\0\2\21\15\0\1\232\2\70"+
+ "\65\232\7\233\1\275\60\233\30\0\1\276\100\0\1\277"+
+ "\63\0\1\300\62\0\1\301\100\0\1\302\63\0\1\303"+
+ "\32\0\6\176\1\304\1\242\60\176\7\243\1\305\60\243"+
+ "\7\306\1\307\60\306\6\310\1\304\1\245\60\310\10\247"+
+ "\1\202\1\0\56\247\14\0\4\21\5\0\4\21\1\311"+
+ "\16\21\1\0\2\21\31\0\4\21\5\0\3\21\1\312"+
+ "\17\21\1\0\2\21\31\0\4\21\5\0\4\21\1\313"+
+ "\16\21\1\0\2\21\31\0\4\21\5\0\14\21\1\314"+
+ "\6\21\1\0\2\21\20\0\1\315\10\0\4\21\5\0"+
+ "\23\21\1\0\2\21\31\0\4\21\5\0\1\21\1\316"+
+ "\21\21\1\0\2\21\31\0\4\21\5\0\4\21\1\317"+
+ "\16\21\1\0\2\21\31\0\4\21\5\0\14\21\1\320"+
+ "\6\21\1\0\2\21\20\0\1\321\10\0\4\21\5\0"+
+ "\23\21\1\0\2\21\31\0\4\21\5\0\2\21\1\322"+
+ "\20\21\1\0\2\21\31\0\4\21\5\0\4\21\1\323"+
+ "\16\21\1\0\2\21\31\0\4\21\5\0\11\21\1\324"+
+ "\11\21\1\0\2\21\31\0\4\21\5\0\2\21\1\325"+
+ "\20\21\1\0\2\21\20\0\1\267\1\0\2\326\5\0"+
+ "\4\326\3\0\1\326\1\0\23\326\1\0\2\326\31\0"+
+ "\4\21\5\0\1\327\22\21\1\0\2\21\31\0\4\21"+
+ "\5\0\6\21\1\330\14\21\1\0\2\21\31\0\4\21"+
+ "\5\0\6\21\1\331\14\21\1\0\2\21\31\0\4\21"+
+ "\5\0\3\21\1\332\17\21\1\0\2\21\31\0\4\21"+
+ "\5\0\1\333\22\21\1\0\2\21\15\0\6\233\1\70"+
+ "\1\275\60\233\31\0\1\334\71\0\1\335\37\0\1\336"+
+ "\115\0\1\337\71\0\1\340\34\0\6\310\1\341\1\245"+
+ "\60\310\6\342\1\341\1\343\60\342\7\243\1\245\60\243"+
+ "\14\0\4\21\5\0\5\21\1\344\15\21\1\0\2\21"+
+ "\31\0\4\21\5\0\13\21\1\345\7\21\1\0\2\21"+
+ "\31\0\4\21\5\0\2\21\1\346\20\21\1\0\2\21"+
+ "\31\0\4\21\5\0\5\21\1\347\15\21\1\0\2\21"+
+ "\20\0\1\315\1\0\2\350\5\0\4\350\3\0\1\350"+
+ "\1\0\23\350\1\0\2\350\31\0\4\21\5\0\12\21"+
+ "\1\351\10\21\1\0\2\21\31\0\4\21\5\0\2\21"+
+ "\1\352\20\21\1\0\2\21\31\0\4\21\5\0\1\21"+
+ "\1\353\21\21\1\0\2\21\20\0\1\321\1\0\2\354"+
+ "\5\0\4\354\3\0\1\354\1\0\23\354\1\0\2\354"+
+ "\31\0\4\21\5\0\1\355\22\21\1\0\2\21\31\0"+
+ "\4\21\5\0\6\21\1\356\14\21\1\0\2\21\20\0"+
+ "\1\357\10\0\4\21\5\0\23\21\1\0\2\21\20\0"+
+ "\1\360\10\0\4\21\5\0\23\21\1\0\2\21\31\0"+
+ "\4\21\5\0\7\21\1\361\13\21\1\0\2\21\31\0"+
+ "\4\21\5\0\4\21\1\362\16\21\1\0\2\21\31\0"+
+ "\4\21\5\0\2\21\1\363\20\21\1\0\2\21\31\0"+
+ "\4\21\5\0\7\21\1\364\13\21\1\0\2\21\31\0"+
+ "\4\21\5\0\7\21\1\365\13\21\1\0\2\21\44\0"+
+ "\1\11\71\0\1\366\41\0\1\336\1\0\2\367\5\0"+
+ "\4\367\3\0\1\367\1\0\23\367\1\0\2\367\44\0"+
+ "\1\370\71\0\1\371\36\0\7\306\1\343\60\306\6\342"+
+ "\1\0\1\343\60\342\14\0\4\21\5\0\6\21\1\372"+
+ "\14\21\1\0\2\21\31\0\4\21\5\0\3\21\1\373"+
+ "\17\21\1\0\2\21\20\0\1\374\3\0\1\375\4\0"+
+ "\4\21\5\0\23\21\1\0\2\21\20\0\1\376\10\0"+
+ "\4\21\5\0\23\21\1\0\2\21\31\0\4\21\5\0"+
+ "\11\21\1\377\11\21\1\0\2\21\16\0\2\u0100\1\u0101"+
+ "\6\0\1\u0102\1\0\4\21\5\0\23\21\1\u0102\2\21"+
+ "\31\0\4\21\5\0\10\21\1\u0103\12\21\1\0\2\21"+
+ "\31\0\4\21\5\0\14\21\1\u0104\6\21\1\0\2\21"+
+ "\31\0\4\21\5\0\7\21\1\u0105\13\21\1\0\2\21"+
+ "\20\0\1\357\1\0\2\u0106\5\0\4\u0106\3\0\1\u0106"+
+ "\1\0\23\u0106\1\0\2\u0106\20\0\1\360\1\0\2\u0107"+
+ "\5\0\4\u0107\3\0\1\u0107\1\0\23\u0107\1\0\2\u0107"+
+ "\20\0\1\u0108\10\0\4\21\5\0\23\21\1\0\2\21"+
+ "\31\0\4\21\5\0\3\21\1\u0109\17\21\1\0\2\21"+
+ "\31\0\4\21\5\0\3\21\1\u010a\17\21\1\0\2\21"+
+ "\31\0\4\21\5\0\2\21\1\u010b\20\21\1\0\2\21"+
+ "\20\0\1\u010c\10\0\4\21\5\0\23\21\1\0\2\21"+
+ "\45\0\1\11\40\0\3\370\23\0\1\100\70\0\1\370"+
+ "\53\0\4\21\5\0\7\21\1\u010d\13\21\1\0\2\21"+
+ "\31\0\4\21\5\0\1\21\1\u010e\21\21\1\0\2\21"+
+ "\20\0\1\374\1\0\3\375\4\0\4\375\3\0\1\375"+
+ "\1\0\23\375\1\0\2\375\20\0\1\376\1\0\2\u010f"+
+ "\5\0\4\u010f\3\0\1\u010f\1\0\23\u010f\1\0\2\u010f"+
+ "\20\0\1\u0110\5\0\1\u0111\2\0\4\21\5\0\23\21"+
+ "\1\u0112\2\21\16\0\3\u0100\6\0\1\u0102\35\0\1\u0102"+
+ "\20\0\2\u0100\1\u0101\1\0\2\u0102\3\0\1\u0102\1\0"+
+ "\4\u0102\3\0\1\u0102\1\0\26\u0102\31\0\4\21\5\0"+
+ "\17\21\1\u0113\3\21\1\0\2\21\31\0\4\21\5\0"+
+ "\1\21\1\u0114\21\21\1\0\2\21\31\0\4\21\5\0"+
+ "\2\21\1\u0115\20\21\1\0\2\21\20\0\1\u0108\1\0"+
+ "\2\u0116\5\0\4\u0116\3\0\1\u0116\1\0\23\u0116\1\0"+
+ "\2\u0116\16\0\2\u0117\1\u0118\10\0\4\21\5\0\1\21"+
+ "\1\u0119\1\21\1\u011a\1\21\1\u011b\1\21\1\u011c\3\21"+
+ "\1\u011d\7\21\1\0\2\21\20\0\1\u011e\10\0\4\21"+
+ "\5\0\23\21\1\0\2\21\31\0\4\21\5\0\3\21"+
+ "\1\u011f\17\21\1\0\2\21\20\0\1\u010c\1\0\2\u0120"+
+ "\5\0\4\u0120\3\0\1\u0120\1\0\23\u0120\1\0\2\u0120"+
+ "\31\0\4\21\5\0\3\21\1\u0121\17\21\1\0\2\21"+
+ "\31\0\4\21\5\0\2\21\1\u0122\20\21\1\0\2\21"+
+ "\20\0\1\u0110\1\0\2\u0112\2\0\1\u0111\2\0\4\u0112"+
+ "\3\0\1\u0112\1\0\26\u0112\15\0\10\u0111\1\u0123\1\u0124"+
+ "\56\u0111\3\0\1\u0125\10\0\4\21\5\0\23\21\1\0"+
+ "\2\21\20\0\1\u0126\10\0\4\21\5\0\23\21\1\0"+
+ "\2\21\20\0\1\u0127\10\0\4\21\5\0\23\21\1\0"+
+ "\2\21\16\0\3\u0117\22\0\1\u0128\1\0\1\u0129\1\0"+
+ "\1\u012a\1\0\1\u012b\3\0\1\u012c\30\0\2\u0117\1\u0118"+
+ "\1\0\2\u012d\5\0\4\u012d\3\0\1\u012d\1\0\1\u012d"+
+ "\1\u012e\1\u012d\1\u012f\1\u012d\1\u0130\1\u012d\1\u0131\3\u012d"+
+ "\1\u0132\7\u012d\1\0\2\u012d\31\0\4\21\5\0\6\21"+
+ "\1\u0133\14\21\1\0\2\21\31\0\4\21\5\0\1\21"+
+ "\1\u0134\21\21\1\0\2\21\31\0\4\21\5\0\15\21"+
+ "\1\u0135\5\21\1\0\2\21\31\0\4\21\5\0\10\21"+
+ "\1\u0136\12\21\1\0\2\21\31\0\4\21\5\0\14\21"+
+ "\1\u0137\6\21\1\0\2\21\20\0\1\u011e\1\0\2\u0138"+
+ "\5\0\4\u0138\3\0\1\u0138\1\0\23\u0138\1\0\2\u0138"+
+ "\31\0\4\21\5\0\12\21\1\u0139\10\21\1\0\2\21"+
+ "\20\0\1\u013a\10\0\4\21\5\0\23\21\1\0\2\21"+
+ "\31\0\4\21\5\0\11\21\1\u013b\11\21\1\0\2\21"+
+ "\20\0\1\u0123\6\0\1\u013c\55\0\10\u0124\1\u0111\1\u013d"+
+ "\56\u0124\3\0\1\u0125\1\0\2\u0107\5\0\4\u0107\3\0"+
+ "\25\u0107\1\0\2\u0107\20\0\1\u0126\1\0\2\u013e\5\0"+
+ "\4\u013e\3\0\1\u013e\1\0\23\u013e\1\0\2\u013e\20\0"+
+ "\1\u0127\1\0\2\u013f\5\0\4\u013f\3\0\1\u013f\1\0"+
+ "\23\u013f\1\0\2\u013f\50\0\1\u0140\62\0\1\u0141\103\0"+
+ "\1\u0142\62\0\1\u0143\73\0\1\u0144\42\0\4\21\5\0"+
+ "\13\21\1\u0145\7\21\1\0\2\21\31\0\4\21\5\0"+
+ "\15\21\1\u0146\5\21\1\0\2\21\31\0\4\21\5\0"+
+ "\1\21\1\u0147\21\21\1\0\2\21\31\0\4\21\5\0"+
+ "\6\21\1\u0148\14\21\1\0\2\21\31\0\4\21\5\0"+
+ "\12\21\1\u0149\10\21\1\0\2\21\20\0\1\u014a\10\0"+
+ "\4\21\5\0\23\21\1\0\2\21\20\0\1\u013a\1\0"+
+ "\2\u014b\5\0\4\u014b\3\0\1\u014b\1\0\23\u014b\1\0"+
+ "\2\u014b\20\0\1\u014c\10\0\4\21\5\0\23\21\1\0"+
+ "\2\21\30\0\1\u0112\54\0\10\u013d\1\u0124\1\u014d\56\u013d"+
+ "\40\0\1\u014e\71\0\1\u014f\53\0\1\u0150\74\0\1\u0151"+
+ "\73\0\1\u0152\44\0\4\21\5\0\3\21\1\u0153\17\21"+
+ "\1\0\2\21\31\0\4\21\5\0\13\21\1\u0154\7\21"+
+ "\1\0\2\21\31\0\4\21\5\0\7\21\1\u0155\13\21"+
+ "\1\0\2\21\31\0\4\21\5\0\11\21\1\u0156\11\21"+
+ "\1\0\2\21\31\0\4\21\5\0\15\21\1\u0157\5\21"+
+ "\1\0\2\21\20\0\1\u014a\1\0\2\u0158\5\0\4\u0158"+
+ "\3\0\1\u0158\1\0\23\u0158\1\0\2\u0158\20\0\1\u014c"+
+ "\1\0\2\u0159\5\0\4\u0159\3\0\1\u0159\1\0\23\u0159"+
+ "\1\0\2\u0159\15\0\10\u014d\1\u013d\1\0\56\u014d\30\0"+
+ "\1\u015a\77\0\1\u015b\63\0\1\u015c\71\0\1\u015d\73\0"+
+ "\1\u015e\41\0\4\21\5\0\11\21\1\u015f\11\21\1\0"+
+ "\2\21\31\0\4\21\5\0\2\21\1\u0160\20\21\1\0"+
+ "\2\21\31\0\4\21\5\0\11\21\1\u0161\11\21\1\0"+
+ "\2\21\31\0\4\21\5\0\10\21\1\u0162\12\21\1\0"+
+ "\2\21\53\0\1\u0163\60\0\1\u0164\76\0\1\u0165\66\0"+
+ "\1\u0166\46\0\4\21\5\0\16\21\1\u0167\4\21\1\0"+
+ "\2\21\31\0\4\21\5\0\1\u0168\22\21\1\0\2\21"+
+ "\31\0\4\21\5\0\3\21\1\u0169\17\21\1\0\2\21"+
+ "\60\0\1\u016a\51\0\1\u016b\72\0\1\u016c\53\0\4\21"+
+ "\5\0\6\21\1\u016d\14\21\1\0\2\21\31\0\4\21"+
+ "\5\0\14\21\1\u016e\6\21\1\0\2\21\50\0\1\u016f"+
+ "\75\0\1\u0170\42\0\4\21\5\0\7\21\1\u0162\13\21"+
+ "\1\0\2\21\31\0\4\21\5\0\1\21\1\u0171\21\21"+
+ "\1\0\2\21\51\0\1\u0166\61\0\1\u0172\41\0";
+
+ /**
+ * The transition table of the DFA
+ */
+ final private static int yytrans [] = yy_unpack();
+
+
+ /* error codes */
+ final private static int YY_UNKNOWN_ERROR = 0;
+ final private static int YY_ILLEGAL_STATE = 1;
+ final private static int YY_NO_MATCH = 2;
+ final private static int YY_PUSHBACK_2BIG = 3;
+
+ /* error messages for the codes above */
+ final private static String YY_ERROR_MSG[] = {
+ "Unkown internal scanner error",
+ "Internal error: unknown state",
+ "Error: could not match input",
+ "Error: pushback value was too large"
+ };
+
+ /**
+ * YY_ATTRIBUTE[aState] contains the attributes of state aState
+ */
+ private final static byte YY_ATTRIBUTE[] = {
+ 1, 0, 0, 1, 0, 9, 1, 1, 9, 9, 1, 9, 3, 3, 1, 1,
+ 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 1, 9, 1, 9, 1, 9,
+ 1, 9, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 9, 0, 0,
+ 0, 0, 1, 9, 0, 0, 0, 0, 0, 0, 9, 9, 9, 1, 9, 1,
+ 9, 9, 1, 0, 9, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 1, 9, 0, 9, 9,
+ 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13,
+ 0, 0, 1, 9, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+ 1, 1, 1, 3, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 13, 0, 1, 13, 1, 1, 1, 3, 1, 1, 1,
+ 3, 1, 13, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 9, 0, 0,
+ 2, 0, 0, 9, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1,
+ 0, 1, 1, 3, 3, 13, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ 9, 0, 0, 1, 1, 3, 3, 13, 1, 3, 1, 13, 1, 1, 0, 0,
+ 3, 1, 1, 1, 3, 0, 13, 0, 0, 1, 1, 0, 13, 0, 3, 0,
+ 0, 13, 1, 1, 1, 13, 13, 0, 3, 3, 1, 0, 1, 1, 13, 0,
+ 0, 13, 3, 3, 3, 13, 0, 0, 1, 1, 1, 1, 1, 0, 1, 13,
+ 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 5, 5, 5,
+ 5, 5, 1, 1, 1, 1, 1, 13, 3, 0, 3, 0, 0, 13, 13, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 13, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 1, 1, 1, 13, 13, 0, 9, 0, 0, 0, 1, 1,
+ 1, 1, 0, 0, 9, 0, 1, 1, 1, 0, 0, 9, 1, 1, 0, 0,
+ 1, 9
+ };
+
+ /** the input device */
+ private java.io.Reader yy_reader;
+
+ /** the current state of the DFA */
+ private int yy_state;
+
+ /** the current lexical state */
+ private int yy_lexical_state = YYINITIAL;
+
+ /** this buffer contains the current text to be matched and is
+ the source of the yytext() string */
+ private char yy_buffer[] = new char[YY_BUFFERSIZE];
+
+ /** the textposition at the last accepting state */
+ private int yy_markedPos;
+
+ /** the textposition at the last state to be included in yytext */
+ private int yy_pushbackPos;
+
+ /** the current text position in the buffer */
+ private int yy_currentPos;
+
+ /** startRead marks the beginning of the yytext() string in the buffer */
+ private int yy_startRead;
+
+ /** endRead marks the last character in the buffer, that has been read
+ from input */
+ private int yy_endRead;
+
+ /** number of newlines encountered up to the start of the matched text */
+ private int yyline;
+
+ /** the number of characters up to the start of the matched text */
+ private int yychar;
+
+ /**
+ * the number of characters from the last newline up to the start of the
+ * matched text
+ */
+ private int yycolumn;
+
+ /**
+ * yy_atBOL == true <=> the scanner is currently at the beginning of a line
+ */
+ private boolean yy_atBOL = true;
+
+ /** yy_atEOF == true <=> the scanner is at the EOF */
+ private boolean yy_atEOF;
+
+ /** denotes if the user-EOF-code has already been executed */
+ private boolean yy_eof_done;
+
+ /* user code: */
+ StringBuffer string=new StringBuffer();
+ String fileName;
+ public void setFileName(String name) {
+ fileName=name;
+ }
+ public String getFileName() {
+ return fileName;
+ }
+ private Symbol symbol(int type) {
+ return new Symbol(type,yyline,yycolumn,
+ new Token(type,fileName,yytext(),
+ yyline+1,yycolumn+1,
+ yycolumn+1+yytext().length()));
+ }
+ private Symbol symbol(int type, String value) {
+ return new Symbol(type,yyline,yycolumn,
+ new Token(type,fileName,value,
+ yyline+1,yycolumn+1,
+ yycolumn+1+yytext().length()));
+ }
+ private Stack openParens = new Stack();
+
+
+ /**
+ * Creates a new scanner
+ * There is also a java.io.InputStream version of this constructor.
+ *
+ * @param in the java.io.Reader to read input from.
+ */
+ TypescriptDefScanner(java.io.Reader in) {
+ this.yy_reader = in;
+ }
+
+ /**
+ * Creates a new scanner.
+ * There is also java.io.Reader version of this constructor.
+ *
+ * @param in the java.io.Inputstream to read input from.
+ */
+ TypescriptDefScanner(java.io.InputStream in) {
+ this(new java.io.InputStreamReader(in));
+ }
+
+ /**
+ * Unpacks the split, compressed DFA transition table.
+ *
+ * @return the unpacked transition table
+ */
+ private static int [] yy_unpack() {
+ int [] trans = new int[16184];
+ int offset = 0;
+ offset = yy_unpack(yy_packed0, offset, trans);
+ return trans;
+ }
+
+ /**
+ * Unpacks the compressed DFA transition table.
+ *
+ * @param packed the packed transition table
+ * @return the index of the last entry
+ */
+ private static int yy_unpack(String packed, int offset, int [] trans) {
+ int i = 0; /* index in packed string */
+ int j = offset; /* index in unpacked array */
+ int l = packed.length();
+ while (i < l) {
+ int count = packed.charAt(i++);
+ int value = packed.charAt(i++);
+ value--;
+ do trans[j++] = value; while (--count > 0);
+ }
+ return j;
+ }
+
+ /**
+ * Unpacks the compressed character translation table.
+ *
+ * @param packed the packed character translation table
+ * @return the unpacked character translation table
+ */
+ private static char [] yy_unpack_cmap(String packed) {
+ char [] map = new char[0x10000];
+ int i = 0; /* index in packed string */
+ int j = 0; /* index in unpacked array */
+ while (i < 146) {
+ int count = packed.charAt(i++);
+ char value = packed.charAt(i++);
+ do map[j++] = value; while (--count > 0);
+ }
+ return map;
+ }
+
+
+ /**
+ * Refills the input buffer.
+ *
+ * @return false, iff there was new input.
+ *
+ * @exception IOException if any I/O-Error occurs
+ */
+ private boolean yy_refill() throws java.io.IOException {
+
+ /* first: make room (if you can) */
+ if (yy_startRead > 0) {
+ System.arraycopy(yy_buffer, yy_startRead,
+ yy_buffer, 0,
+ yy_endRead-yy_startRead);
+
+ /* translate stored positions */
+ yy_endRead-= yy_startRead;
+ yy_currentPos-= yy_startRead;
+ yy_markedPos-= yy_startRead;
+ yy_pushbackPos-= yy_startRead;
+ yy_startRead = 0;
+ }
+
+ /* is the buffer big enough? */
+ if (yy_currentPos >= yy_buffer.length) {
+ /* if not: blow it up */
+ char newBuffer[] = new char[yy_currentPos*2];
+ System.arraycopy(yy_buffer, 0, newBuffer, 0, yy_buffer.length);
+ yy_buffer = newBuffer;
+ }
+
+ /* finally: fill the buffer with new input */
+ int numRead = yy_reader.read(yy_buffer, yy_endRead,
+ yy_buffer.length-yy_endRead);
+
+ if (numRead < 0) {
+ return true;
+ }
+ else {
+ yy_endRead+= numRead;
+ return false;
+ }
+ }
+
+
+ /**
+ * Closes the input stream.
+ */
+ final public void yyclose() throws java.io.IOException {
+ yy_atEOF = true; /* indicate end of file */
+ yy_endRead = yy_startRead; /* invalidate buffer */
+
+ if (yy_reader != null)
+ yy_reader.close();
+ }
+
+
+ /**
+ * Closes the current stream, and resets the
+ * scanner to read from a new input stream.
+ *
+ * All internal variables are reset, the old input stream
+ * cannot be reused (internal buffer is discarded and lost).
+ * Lexical state is set to YY_INITIAL.
+ *
+ * @param reader the new input stream
+ */
+ final public void yyreset(java.io.Reader reader) throws java.io.IOException {
+ yyclose();
+ yy_reader = reader;
+ yy_atBOL = true;
+ yy_atEOF = false;
+ yy_endRead = yy_startRead = 0;
+ yy_currentPos = yy_markedPos = yy_pushbackPos = 0;
+ yyline = yychar = yycolumn = 0;
+ yy_lexical_state = YYINITIAL;
+ }
+
+
+ /**
+ * Returns the current lexical state.
+ */
+ final public int yystate() {
+ return yy_lexical_state;
+ }
+
+
+ /**
+ * Enters a new lexical state
+ *
+ * @param newState the new lexical state
+ */
+ final public void yybegin(int newState) {
+ yy_lexical_state = newState;
+ }
+
+
+ /**
+ * Returns the text matched by the current regular expression.
+ */
+ final public String yytext() {
+ return new String( yy_buffer, yy_startRead, yy_markedPos-yy_startRead );
+ }
+
+
+ /**
+ * Returns the character at position pos from the
+ * matched text.
+ *
+ * It is equivalent to yytext().charAt(pos), but faster
+ *
+ * @param pos the position of the character to fetch.
+ * A value from 0 to yylength()-1.
+ *
+ * @return the character at position pos
+ */
+ final public char yycharat(int pos) {
+ return yy_buffer[yy_startRead+pos];
+ }
+
+
+ /**
+ * Returns the length of the matched text region.
+ */
+ final public int yylength() {
+ return yy_markedPos-yy_startRead;
+ }
+
+
+ /**
+ * Reports an error that occured while scanning.
+ *
+ * In a wellformed scanner (no or only correct usage of
+ * yypushback(int) and a match-all fallback rule) this method
+ * will only be called with things that "Can't Possibly Happen".
+ * If this method is called, something is seriously wrong
+ * (e.g. a JFlex bug producing a faulty scanner etc.).
+ *
+ * Usual syntax/scanner level error handling should be done
+ * in error fallback rules.
+ *
+ * @param errorCode the code of the errormessage to display
+ */
+ private void yy_ScanError(int errorCode) {
+ String message;
+ try {
+ message = YY_ERROR_MSG[errorCode];
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ message = YY_ERROR_MSG[YY_UNKNOWN_ERROR];
+ }
+
+ throw new Error(message);
+ }
+
+
+ /**
+ * Pushes the specified amount of characters back into the input stream.
+ *
+ * They will be read again by then next call of the scanning method
+ *
+ * @param number the number of characters to be read again.
+ * This number must not be greater than yylength()!
+ */
+ private void yypushback(int number) {
+ if ( number > yylength() )
+ yy_ScanError(YY_PUSHBACK_2BIG);
+
+ yy_markedPos -= number;
+ }
+
+
+ /**
+ * Contains user EOF-code, which will be executed exactly once,
+ * when the end of file is reached
+ */
+ private void yy_do_eof() throws java.io.IOException {
+ if (!yy_eof_done) {
+ yy_eof_done = true;
+ yyclose();
+ }
+ }
+
+
+ /**
+ * Resumes scanning until the next regular expression is matched,
+ * the end of input is encountered or an I/O-Error occurs.
+ *
+ * @return the next token
+ * @exception IOException if any I/O-Error occurs
+ */
+ public java_cup.runtime.Symbol next_token() throws java.io.IOException {
+ int yy_input;
+ int yy_action;
+
+ // cached fields:
+ int yy_currentPos_l;
+ int yy_startRead_l;
+ int yy_markedPos_l;
+ int yy_endRead_l = yy_endRead;
+ char [] yy_buffer_l = yy_buffer;
+ char [] yycmap_l = yycmap;
+
+ int [] yytrans_l = yytrans;
+ int [] yy_rowMap_l = yy_rowMap;
+ byte [] yy_attr_l = YY_ATTRIBUTE;
+ int yy_pushbackPos_l = yy_pushbackPos = -1;
+ boolean yy_was_pushback;
+
+ while (true) {
+ yy_markedPos_l = yy_markedPos;
+
+ boolean yy_r = false;
+ for (yy_currentPos_l = yy_startRead; yy_currentPos_l < yy_markedPos_l;
+ yy_currentPos_l++) {
+ switch (yy_buffer_l[yy_currentPos_l]) {
+ case '\u000B':
+ case '\u000C':
+ case '\u0085':
+ case '\u2028':
+ case '\u2029':
+ yyline++;
+ yycolumn = 0;
+ yy_r = false;
+ break;
+ case '\r':
+ yyline++;
+ yycolumn = 0;
+ yy_r = true;
+ break;
+ case '\n':
+ if (yy_r)
+ yy_r = false;
+ else {
+ yyline++;
+ yycolumn = 0;
+ }
+ break;
+ default:
+ yy_r = false;
+ yycolumn++;
+ }
+ }
+
+ if (yy_r) {
+ // peek one character ahead if it is \n (if we have counted one line too much)
+ boolean yy_peek;
+ if (yy_markedPos_l < yy_endRead_l)
+ yy_peek = yy_buffer_l[yy_markedPos_l] == '\n';
+ else if (yy_atEOF)
+ yy_peek = false;
+ else {
+ boolean eof = yy_refill();
+ yy_markedPos_l = yy_markedPos;
+ yy_buffer_l = yy_buffer;
+ if (eof)
+ yy_peek = false;
+ else
+ yy_peek = yy_buffer_l[yy_markedPos_l] == '\n';
+ }
+ if (yy_peek) yyline--;
+ }
+ yy_action = -1;
+
+ yy_startRead_l = yy_currentPos_l = yy_currentPos =
+ yy_startRead = yy_markedPos_l;
+
+ yy_state = yy_lexical_state;
+
+ yy_was_pushback = false;
+
+ yy_forAction: {
+ while (true) {
+
+ if (yy_currentPos_l < yy_endRead_l)
+ yy_input = yy_buffer_l[yy_currentPos_l++];
+ else if (yy_atEOF) {
+ yy_input = YYEOF;
+ break yy_forAction;
+ }
+ else {
+ // store back cached positions
+ yy_currentPos = yy_currentPos_l;
+ yy_markedPos = yy_markedPos_l;
+ yy_pushbackPos = yy_pushbackPos_l;
+ boolean eof = yy_refill();
+ // get translated positions and possibly new buffer
+ yy_currentPos_l = yy_currentPos;
+ yy_markedPos_l = yy_markedPos;
+ yy_buffer_l = yy_buffer;
+ yy_endRead_l = yy_endRead;
+ yy_pushbackPos_l = yy_pushbackPos;
+ if (eof) {
+ yy_input = YYEOF;
+ break yy_forAction;
+ }
+ else {
+ yy_input = yy_buffer_l[yy_currentPos_l++];
+ }
+ }
+ int yy_next = yytrans_l[ yy_rowMap_l[yy_state] + yycmap_l[yy_input] ];
+ if (yy_next == -1) break yy_forAction;
+ yy_state = yy_next;
+
+ int yy_attributes = yy_attr_l[yy_state];
+ if ( (yy_attributes & 2) == 2 )
+ yy_pushbackPos_l = yy_currentPos_l;
+
+ if ( (yy_attributes & 1) == 1 ) {
+ yy_was_pushback = (yy_attributes & 4) == 4;
+ yy_action = yy_state;
+ yy_markedPos_l = yy_currentPos_l;
+ if ( (yy_attributes & 8) == 8 ) break yy_forAction;
+ }
+
+ }
+ }
+
+ // store back cached position
+ yy_markedPos = yy_markedPos_l;
+ if (yy_was_pushback)
+ yy_markedPos = yy_pushbackPos_l;
+
+ switch (yy_action) {
+
+ case 344:
+ { return symbol(sym.IMPLEMENTS); }
+ case 371: break;
+ case 0:
+ case 16:
+ case 24:
+ case 25:
+ case 26:
+ case 27:
+ case 28:
+ case 29:
+ case 30:
+ case 31:
+ case 32:
+ case 33:
+ case 34:
+ case 35:
+ case 36:
+ case 77:
+ case 85:
+ case 86:
+ case 87:
+ case 88:
+ case 89:
+ case 90:
+ case 91:
+ case 92:
+ case 93:
+ case 94:
+ case 95:
+ case 96:
+ case 97:
+ case 98:
+ case 99:
+ case 100:
+ case 101:
+ case 102:
+ case 103:
+ case 104:
+ case 132:
+ case 134:
+ case 136:
+ case 137:
+ case 138:
+ case 139:
+ case 140:
+ case 141:
+ case 142:
+ case 144:
+ case 145:
+ case 146:
+ case 147:
+ case 148:
+ case 149:
+ case 150:
+ case 151:
+ case 152:
+ case 167:
+ case 169:
+ case 170:
+ case 171:
+ case 172:
+ case 173:
+ case 174:
+ case 175:
+ case 176:
+ case 177:
+ case 179:
+ case 180:
+ case 181:
+ case 183:
+ case 184:
+ case 185:
+ case 186:
+ case 187:
+ case 200:
+ case 201:
+ case 202:
+ case 203:
+ case 205:
+ case 206:
+ case 207:
+ case 209:
+ case 210:
+ case 211:
+ case 212:
+ case 214:
+ case 215:
+ case 216:
+ case 217:
+ case 218:
+ case 227:
+ case 228:
+ case 229:
+ case 230:
+ case 232:
+ case 233:
+ case 234:
+ case 236:
+ case 237:
+ case 240:
+ case 241:
+ case 242:
+ case 243:
+ case 244:
+ case 249:
+ case 250:
+ case 254:
+ case 258:
+ case 259:
+ case 260:
+ case 264:
+ case 265:
+ case 266:
+ case 268:
+ case 269:
+ case 274:
+ case 275:
+ case 276:
+ case 280:
+ case 281:
+ case 282:
+ case 283:
+ case 284:
+ case 286:
+ case 288:
+ case 289:
+ case 306:
+ case 307:
+ case 308:
+ case 309:
+ case 310:
+ case 312:
+ case 314:
+ case 324:
+ case 325:
+ case 326:
+ case 327:
+ case 328:
+ case 338:
+ case 340:
+ case 341:
+ case 342:
+ case 350:
+ case 351:
+ case 353:
+ case 358:
+ case 359:
+ case 364:
+ case 365:
+ { return symbol(sym.IDENTIFIER); }
+ case 372: break;
+ case 60:
+ case 61:
+ { yybegin(YYINITIAL); yypushback(yylength()); }
+ case 373: break;
+ case 81:
+ { return symbol(sym.MINUSMINUS); }
+ case 374: break;
+ case 127:
+ { return symbol(sym.RPAREN_FUNC); }
+ case 375: break;
+ case 165:
+ { return symbol(sym.LPAREN_FUNC); }
+ case 376: break;
+ case 343:
+ { return symbol(sym.PROTECTED); }
+ case 377: break;
+ case 330:
+ { return symbol(sym.INTERFACE); }
+ case 378: break;
+ case 318:
+ { return symbol(sym.ABSTRACT); }
+ case 379: break;
+ case 317:
+ { return symbol(sym.FUNCTION); }
+ case 380: break;
+ case 47:
+ { return symbol(sym.QUESTION); }
+ case 381: break;
+ case 80:
+ { return symbol(sym.PLUSPLUS); }
+ case 382: break;
+ case 106:
+ { return symbol(sym.NOTEQUALS); }
+ case 383: break;
+ case 131:
+ { return symbol(sym.DOTDOTDOT); }
+ case 384: break;
+ case 49:
+ { return symbol(sym.AT); }
+ case 385: break;
+ case 48:
+ { return symbol(sym.AND); }
+ case 386: break;
+ case 44:
+ { return symbol(sym.NOT); }
+ case 387: break;
+ case 42:
+ { return symbol(sym.LT); }
+ case 388: break;
+ case 38:
+ { return symbol(sym.COL); }
+ case 389: break;
+ case 10:
+ { return symbol(sym.DIV); }
+ case 390: break;
+ case 8:
+ { /* ignore */ }
+ case 391: break;
+ case 3:
+ case 56:
+ { /* ignore */ }
+ case 392: break;
+ case 15:
+ { return symbol(sym.GT); }
+ case 393: break;
+ case 17:
+ case 18:
+ case 78:
+ case 79:
+ { return symbol(sym.INT); }
+ case 394: break;
+ case 21:
+ { return symbol(sym.DOT); }
+ case 395: break;
+ case 55:
+ { return symbol(sym.LF); }
+ case 396: break;
+ case 76:
+ { return symbol(sym.GTE); }
+ case 397: break;
+ case 105:
+ { return symbol(sym.LTE); }
+ case 398: break;
+ case 130:
+ { return symbol(sym.INT); }
+ case 399: break;
+ case 135:
+ { return symbol(sym.NEW); }
+ case 400: break;
+ case 168:
+ { return symbol(sym.IS); }
+ case 401: break;
+ case 178:
+ { return symbol(sym.AS); }
+ case 402: break;
+ case 213:
+ { return symbol(sym.VAR); }
+ case 403: break;
+ case 224:
+ { return symbol(sym.DOC); }
+ case 404: break;
+ case 5:
+ case 57:
+ case 58:
+ case 59:
+ { System.out.println("unmatched:"+yytext()); }
+ case 405: break;
+ case 189:
+ { yybegin(YYINITIAL); return symbol(sym.TYPE_MACRO); }
+ case 406: break;
+ case 352:
+ case 356:
+ { return symbol(sym.DECLARE_CLASS); }
+ case 407: break;
+ case 339:
+ case 346:
+ { return symbol(sym.DECLARE_ENUM); }
+ case 408: break;
+ case 262:
+ { return symbol(sym.CONST); }
+ case 409: break;
+ case 261:
+ { return symbol(sym.CLASS); }
+ case 410: break;
+ case 46:
+ { return symbol(sym.TUBE); }
+ case 411: break;
+ case 43:
+ { return symbol(sym.COMMA); }
+ case 412: break;
+ case 39:
+ { return symbol(sym.SEMI); }
+ case 413: break;
+ case 11:
+ { return symbol(sym.MULT); }
+ case 414: break;
+ case 19:
+ { return symbol(sym.PLUS); }
+ case 415: break;
+ case 20:
+ { return symbol(sym.MINUS); }
+ case 416: break;
+ case 66:
+ { return symbol(sym.TUBE); }
+ case 417: break;
+ case 107:
+ case 108:
+ { return symbol(sym.TUBE); }
+ case 418: break;
+ case 110:
+ { return symbol(sym.OROR); }
+ case 419: break;
+ case 231:
+ { return symbol(sym.ENUM); }
+ case 420: break;
+ case 235:
+ { return symbol(sym.FROM); }
+ case 421: break;
+ case 51:
+ { string.append('\\'); }
+ case 422: break;
+ case 54:
+ { string.append('\\'); }
+ case 423: break;
+ case 112:
+ { string.append('\\'); }
+ case 424: break;
+ case 113:
+ { string.append('\"'); }
+ case 425: break;
+ case 114:
+ { string.append('\n'); }
+ case 426: break;
+ case 115:
+ { string.append('\t'); }
+ case 427: break;
+ case 116:
+ { string.append('\r'); }
+ case 428: break;
+ case 117:
+ { string.append('\''); }
+ case 429: break;
+ case 67:
+ { yybegin(EOL_COMMENT); }
+ case 430: break;
+ case 368:
+ case 369:
+ { return symbol(sym.DECLARE_FUNCTION); }
+ case 431: break;
+ case 52:
+ { yybegin(YYINITIAL);
+ return symbol(sym.IDENTIFIER,
+ "\""+string.toString()+"\""); }
+ case 432: break;
+ case 246:
+ { yypushback(yylength()); yybegin(TYPE_MACRO); }
+ case 433: break;
+ case 6:
+ case 7:
+ { /*System.err.println("LF");*/ return symbol(sym.LF); }
+ case 434: break;
+ case 163:
+ case 195:
+ { /*System.err.println("COMMENT: "+yytext());*/ /* ignore */ }
+ case 435: break;
+ case 22:
+ { string.setLength(0); yybegin(CHAR); }
+ case 436: break;
+ case 360:
+ case 363:
+ { return symbol(sym.DECLARE_MODULE); }
+ case 437: break;
+ case 9:
+ { string.setLength(0); yybegin(STRING); }
+ case 438: break;
+ case 311:
+ { return symbol(sym.PRIVATE); }
+ case 439: break;
+ case 300:
+ case 301:
+ case 302:
+ case 303:
+ case 304:
+ case 305:
+ { return symbol(sym.DECLARE); }
+ case 440: break;
+ case 287:
+ { return symbol(sym.PUBLIC); }
+ case 441: break;
+ case 277:
+ { return symbol(sym.STATIC); }
+ case 442: break;
+ case 273:
+ { return symbol(sym.EXTENDS); }
+ case 443: break;
+ case 270:
+ { return symbol(sym.TYPEOF); }
+ case 444: break;
+ case 257:
+ { return symbol(sym.EXPORT); }
+ case 445: break;
+ case 252:
+ { return symbol(sym.IMPORT); }
+ case 446: break;
+ case 53:
+ { string.append( yytext() ); }
+ case 447: break;
+ case 50:
+ { string.append( yytext() ); }
+ case 448: break;
+ case 45:
+ { return symbol(sym.MATCHES); }
+ case 449: break;
+ case 41:
+ { return symbol(sym.RSPAREN); }
+ case 450: break;
+ case 40:
+ { return symbol(sym.RCPAREN); }
+ case 451: break;
+ case 37:
+ { return symbol(sym.LCPAREN); }
+ case 452: break;
+ case 23:
+ { return symbol(sym.LSPAREN); }
+ case 453: break;
+ case 12:
+ { return symbol(sym.RPAREN); }
+ case 454: break;
+ case 13:
+ { return symbol(sym.LPAREN); }
+ case 455: break;
+ case 14:
+ { return symbol(sym.ASSIGN); }
+ case 456: break;
+ case 74:
+ { return symbol(sym.EQUALS); }
+ case 457: break;
+ case 75:
+ { return symbol(sym.IMPLIES); }
+ case 458: break;
+ case 82:
+ { return symbol(sym.DOTDOT); }
+ case 459: break;
+ case 84:
+ { return symbol(sym.SQUARE); }
+ case 460: break;
+ case 111:
+ { return symbol(sym.ANDAND); }
+ case 461: break;
+ default:
+ if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
+ yy_atEOF = true;
+ yy_do_eof();
+ switch (yy_lexical_state) {
+ case EOL_COMMENT:
+ { yybegin(YYINITIAL); }
+ case 371: break;
+ default:
+ { return new java_cup.runtime.Symbol(sym.EOF); }
+ }
+ }
+ else {
+ yy_ScanError(YY_NO_MATCH);
+ }
+ }
+ }
+ }
+
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/TypescriptDefScanner.java~ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/TypescriptDefScanner.java~
new file mode 100644
index 00000000..08619c37
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/TypescriptDefScanner.java~
@@ -0,0 +1,1258 @@
+/* The following code was generated by JFlex 1.3.5 on 13/11/15 09:56 */
+
+
+/*
+ * This source code file is the exclusive property of its author. No copy or
+ * usage of the source code is permitted unless the author contractually
+ * allows it under the terms of a well-defined agreement.
+ */
+
+package org.jsweet.input.typescriptdef.parser;
+
+import java_cup.runtime.*;
+import org.jsweet.input.typescriptdef.ast.Token;
+import java.util.*;
+
+
+/**
+ * This class is a scanner generated by
+ * JFlex 1.3.5
+ * on 13/11/15 09:56 from the specification file
+ * file:/C:/Users/Renaud Pawlak/workspace-jsweet/jsweet-def-translators/src/org/jsweet/input/typescriptdef/parser/typescriptdef.lex
+ */
+class TypescriptDefScanner implements java_cup.runtime.Scanner {
+
+ /** This character denotes the end of file */
+ final public static int YYEOF = -1;
+
+ /** initial size of the lookahead buffer */
+ final private static int YY_BUFFERSIZE = 16384;
+
+ /** lexical states */
+ final public static int EOL_COMMENT = 4;
+ final public static int STRING = 1;
+ final public static int YYINITIAL = 0;
+ final public static int TYPE_MACRO = 3;
+ final public static int CHAR = 2;
+
+ /**
+ * Translates characters to character classes
+ */
+ final private static String yycmap_packed =
+ "\11\0\1\3\1\2\1\0\1\3\1\1\22\0\1\3\1\61\1\5"+
+ "\1\0\1\14\1\0\1\65\1\23\1\11\1\10\1\7\1\20\1\60"+
+ "\1\21\1\22\1\6\1\15\11\16\1\52\1\53\1\57\1\12\1\13"+
+ "\1\64\1\66\6\17\21\14\1\51\2\14\1\55\1\4\1\56\1\0"+
+ "\1\14\1\0\1\32\1\47\1\33\1\36\1\27\1\31\2\14\1\24"+
+ "\2\14\1\34\1\40\1\25\1\41\1\43\1\14\1\30\1\35\1\26"+
+ "\1\42\1\37\1\50\1\45\1\44\1\14\1\46\1\63\1\54\1\62"+
+ "\74\0\1\67\3\0\1\67\57\0\1\67\uff10\0";
+
+ /**
+ * Translates characters to character classes
+ */
+ final private static char [] yycmap = yy_unpack_cmap(yycmap_packed);
+
+ /**
+ * Translates a state to a row index in the transition table
+ */
+ final private static int yy_rowMap [] = {
+ 0, 56, 112, 168, 224, 280, 336, 392, 280, 280,
+ 448, 280, 504, 560, 616, 672, 728, 784, 840, 896,
+ 952, 1008, 280, 1064, 1120, 1176, 1232, 1288, 1344, 1400,
+ 1456, 1512, 1568, 1624, 280, 280, 280, 280, 1680, 280,
+ 1736, 280, 1792, 280, 1848, 280, 1904, 280, 1960, 2016,
+ 280, 2072, 2128, 2184, 2240, 2296, 2352, 2408, 2464, 280,
+ 392, 2520, 2576, 2632, 2688, 280, 2744, 504, 2800, 560,
+ 2856, 2912, 280, 280, 280, 2968, 280, 3024, 280, 280,
+ 3080, 3136, 3192, 3248, 3304, 3360, 3416, 3472, 3528, 3584,
+ 3640, 3696, 3752, 3808, 3864, 3920, 3976, 4032, 1680, 280,
+ 280, 280, 4088, 280, 4144, 280, 280, 280, 280, 280,
+ 280, 280, 280, 4200, 4256, 4312, 4368, 4424, 4480, 4536,
+ 4592, 4648, 280, 4704, 4760, 2968, 280, 4816, 4872, 4928,
+ 728, 4984, 5040, 5096, 5152, 5208, 5264, 5320, 5376, 5432,
+ 5488, 5544, 5600, 5656, 5712, 5768, 5824, 5880, 5936, 5992,
+ 6048, 6104, 6160, 6216, 6272, 6328, 6384, 280, 6440, 6496,
+ 280, 6552, 6608, 6664, 6720, 6776, 6832, 6888, 6944, 280,
+ 7000, 7056, 7112, 7168, 7224, 7280, 7336, 7392, 280, 7448,
+ 7504, 7560, 7616, 7672, 280, 7728, 6328, 7784, 7840, 7896,
+ 7952, 8008, 8064, 8120, 8176, 8232, 8288, 8344, 8400, 8456,
+ 8512, 8568, 280, 8624, 8680, 8736, 8792, 8848, 8904, 8960,
+ 280, 9016, 9072, 9128, 9184, 9240, 9296, 280, 9352, 9408,
+ 280, 9464, 9520, 9576, 9632, 9688, 9744, 9800, 9856, 280,
+ 9912, 9968, 10024, 10080, 10136, 280, 10192, 10248, 10304, 10360,
+ 280, 10416, 280, 280, 10472, 10528, 10584, 10640, 10696, 10752,
+ 280, 10808, 10864, 280, 10920, 280, 10976, 11032, 11088, 11144,
+ 11200, 11256, 11312, 11368, 280, 11424, 11480, 11536, 11592, 11648,
+ 11704, 11760, 11816, 11872, 11928, 11984, 12040, 12096, 12152, 12208,
+ 12264, 12320, 280, 12376, 12432, 12488, 12544, 280, 12600, 12656,
+ 12712, 12768, 12824, 12880, 12936, 12992, 13048, 13104, 728, 13160,
+ 280, 13216, 13272, 13328, 13384, 13440, 13496, 280, 13552, 13608,
+ 728, 13664, 13720, 13776, 280, 13832, 280, 13888, 13944, 14000,
+ 14056, 14112, 728, 14168, 14224, 14280, 280, 14336, 14392, 14448,
+ 728, 14504, 14560, 280, 14616, 14672, 14728, 14784, 728, 280
+ };
+
+ /**
+ * The packed transition table of the DFA (part 0)
+ */
+ final private static String yy_packed0 =
+ "\1\6\1\7\1\10\1\11\1\6\1\12\1\13\1\14"+
+ "\1\15\1\16\1\17\1\20\1\21\1\22\1\23\1\21"+
+ "\1\24\1\25\1\26\1\27\1\30\1\31\1\32\1\33"+
+ "\1\21\1\34\1\35\1\36\1\21\1\37\1\40\1\41"+
+ "\3\21\1\42\2\21\1\43\3\21\1\44\1\45\1\46"+
+ "\1\47\1\50\1\51\1\52\1\53\1\54\1\55\1\56"+
+ "\1\57\1\60\1\11\1\61\2\6\1\61\1\62\1\63"+
+ "\62\61\1\64\2\6\1\64\1\65\16\64\1\63\44\64"+
+ "\1\6\2\66\1\67\22\6\1\70\1\71\6\6\1\72"+
+ "\31\6\1\11\1\73\1\74\65\11\72\0\1\10\1\75"+
+ "\22\0\1\76\1\77\6\0\1\100\13\0\1\44\10\0"+
+ "\1\101\7\0\1\75\22\0\1\76\1\77\6\0\1\100"+
+ "\13\0\1\44\10\0\1\101\12\0\1\102\1\103\63\0"+
+ "\1\104\6\0\1\105\55\0\10\106\1\107\1\110\56\106"+
+ "\12\0\1\111\1\112\66\0\1\113\71\0\4\21\4\0"+
+ "\22\21\1\0\3\21\32\0\4\21\4\0\21\21\1\114"+
+ "\1\0\2\21\1\114\32\0\1\21\2\23\1\21\4\0"+
+ "\22\21\1\0\3\21\33\0\1\115\1\116\1\0\1\117"+
+ "\64\0\1\115\1\116\2\0\1\120\70\0\1\121\61\0"+
+ "\4\21\4\0\1\21\1\122\7\21\1\123\2\21\1\124"+
+ "\5\21\1\0\3\21\32\0\4\21\4\0\3\21\1\125"+
+ "\16\21\1\0\3\21\32\0\4\21\4\0\20\21\1\126"+
+ "\1\21\1\0\3\21\32\0\4\21\4\0\1\21\1\127"+
+ "\17\21\1\130\1\0\3\21\32\0\4\21\4\0\4\21"+
+ "\1\131\11\21\1\132\3\21\1\0\3\21\32\0\4\21"+
+ "\4\0\11\21\1\133\10\21\1\0\3\21\32\0\4\21"+
+ "\4\0\10\21\1\134\4\21\1\135\4\21\1\0\3\21"+
+ "\32\0\4\21\4\0\2\21\1\136\17\21\1\0\3\21"+
+ "\32\0\4\21\4\0\3\21\1\137\16\21\1\0\3\21"+
+ "\32\0\4\21\4\0\6\21\1\140\13\21\1\0\3\21"+
+ "\32\0\4\21\4\0\4\21\1\141\11\21\1\142\3\21"+
+ "\1\0\3\21\21\0\1\143\52\0\1\144\23\0\1\145"+
+ "\67\0\1\146\56\0\1\147\1\150\1\151\57\0\1\152"+
+ "\71\0\1\153\2\0\1\61\2\0\1\61\2\0\62\61"+
+ "\4\0\1\154\1\155\17\0\1\156\1\157\1\0\1\160"+
+ "\37\0\1\64\2\0\1\64\1\0\16\64\1\0\44\64"+
+ "\4\0\1\154\16\0\1\161\1\0\1\156\1\157\1\0"+
+ "\1\160\40\0\3\66\2\0\1\162\64\0\1\67\130\0"+
+ "\1\163\70\0\1\164\51\0\1\165\42\0\1\74\131\0"+
+ "\1\166\70\0\1\167\51\0\1\170\41\0\1\147\1\150"+
+ "\1\101\64\0\7\171\1\172\60\171\13\0\1\173\57\0"+
+ "\1\107\6\0\1\174\55\0\10\110\1\106\1\175\56\110"+
+ "\14\0\1\21\3\176\4\0\3\21\1\176\1\21\3\176"+
+ "\2\21\1\176\7\21\1\0\1\176\2\21\33\0\2\116"+
+ "\73\0\1\177\61\0\4\21\4\0\2\21\1\200\17\21"+
+ "\1\0\3\21\21\0\1\201\10\0\4\21\4\0\22\21"+
+ "\1\0\3\21\32\0\4\21\4\0\17\21\1\202\2\21"+
+ "\1\0\3\21\32\0\4\21\4\0\22\21\1\0\1\21"+
+ "\1\203\1\21\32\0\4\21\4\0\17\21\1\204\2\21"+
+ "\1\0\3\21\32\0\4\21\4\0\16\21\1\205\3\21"+
+ "\1\0\3\21\32\0\4\21\4\0\2\21\1\206\14\21"+
+ "\1\207\2\21\1\0\3\21\32\0\4\21\4\0\15\21"+
+ "\1\210\4\21\1\0\3\21\32\0\4\21\4\0\1\21"+
+ "\1\211\20\21\1\0\3\21\21\0\1\212\10\0\4\21"+
+ "\4\0\22\21\1\0\3\21\32\0\4\21\4\0\6\21"+
+ "\1\213\13\21\1\0\3\21\32\0\4\21\4\0\1\21"+
+ "\1\214\20\21\1\0\3\21\32\0\4\21\4\0\6\21"+
+ "\1\215\13\21\1\0\3\21\32\0\4\21\4\0\7\21"+
+ "\1\216\12\21\1\0\3\21\32\0\4\21\4\0\4\21"+
+ "\1\217\15\21\1\0\3\21\32\0\4\21\4\0\1\220"+
+ "\21\21\1\0\3\21\32\0\4\21\4\0\22\21\1\0"+
+ "\1\221\2\21\20\0\1\150\66\0\1\147\1\150\1\151"+
+ "\72\0\1\222\1\223\123\0\1\224\67\0\1\225\57\0"+
+ "\1\226\77\0\1\227\67\0\1\230\57\0\1\231\34\0"+
+ "\7\171\1\232\60\171\6\233\1\234\1\235\60\233\13\0"+
+ "\1\236\54\0\10\175\1\110\1\237\56\175\14\0\4\21"+
+ "\4\0\3\21\1\240\16\21\1\0\3\21\21\0\1\201"+
+ "\1\0\2\241\5\0\4\241\3\0\23\241\1\0\3\241"+
+ "\32\0\4\21\4\0\10\21\1\242\4\21\1\243\4\21"+
+ "\1\0\3\21\32\0\4\21\4\0\3\21\1\244\16\21"+
+ "\1\0\3\21\32\0\4\21\4\0\14\21\1\245\5\21"+
+ "\1\0\3\21\32\0\4\21\4\0\3\21\1\246\16\21"+
+ "\1\0\3\21\32\0\4\21\4\0\15\21\1\247\4\21"+
+ "\1\0\3\21\32\0\4\21\4\0\14\21\1\250\5\21"+
+ "\1\0\3\21\32\0\4\21\4\0\7\21\1\251\12\21"+
+ "\1\0\3\21\21\0\1\212\1\0\2\252\5\0\4\252"+
+ "\3\0\23\252\1\0\3\252\32\0\4\21\4\0\11\21"+
+ "\1\253\10\21\1\0\3\21\32\0\4\21\4\0\11\21"+
+ "\1\254\10\21\1\0\3\21\32\0\4\21\4\0\2\21"+
+ "\1\255\17\21\1\0\3\21\32\0\4\21\4\0\10\21"+
+ "\1\256\11\21\1\0\3\21\21\0\1\257\10\0\4\21"+
+ "\4\0\22\21\1\0\3\21\32\0\4\21\4\0\13\21"+
+ "\1\260\6\21\1\0\3\21\32\0\4\21\4\0\10\21"+
+ "\1\261\11\21\1\0\3\21\16\0\1\222\2\66\65\222"+
+ "\7\223\1\262\60\223\27\0\1\263\101\0\1\264\62\0"+
+ "\1\265\62\0\1\266\101\0\1\267\62\0\1\270\33\0"+
+ "\6\171\1\271\1\232\60\171\7\233\1\272\60\233\7\273"+
+ "\1\274\60\273\6\275\1\271\1\235\60\275\10\237\1\175"+
+ "\1\0\56\237\14\0\4\21\4\0\4\21\1\276\15\21"+
+ "\1\0\3\21\32\0\4\21\4\0\3\21\1\277\16\21"+
+ "\1\0\3\21\32\0\4\21\4\0\4\21\1\300\15\21"+
+ "\1\0\3\21\32\0\4\21\4\0\15\21\1\301\4\21"+
+ "\1\0\3\21\21\0\1\302\10\0\4\21\4\0\22\21"+
+ "\1\0\3\21\32\0\4\21\4\0\1\21\1\303\20\21"+
+ "\1\0\3\21\32\0\4\21\4\0\4\21\1\304\15\21"+
+ "\1\0\3\21\21\0\1\305\10\0\4\21\4\0\22\21"+
+ "\1\0\3\21\32\0\4\21\4\0\2\21\1\306\17\21"+
+ "\1\0\3\21\32\0\4\21\4\0\11\21\1\307\10\21"+
+ "\1\0\3\21\32\0\4\21\4\0\2\21\1\310\17\21"+
+ "\1\0\3\21\32\0\4\21\4\0\1\311\21\21\1\0"+
+ "\3\21\32\0\4\21\4\0\6\21\1\312\13\21\1\0"+
+ "\3\21\21\0\1\257\1\0\2\313\5\0\4\313\3\0"+
+ "\23\313\1\0\3\313\32\0\4\21\4\0\6\21\1\314"+
+ "\13\21\1\0\3\21\32\0\4\21\4\0\1\315\21\21"+
+ "\1\0\3\21\16\0\6\223\1\66\1\262\60\223\30\0"+
+ "\1\316\71\0\1\317\40\0\1\320\114\0\1\321\71\0"+
+ "\1\322\35\0\6\275\1\323\1\235\60\275\6\324\1\323"+
+ "\1\325\60\324\7\233\1\235\60\233\14\0\4\21\4\0"+
+ "\5\21\1\326\14\21\1\0\3\21\32\0\4\21\4\0"+
+ "\14\21\1\327\5\21\1\0\3\21\32\0\4\21\4\0"+
+ "\2\21\1\330\17\21\1\0\3\21\32\0\4\21\4\0"+
+ "\5\21\1\331\14\21\1\0\3\21\21\0\1\302\1\0"+
+ "\2\332\5\0\4\332\3\0\23\332\1\0\3\332\32\0"+
+ "\4\21\4\0\12\21\1\333\7\21\1\0\3\21\32\0"+
+ "\4\21\4\0\2\21\1\334\17\21\1\0\3\21\21\0"+
+ "\1\305\1\0\2\335\5\0\4\335\3\0\23\335\1\0"+
+ "\3\335\32\0\4\21\4\0\1\336\21\21\1\0\3\21"+
+ "\21\0\1\337\10\0\4\21\4\0\22\21\1\0\3\21"+
+ "\21\0\1\340\10\0\4\21\4\0\22\21\1\0\3\21"+
+ "\32\0\4\21\4\0\7\21\1\341\12\21\1\0\3\21"+
+ "\32\0\4\21\4\0\4\21\1\342\15\21\1\0\3\21"+
+ "\32\0\4\21\4\0\2\21\1\343\17\21\1\0\3\21"+
+ "\32\0\4\21\4\0\7\21\1\344\12\21\1\0\3\21"+
+ "\44\0\1\11\71\0\1\345\42\0\1\320\1\0\2\346"+
+ "\5\0\4\346\3\0\23\346\1\0\3\346\44\0\1\347"+
+ "\71\0\1\350\37\0\7\273\1\325\60\273\6\324\1\0"+
+ "\1\325\60\324\14\0\4\21\4\0\6\21\1\351\13\21"+
+ "\1\0\3\21\32\0\4\21\4\0\3\21\1\352\16\21"+
+ "\1\0\3\21\21\0\1\353\3\0\1\354\4\0\4\21"+
+ "\4\0\22\21\1\0\3\21\21\0\1\355\10\0\4\21"+
+ "\4\0\22\21\1\0\3\21\32\0\4\21\4\0\11\21"+
+ "\1\356\10\21\1\0\3\21\17\0\2\357\1\360\6\0"+
+ "\1\361\1\0\4\21\4\0\22\21\1\0\3\21\32\0"+
+ "\4\21\4\0\15\21\1\362\4\21\1\0\3\21\21\0"+
+ "\1\337\1\0\2\363\5\0\4\363\3\0\23\363\1\0"+
+ "\3\363\21\0\1\340\1\0\2\364\5\0\4\364\3\0"+
+ "\23\364\1\0\3\364\21\0\1\365\10\0\4\21\4\0"+
+ "\22\21\1\0\3\21\32\0\4\21\4\0\3\21\1\366"+
+ "\16\21\1\0\3\21\32\0\4\21\4\0\3\21\1\367"+
+ "\16\21\1\0\3\21\21\0\1\370\10\0\4\21\4\0"+
+ "\22\21\1\0\3\21\45\0\1\11\41\0\3\347\22\0"+
+ "\1\76\70\0\1\347\54\0\4\21\4\0\7\21\1\371"+
+ "\12\21\1\0\3\21\32\0\4\21\4\0\1\21\1\372"+
+ "\20\21\1\0\3\21\21\0\1\353\1\0\3\354\4\0"+
+ "\4\354\3\0\23\354\1\0\3\354\21\0\1\355\1\0"+
+ "\2\373\5\0\4\373\3\0\23\373\1\0\3\373\21\0"+
+ "\1\374\5\0\1\375\2\0\4\21\4\0\22\21\1\376"+
+ "\3\21\17\0\3\357\6\0\1\361\56\0\2\357\1\360"+
+ "\1\0\2\361\3\0\1\361\1\0\4\361\3\0\23\361"+
+ "\1\0\3\361\32\0\4\21\4\0\1\21\1\377\20\21"+
+ "\1\0\3\21\21\0\1\365\1\0\2\u0100\5\0\4\u0100"+
+ "\3\0\23\u0100\1\0\3\u0100\17\0\3\u0101\10\0\4\21"+
+ "\4\0\1\21\1\u0102\1\21\1\u0103\1\21\1\u0104\1\21"+
+ "\1\u0105\3\21\1\u0106\1\u0107\5\21\1\0\3\21\21\0"+
+ "\1\u0108\10\0\4\21\4\0\22\21\1\0\3\21\21\0"+
+ "\1\370\1\0\2\u0109\5\0\4\u0109\3\0\23\u0109\1\0"+
+ "\3\u0109\32\0\4\21\4\0\3\21\1\u010a\16\21\1\0"+
+ "\3\21\32\0\4\21\4\0\2\21\1\u010b\17\21\1\0"+
+ "\3\21\21\0\1\374\1\0\2\376\2\0\1\375\2\0"+
+ "\4\376\3\0\27\376\16\0\10\375\1\u010c\1\u010d\56\375"+
+ "\3\0\1\u010e\10\0\4\21\4\0\22\21\1\0\3\21"+
+ "\17\0\3\u0101\21\0\1\u010f\1\0\1\u0110\1\0\1\u0111"+
+ "\1\0\1\u0112\3\0\1\u0113\1\u0114\43\0\4\21\4\0"+
+ "\6\21\1\u0115\13\21\1\0\3\21\32\0\4\21\4\0"+
+ "\1\21\1\u0116\20\21\1\0\3\21\32\0\4\21\4\0"+
+ "\16\21\1\u0117\3\21\1\0\3\21\32\0\4\21\4\0"+
+ "\10\21\1\u0118\11\21\1\0\3\21\32\0\4\21\4\0"+
+ "\6\21\1\u0119\13\21\1\0\3\21\32\0\4\21\4\0"+
+ "\15\21\1\u011a\4\21\1\0\3\21\21\0\1\u0108\1\0"+
+ "\2\u011b\5\0\4\u011b\3\0\23\u011b\1\0\3\u011b\21\0"+
+ "\1\u011c\10\0\4\21\4\0\22\21\1\0\3\21\32\0"+
+ "\4\21\4\0\11\21\1\u011d\10\21\1\0\3\21\21\0"+
+ "\1\u010c\6\0\1\u011e\55\0\10\u010d\1\375\1\u011f\56\u010d"+
+ "\3\0\1\u010e\1\0\2\u0120\5\0\4\u0120\3\0\23\u0120"+
+ "\1\0\3\u0120\50\0\1\u0121\62\0\1\u0122\104\0\1\u0123"+
+ "\61\0\1\u0124\65\0\1\u0125\76\0\1\u0126\42\0\4\21"+
+ "\4\0\14\21\1\u0127\5\21\1\0\3\21\32\0\4\21"+
+ "\4\0\16\21\1\u0128\3\21\1\0\3\21\32\0\4\21"+
+ "\4\0\1\21\1\u0129\20\21\1\0\3\21\32\0\4\21"+
+ "\4\0\6\21\1\u012a\13\21\1\0\3\21\32\0\4\21"+
+ "\4\0\4\21\1\u012b\15\21\1\0\3\21\32\0\4\21"+
+ "\4\0\12\21\1\u012c\7\21\1\0\3\21\21\0\1\u011c"+
+ "\1\0\2\u012d\5\0\4\u012d\3\0\23\u012d\1\0\3\u012d"+
+ "\21\0\1\u012e\10\0\4\21\4\0\22\21\1\0\3\21"+
+ "\31\0\1\376\54\0\10\u011f\1\u010d\1\u012f\56\u011f\40\0"+
+ "\1\u0130\71\0\1\u0131\52\0\1\u0132\74\0\1\u0133\65\0"+
+ "\1\u0134\75\0\1\u0135\45\0\4\21\4\0\3\21\1\u0136"+
+ "\16\21\1\0\3\21\32\0\4\21\4\0\14\21\1\u0137"+
+ "\5\21\1\0\3\21\32\0\4\21\4\0\7\21\1\u0138"+
+ "\12\21\1\0\3\21\32\0\4\21\4\0\11\21\1\u0139"+
+ "\10\21\1\0\3\21\32\0\4\21\4\0\16\21\1\u013a"+
+ "\3\21\1\0\3\21\21\0\1\u012e\1\0\2\u013b\5\0"+
+ "\4\u013b\3\0\23\u013b\1\0\3\u013b\16\0\10\u012f\1\u011f"+
+ "\1\0\56\u012f\27\0\1\u013c\100\0\1\u013d\62\0\1\u013e"+
+ "\71\0\1\u013f\74\0\1\u0140\41\0\4\21\4\0\11\21"+
+ "\1\u0141\10\21\1\0\3\21\32\0\4\21\4\0\2\21"+
+ "\1\u0142\17\21\1\0\3\21\32\0\4\21\4\0\11\21"+
+ "\1\u0143\10\21\1\0\3\21\32\0\4\21\4\0\10\21"+
+ "\1\u0144\11\21\1\0\3\21\53\0\1\u0145\60\0\1\u0146"+
+ "\76\0\1\u0147\66\0\1\u0148\47\0\4\21\4\0\17\21"+
+ "\1\u0149\2\21\1\0\3\21\32\0\4\21\4\0\1\u014a"+
+ "\21\21\1\0\3\21\32\0\4\21\4\0\3\21\1\u014b"+
+ "\16\21\1\0\3\21\61\0\1\u014c\50\0\1\u014d\72\0"+
+ "\1\u014e\54\0\4\21\4\0\6\21\1\u014f\13\21\1\0"+
+ "\3\21\32\0\4\21\4\0\15\21\1\u0150\4\21\1\0"+
+ "\3\21\50\0\1\u0151\76\0\1\u0152\42\0\4\21\4\0"+
+ "\7\21\1\u0144\12\21\1\0\3\21\32\0\4\21\4\0"+
+ "\1\21\1\u0153\20\21\1\0\3\21\51\0\1\u0148\61\0"+
+ "\1\u0154\42\0";
+
+ /**
+ * The transition table of the DFA
+ */
+ final private static int yytrans [] = yy_unpack();
+
+
+ /* error codes */
+ final private static int YY_UNKNOWN_ERROR = 0;
+ final private static int YY_ILLEGAL_STATE = 1;
+ final private static int YY_NO_MATCH = 2;
+ final private static int YY_PUSHBACK_2BIG = 3;
+
+ /* error messages for the codes above */
+ final private static String YY_ERROR_MSG[] = {
+ "Unkown internal scanner error",
+ "Internal error: unknown state",
+ "Error: could not match input",
+ "Error: pushback value was too large"
+ };
+
+ /**
+ * YY_ATTRIBUTE[aState] contains the attributes of state aState
+ */
+ private final static byte YY_ATTRIBUTE[] = {
+ 1, 0, 0, 1, 0, 9, 1, 1, 9, 9, 1, 9, 3, 3, 1, 1,
+ 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 9, 9, 9, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9,
+ 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 9, 0, 0, 0, 0,
+ 1, 9, 0, 0, 0, 0, 0, 0, 9, 9, 9, 1, 9, 1, 9, 9,
+ 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1,
+ 1, 1, 0, 9, 9, 9, 1, 9, 0, 9, 9, 9, 9, 9, 9, 9,
+ 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 1, 9, 1,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 3, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 13, 0, 1,
+ 13, 1, 1, 1, 3, 1, 1, 3, 1, 13, 1, 1, 1, 1, 0, 1,
+ 1, 0, 9, 0, 0, 2, 0, 0, 9, 0, 0, 0, 0, 1, 1, 1,
+ 1, 0, 1, 1, 0, 1, 3, 3, 1, 1, 13, 1, 1, 0, 0, 0,
+ 0, 0, 9, 0, 0, 1, 1, 3, 3, 13, 1, 3, 13, 1, 0, 0,
+ 3, 1, 1, 3, 0, 13, 0, 0, 1, 1, 0, 13, 0, 3, 0, 0,
+ 13, 1, 13, 13, 0, 1, 3, 0, 1, 1, 13, 0, 0, 13, 3, 13,
+ 0, 1, 1, 1, 1, 1, 1, 0, 13, 3, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 13, 0, 3, 0, 0, 13,
+ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 13, 0, 0, 0,
+ 0, 0, 0, 9, 0, 1, 1, 1, 1, 1, 13, 0, 9, 0, 0, 0,
+ 1, 1, 1, 1, 0, 0, 9, 0, 1, 1, 1, 0, 0, 9, 1, 1,
+ 0, 0, 1, 9
+ };
+
+ /** the input device */
+ private java.io.Reader yy_reader;
+
+ /** the current state of the DFA */
+ private int yy_state;
+
+ /** the current lexical state */
+ private int yy_lexical_state = YYINITIAL;
+
+ /** this buffer contains the current text to be matched and is
+ the source of the yytext() string */
+ private char yy_buffer[] = new char[YY_BUFFERSIZE];
+
+ /** the textposition at the last accepting state */
+ private int yy_markedPos;
+
+ /** the textposition at the last state to be included in yytext */
+ private int yy_pushbackPos;
+
+ /** the current text position in the buffer */
+ private int yy_currentPos;
+
+ /** startRead marks the beginning of the yytext() string in the buffer */
+ private int yy_startRead;
+
+ /** endRead marks the last character in the buffer, that has been read
+ from input */
+ private int yy_endRead;
+
+ /** number of newlines encountered up to the start of the matched text */
+ private int yyline;
+
+ /** the number of characters up to the start of the matched text */
+ private int yychar;
+
+ /**
+ * the number of characters from the last newline up to the start of the
+ * matched text
+ */
+ private int yycolumn;
+
+ /**
+ * yy_atBOL == true <=> the scanner is currently at the beginning of a line
+ */
+ private boolean yy_atBOL = true;
+
+ /** yy_atEOF == true <=> the scanner is at the EOF */
+ private boolean yy_atEOF;
+
+ /** denotes if the user-EOF-code has already been executed */
+ private boolean yy_eof_done;
+
+ /* user code: */
+ StringBuffer string=new StringBuffer();
+ String fileName;
+ public void setFileName(String name) {
+ fileName=name;
+ }
+ public String getFileName() {
+ return fileName;
+ }
+ private Symbol symbol(int type) {
+ return new Symbol(type,yyline,yycolumn,
+ new Token(type,fileName,yytext(),
+ yyline+1,yycolumn+1,
+ yycolumn+1+yytext().length()));
+ }
+ private Symbol symbol(int type, String value) {
+ return new Symbol(type,yyline,yycolumn,
+ new Token(type,fileName,value,
+ yyline+1,yycolumn+1,
+ yycolumn+1+yytext().length()));
+ }
+ private Stack openParens = new Stack();
+
+
+ /**
+ * Creates a new scanner
+ * There is also a java.io.InputStream version of this constructor.
+ *
+ * @param in the java.io.Reader to read input from.
+ */
+ TypescriptDefScanner(java.io.Reader in) {
+ this.yy_reader = in;
+ }
+
+ /**
+ * Creates a new scanner.
+ * There is also java.io.Reader version of this constructor.
+ *
+ * @param in the java.io.Inputstream to read input from.
+ */
+ TypescriptDefScanner(java.io.InputStream in) {
+ this(new java.io.InputStreamReader(in));
+ }
+
+ /**
+ * Unpacks the split, compressed DFA transition table.
+ *
+ * @return the unpacked transition table
+ */
+ private static int [] yy_unpack() {
+ int [] trans = new int[14840];
+ int offset = 0;
+ offset = yy_unpack(yy_packed0, offset, trans);
+ return trans;
+ }
+
+ /**
+ * Unpacks the compressed DFA transition table.
+ *
+ * @param packed the packed transition table
+ * @return the index of the last entry
+ */
+ private static int yy_unpack(String packed, int offset, int [] trans) {
+ int i = 0; /* index in packed string */
+ int j = offset; /* index in unpacked array */
+ int l = packed.length();
+ while (i < l) {
+ int count = packed.charAt(i++);
+ int value = packed.charAt(i++);
+ value--;
+ do trans[j++] = value; while (--count > 0);
+ }
+ return j;
+ }
+
+ /**
+ * Unpacks the compressed character translation table.
+ *
+ * @param packed the packed character translation table
+ * @return the unpacked character translation table
+ */
+ private static char [] yy_unpack_cmap(String packed) {
+ char [] map = new char[0x10000];
+ int i = 0; /* index in packed string */
+ int j = 0; /* index in unpacked array */
+ while (i < 154) {
+ int count = packed.charAt(i++);
+ char value = packed.charAt(i++);
+ do map[j++] = value; while (--count > 0);
+ }
+ return map;
+ }
+
+
+ /**
+ * Refills the input buffer.
+ *
+ * @return false, iff there was new input.
+ *
+ * @exception IOException if any I/O-Error occurs
+ */
+ private boolean yy_refill() throws java.io.IOException {
+
+ /* first: make room (if you can) */
+ if (yy_startRead > 0) {
+ System.arraycopy(yy_buffer, yy_startRead,
+ yy_buffer, 0,
+ yy_endRead-yy_startRead);
+
+ /* translate stored positions */
+ yy_endRead-= yy_startRead;
+ yy_currentPos-= yy_startRead;
+ yy_markedPos-= yy_startRead;
+ yy_pushbackPos-= yy_startRead;
+ yy_startRead = 0;
+ }
+
+ /* is the buffer big enough? */
+ if (yy_currentPos >= yy_buffer.length) {
+ /* if not: blow it up */
+ char newBuffer[] = new char[yy_currentPos*2];
+ System.arraycopy(yy_buffer, 0, newBuffer, 0, yy_buffer.length);
+ yy_buffer = newBuffer;
+ }
+
+ /* finally: fill the buffer with new input */
+ int numRead = yy_reader.read(yy_buffer, yy_endRead,
+ yy_buffer.length-yy_endRead);
+
+ if (numRead < 0) {
+ return true;
+ }
+ else {
+ yy_endRead+= numRead;
+ return false;
+ }
+ }
+
+
+ /**
+ * Closes the input stream.
+ */
+ final public void yyclose() throws java.io.IOException {
+ yy_atEOF = true; /* indicate end of file */
+ yy_endRead = yy_startRead; /* invalidate buffer */
+
+ if (yy_reader != null)
+ yy_reader.close();
+ }
+
+
+ /**
+ * Closes the current stream, and resets the
+ * scanner to read from a new input stream.
+ *
+ * All internal variables are reset, the old input stream
+ * cannot be reused (internal buffer is discarded and lost).
+ * Lexical state is set to YY_INITIAL.
+ *
+ * @param reader the new input stream
+ */
+ final public void yyreset(java.io.Reader reader) throws java.io.IOException {
+ yyclose();
+ yy_reader = reader;
+ yy_atBOL = true;
+ yy_atEOF = false;
+ yy_endRead = yy_startRead = 0;
+ yy_currentPos = yy_markedPos = yy_pushbackPos = 0;
+ yyline = yychar = yycolumn = 0;
+ yy_lexical_state = YYINITIAL;
+ }
+
+
+ /**
+ * Returns the current lexical state.
+ */
+ final public int yystate() {
+ return yy_lexical_state;
+ }
+
+
+ /**
+ * Enters a new lexical state
+ *
+ * @param newState the new lexical state
+ */
+ final public void yybegin(int newState) {
+ yy_lexical_state = newState;
+ }
+
+
+ /**
+ * Returns the text matched by the current regular expression.
+ */
+ final public String yytext() {
+ return new String( yy_buffer, yy_startRead, yy_markedPos-yy_startRead );
+ }
+
+
+ /**
+ * Returns the character at position pos from the
+ * matched text.
+ *
+ * It is equivalent to yytext().charAt(pos), but faster
+ *
+ * @param pos the position of the character to fetch.
+ * A value from 0 to yylength()-1.
+ *
+ * @return the character at position pos
+ */
+ final public char yycharat(int pos) {
+ return yy_buffer[yy_startRead+pos];
+ }
+
+
+ /**
+ * Returns the length of the matched text region.
+ */
+ final public int yylength() {
+ return yy_markedPos-yy_startRead;
+ }
+
+
+ /**
+ * Reports an error that occured while scanning.
+ *
+ * In a wellformed scanner (no or only correct usage of
+ * yypushback(int) and a match-all fallback rule) this method
+ * will only be called with things that "Can't Possibly Happen".
+ * If this method is called, something is seriously wrong
+ * (e.g. a JFlex bug producing a faulty scanner etc.).
+ *
+ * Usual syntax/scanner level error handling should be done
+ * in error fallback rules.
+ *
+ * @param errorCode the code of the errormessage to display
+ */
+ private void yy_ScanError(int errorCode) {
+ String message;
+ try {
+ message = YY_ERROR_MSG[errorCode];
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ message = YY_ERROR_MSG[YY_UNKNOWN_ERROR];
+ }
+
+ throw new Error(message);
+ }
+
+
+ /**
+ * Pushes the specified amount of characters back into the input stream.
+ *
+ * They will be read again by then next call of the scanning method
+ *
+ * @param number the number of characters to be read again.
+ * This number must not be greater than yylength()!
+ */
+ private void yypushback(int number) {
+ if ( number > yylength() )
+ yy_ScanError(YY_PUSHBACK_2BIG);
+
+ yy_markedPos -= number;
+ }
+
+
+ /**
+ * Contains user EOF-code, which will be executed exactly once,
+ * when the end of file is reached
+ */
+ private void yy_do_eof() throws java.io.IOException {
+ if (!yy_eof_done) {
+ yy_eof_done = true;
+ yyclose();
+ }
+ }
+
+
+ /**
+ * Resumes scanning until the next regular expression is matched,
+ * the end of input is encountered or an I/O-Error occurs.
+ *
+ * @return the next token
+ * @exception IOException if any I/O-Error occurs
+ */
+ public java_cup.runtime.Symbol next_token() throws java.io.IOException {
+ int yy_input;
+ int yy_action;
+
+ // cached fields:
+ int yy_currentPos_l;
+ int yy_startRead_l;
+ int yy_markedPos_l;
+ int yy_endRead_l = yy_endRead;
+ char [] yy_buffer_l = yy_buffer;
+ char [] yycmap_l = yycmap;
+
+ int [] yytrans_l = yytrans;
+ int [] yy_rowMap_l = yy_rowMap;
+ byte [] yy_attr_l = YY_ATTRIBUTE;
+ int yy_pushbackPos_l = yy_pushbackPos = -1;
+ boolean yy_was_pushback;
+
+ while (true) {
+ yy_markedPos_l = yy_markedPos;
+
+ boolean yy_r = false;
+ for (yy_currentPos_l = yy_startRead; yy_currentPos_l < yy_markedPos_l;
+ yy_currentPos_l++) {
+ switch (yy_buffer_l[yy_currentPos_l]) {
+ case '\u000B':
+ case '\u000C':
+ case '\u0085':
+ case '\u2028':
+ case '\u2029':
+ yyline++;
+ yycolumn = 0;
+ yy_r = false;
+ break;
+ case '\r':
+ yyline++;
+ yycolumn = 0;
+ yy_r = true;
+ break;
+ case '\n':
+ if (yy_r)
+ yy_r = false;
+ else {
+ yyline++;
+ yycolumn = 0;
+ }
+ break;
+ default:
+ yy_r = false;
+ yycolumn++;
+ }
+ }
+
+ if (yy_r) {
+ // peek one character ahead if it is \n (if we have counted one line too much)
+ boolean yy_peek;
+ if (yy_markedPos_l < yy_endRead_l)
+ yy_peek = yy_buffer_l[yy_markedPos_l] == '\n';
+ else if (yy_atEOF)
+ yy_peek = false;
+ else {
+ boolean eof = yy_refill();
+ yy_markedPos_l = yy_markedPos;
+ yy_buffer_l = yy_buffer;
+ if (eof)
+ yy_peek = false;
+ else
+ yy_peek = yy_buffer_l[yy_markedPos_l] == '\n';
+ }
+ if (yy_peek) yyline--;
+ }
+ yy_action = -1;
+
+ yy_startRead_l = yy_currentPos_l = yy_currentPos =
+ yy_startRead = yy_markedPos_l;
+
+ yy_state = yy_lexical_state;
+
+ yy_was_pushback = false;
+
+ yy_forAction: {
+ while (true) {
+
+ if (yy_currentPos_l < yy_endRead_l)
+ yy_input = yy_buffer_l[yy_currentPos_l++];
+ else if (yy_atEOF) {
+ yy_input = YYEOF;
+ break yy_forAction;
+ }
+ else {
+ // store back cached positions
+ yy_currentPos = yy_currentPos_l;
+ yy_markedPos = yy_markedPos_l;
+ yy_pushbackPos = yy_pushbackPos_l;
+ boolean eof = yy_refill();
+ // get translated positions and possibly new buffer
+ yy_currentPos_l = yy_currentPos;
+ yy_markedPos_l = yy_markedPos;
+ yy_buffer_l = yy_buffer;
+ yy_endRead_l = yy_endRead;
+ yy_pushbackPos_l = yy_pushbackPos;
+ if (eof) {
+ yy_input = YYEOF;
+ break yy_forAction;
+ }
+ else {
+ yy_input = yy_buffer_l[yy_currentPos_l++];
+ }
+ }
+ int yy_next = yytrans_l[ yy_rowMap_l[yy_state] + yycmap_l[yy_input] ];
+ if (yy_next == -1) break yy_forAction;
+ yy_state = yy_next;
+
+ int yy_attributes = yy_attr_l[yy_state];
+ if ( (yy_attributes & 2) == 2 )
+ yy_pushbackPos_l = yy_currentPos_l;
+
+ if ( (yy_attributes & 1) == 1 ) {
+ yy_was_pushback = (yy_attributes & 4) == 4;
+ yy_action = yy_state;
+ yy_markedPos_l = yy_currentPos_l;
+ if ( (yy_attributes & 8) == 8 ) break yy_forAction;
+ }
+
+ }
+ }
+
+ // store back cached position
+ yy_markedPos = yy_markedPos_l;
+ if (yy_was_pushback)
+ yy_markedPos = yy_pushbackPos_l;
+
+ switch (yy_action) {
+
+ case 314:
+ { return symbol(sym.IMPLEMENTS); }
+ case 341: break;
+ case 298:
+ case 307:
+ { return symbol(sym.DECLARE_VAR); }
+ case 342: break;
+ case 0:
+ case 16:
+ case 23:
+ case 24:
+ case 25:
+ case 26:
+ case 27:
+ case 28:
+ case 29:
+ case 30:
+ case 31:
+ case 32:
+ case 33:
+ case 75:
+ case 81:
+ case 82:
+ case 83:
+ case 84:
+ case 85:
+ case 86:
+ case 87:
+ case 88:
+ case 89:
+ case 90:
+ case 91:
+ case 92:
+ case 93:
+ case 94:
+ case 95:
+ case 96:
+ case 97:
+ case 127:
+ case 129:
+ case 131:
+ case 132:
+ case 133:
+ case 134:
+ case 135:
+ case 136:
+ case 138:
+ case 139:
+ case 140:
+ case 141:
+ case 142:
+ case 143:
+ case 144:
+ case 159:
+ case 161:
+ case 162:
+ case 163:
+ case 164:
+ case 165:
+ case 166:
+ case 167:
+ case 168:
+ case 170:
+ case 171:
+ case 172:
+ case 173:
+ case 175:
+ case 176:
+ case 189:
+ case 190:
+ case 191:
+ case 192:
+ case 194:
+ case 195:
+ case 197:
+ case 198:
+ case 199:
+ case 200:
+ case 201:
+ case 203:
+ case 204:
+ case 213:
+ case 214:
+ case 215:
+ case 216:
+ case 218:
+ case 219:
+ case 221:
+ case 224:
+ case 225:
+ case 226:
+ case 227:
+ case 232:
+ case 233:
+ case 237:
+ case 241:
+ case 245:
+ case 246:
+ case 248:
+ case 249:
+ case 254:
+ case 257:
+ case 258:
+ case 259:
+ case 260:
+ case 261:
+ case 262:
+ case 265:
+ case 266:
+ case 276:
+ case 277:
+ case 278:
+ case 279:
+ case 280:
+ case 281:
+ case 284:
+ case 294:
+ case 295:
+ case 296:
+ case 297:
+ case 299:
+ case 309:
+ case 311:
+ case 312:
+ case 313:
+ case 320:
+ case 321:
+ case 323:
+ case 328:
+ case 329:
+ case 334:
+ case 335:
+ { return symbol(sym.IDENTIFIER); }
+ case 343: break;
+ case 58:
+ case 59:
+ { yybegin(YYINITIAL); yypushback(yylength()); }
+ case 344: break;
+ case 79:
+ { return symbol(sym.MINUSMINUS); }
+ case 345: break;
+ case 122:
+ { return symbol(sym.RPAREN_FUNC); }
+ case 346: break;
+ case 157:
+ { return symbol(sym.LPAREN_FUNC); }
+ case 347: break;
+ case 300:
+ { return symbol(sym.INTERFACE); }
+ case 348: break;
+ case 287:
+ { return symbol(sym.FUNCTION); }
+ case 349: break;
+ case 45:
+ { return symbol(sym.QUESTION); }
+ case 350: break;
+ case 78:
+ { return symbol(sym.PLUSPLUS); }
+ case 351: break;
+ case 101:
+ { return symbol(sym.NOTEQUALS); }
+ case 352: break;
+ case 126:
+ { return symbol(sym.DOTDOTDOT); }
+ case 353: break;
+ case 47:
+ { return symbol(sym.AT); }
+ case 354: break;
+ case 46:
+ { return symbol(sym.AND); }
+ case 355: break;
+ case 42:
+ { return symbol(sym.NOT); }
+ case 356: break;
+ case 40:
+ { return symbol(sym.LT); }
+ case 357: break;
+ case 35:
+ { return symbol(sym.COL); }
+ case 358: break;
+ case 10:
+ { return symbol(sym.DIV); }
+ case 359: break;
+ case 8:
+ { /* ignore */ }
+ case 360: break;
+ case 3:
+ case 54:
+ { /* ignore */ }
+ case 361: break;
+ case 15:
+ { return symbol(sym.GT); }
+ case 362: break;
+ case 17:
+ case 18:
+ case 76:
+ case 77:
+ { return symbol(sym.INT); }
+ case 363: break;
+ case 21:
+ { return symbol(sym.DOT); }
+ case 364: break;
+ case 53:
+ { return symbol(sym.LF); }
+ case 365: break;
+ case 74:
+ { return symbol(sym.GTE); }
+ case 366: break;
+ case 100:
+ { return symbol(sym.LTE); }
+ case 367: break;
+ case 125:
+ { return symbol(sym.INT); }
+ case 368: break;
+ case 130:
+ { return symbol(sym.NEW); }
+ case 369: break;
+ case 160:
+ { return symbol(sym.IS); }
+ case 370: break;
+ case 169:
+ { return symbol(sym.AS); }
+ case 371: break;
+ case 202:
+ { return symbol(sym.VAR); }
+ case 372: break;
+ case 210:
+ { return symbol(sym.DOC); }
+ case 373: break;
+ case 5:
+ case 55:
+ case 56:
+ case 57:
+ { System.out.println("unmatched:"+yytext()); }
+ case 374: break;
+ case 178:
+ { yybegin(YYINITIAL); return symbol(sym.TYPE_MACRO); }
+ case 375: break;
+ case 322:
+ case 326:
+ { return symbol(sym.DECLARE_CLASS); }
+ case 376: break;
+ case 310:
+ case 316:
+ { return symbol(sym.DECLARE_ENUM); }
+ case 377: break;
+ case 243:
+ { return symbol(sym.CONST); }
+ case 378: break;
+ case 242:
+ { return symbol(sym.CLASS); }
+ case 379: break;
+ case 44:
+ { return symbol(sym.TUBE); }
+ case 380: break;
+ case 41:
+ { return symbol(sym.COMMA); }
+ case 381: break;
+ case 36:
+ { return symbol(sym.SEMI); }
+ case 382: break;
+ case 11:
+ { return symbol(sym.MULT); }
+ case 383: break;
+ case 19:
+ { return symbol(sym.PLUS); }
+ case 384: break;
+ case 20:
+ { return symbol(sym.MINUS); }
+ case 385: break;
+ case 64:
+ { return symbol(sym.TUBE); }
+ case 386: break;
+ case 102:
+ case 103:
+ { return symbol(sym.TUBE); }
+ case 387: break;
+ case 105:
+ { return symbol(sym.OROR); }
+ case 388: break;
+ case 217:
+ { return symbol(sym.ENUM); }
+ case 389: break;
+ case 220:
+ { return symbol(sym.FROM); }
+ case 390: break;
+ case 49:
+ { string.append('\\'); }
+ case 391: break;
+ case 52:
+ { string.append('\\'); }
+ case 392: break;
+ case 107:
+ { string.append('\\'); }
+ case 393: break;
+ case 108:
+ { string.append('\"'); }
+ case 394: break;
+ case 109:
+ { string.append('\n'); }
+ case 395: break;
+ case 110:
+ { string.append('\t'); }
+ case 396: break;
+ case 111:
+ { string.append('\r'); }
+ case 397: break;
+ case 112:
+ { string.append('\''); }
+ case 398: break;
+ case 65:
+ { yybegin(EOL_COMMENT); }
+ case 399: break;
+ case 338:
+ case 339:
+ { return symbol(sym.DECLARE_FUNCTION); }
+ case 400: break;
+ case 50:
+ { yybegin(YYINITIAL);
+ return symbol(sym.IDENTIFIER,
+ "\""+string.toString()+"\""); }
+ case 401: break;
+ case 229:
+ { yypushback(yylength()); yybegin(TYPE_MACRO); }
+ case 402: break;
+ case 6:
+ case 7:
+ { /*System.err.println("LF");*/ return symbol(sym.LF); }
+ case 403: break;
+ case 155:
+ case 184:
+ { /*System.err.println("COMMENT: "+yytext());*/ /* ignore */ }
+ case 404: break;
+ case 22:
+ { string.setLength(0); yybegin(CHAR); }
+ case 405: break;
+ case 330:
+ case 333:
+ { return symbol(sym.DECLARE_MODULE); }
+ case 406: break;
+ case 9:
+ { string.setLength(0); yybegin(STRING); }
+ case 407: break;
+ case 282:
+ { return symbol(sym.PRIVATE); }
+ case 408: break;
+ case 264:
+ { return symbol(sym.PUBLIC); }
+ case 409: break;
+ case 255:
+ { return symbol(sym.STATIC); }
+ case 410: break;
+ case 253:
+ { return symbol(sym.EXTENDS); }
+ case 411: break;
+ case 250:
+ { return symbol(sym.TYPEOF); }
+ case 412: break;
+ case 240:
+ { return symbol(sym.EXPORT); }
+ case 413: break;
+ case 235:
+ { return symbol(sym.IMPORT); }
+ case 414: break;
+ case 51:
+ { string.append( yytext() ); }
+ case 415: break;
+ case 48:
+ { string.append( yytext() ); }
+ case 416: break;
+ case 43:
+ { return symbol(sym.MATCHES); }
+ case 417: break;
+ case 39:
+ { return symbol(sym.RSPAREN); }
+ case 418: break;
+ case 38:
+ { return symbol(sym.LSPAREN); }
+ case 419: break;
+ case 37:
+ { return symbol(sym.RCPAREN); }
+ case 420: break;
+ case 34:
+ { return symbol(sym.LCPAREN); }
+ case 421: break;
+ case 12:
+ { return symbol(sym.RPAREN); }
+ case 422: break;
+ case 13:
+ { return symbol(sym.LPAREN); }
+ case 423: break;
+ case 14:
+ { return symbol(sym.ASSIGN); }
+ case 424: break;
+ case 72:
+ { return symbol(sym.EQUALS); }
+ case 425: break;
+ case 73:
+ { return symbol(sym.IMPLIES); }
+ case 426: break;
+ case 80:
+ { return symbol(sym.DOTDOT); }
+ case 427: break;
+ case 99:
+ { return symbol(sym.SQUARE); }
+ case 428: break;
+ case 106:
+ { return symbol(sym.ANDAND); }
+ case 429: break;
+ default:
+ if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
+ yy_atEOF = true;
+ yy_do_eof();
+ switch (yy_lexical_state) {
+ case EOL_COMMENT:
+ { yybegin(YYINITIAL); }
+ case 341: break;
+ default:
+ { return new java_cup.runtime.Symbol(sym.EOF); }
+ }
+ }
+ else {
+ yy_ScanError(YY_NO_MATCH);
+ }
+ }
+ }
+ }
+
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/sym.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/sym.java
new file mode 100644
index 00000000..c32f2431
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/sym.java
@@ -0,0 +1,88 @@
+
+//----------------------------------------------------
+// The following code was generated by CUP v0.10k
+// Sun Jul 24 16:44:06 CEST 2016
+//----------------------------------------------------
+
+package org.jsweet.input.typescriptdef.parser;
+
+/** CUP generated class containing symbol constants. */
+public class sym {
+ /* terminals */
+ public static final int AT = 37;
+ public static final int AS = 69;
+ public static final int IDENTIFIER = 43;
+ public static final int FROM = 70;
+ public static final int GT = 18;
+ public static final int TYPEOF = 66;
+ public static final int IMPLEMENTS = 63;
+ public static final int CONST = 67;
+ public static final int EXPORT = 47;
+ public static final int DECLARE_MODULE = 54;
+ public static final int SEMI = 7;
+ public static final int DECLARE_FUNCTION = 55;
+ public static final int ENUM = 71;
+ public static final int LPAREN_FUNC = 73;
+ public static final int SQUARE = 14;
+ public static final int COMMA = 3;
+ public static final int RPAREN = 9;
+ public static final int LT = 15;
+ public static final int ANDAND = 31;
+ public static final int OROR = 30;
+ public static final int DECLARE = 53;
+ public static final int LPAREN = 8;
+ public static final int PROTECTED = 50;
+ public static final int FALSE = 42;
+ public static final int NOT = 33;
+ public static final int DOTDOTDOT = 6;
+ public static final int LF = 72;
+ public static final int TYPE_MACRO = 58;
+ public static final int RCPAREN = 11;
+ public static final int VAR = 61;
+ public static final int NOTEQUALS = 21;
+ public static final int LCPAREN = 10;
+ public static final int DECLARE_ENUM = 57;
+ public static final int NUM = 40;
+ public static final int DOLLAR = 45;
+ public static final int CLASS = 60;
+ public static final int ABSTRACT = 52;
+ public static final int TUBE = 34;
+ public static final int TRUE = 41;
+ public static final int MATCHES = 36;
+ public static final int PLUS = 26;
+ public static final int QUESTION = 44;
+ public static final int EXTENDS = 62;
+ public static final int ASSIGN = 19;
+ public static final int INTERFACE = 59;
+ public static final int RPAREN_FUNC = 74;
+ public static final int DIV = 23;
+ public static final int PUBLIC = 51;
+ public static final int MULT = 22;
+ public static final int DOTDOT = 5;
+ public static final int DOT = 4;
+ public static final int INT = 39;
+ public static final int LTE = 16;
+ public static final int REFERENCE = 29;
+ public static final int EOF = 0;
+ public static final int COL = 2;
+ public static final int FUNCTION = 48;
+ public static final int DOC = 28;
+ public static final int IMPORT = 46;
+ public static final int RSPAREN = 13;
+ public static final int IS = 68;
+ public static final int MINUS = 24;
+ public static final int ARROW_RIGHT = 38;
+ public static final int error = 1;
+ public static final int GTE = 17;
+ public static final int MINUSMINUS = 25;
+ public static final int LSPAREN = 12;
+ public static final int PLUSPLUS = 27;
+ public static final int NEW = 64;
+ public static final int DECLARE_CLASS = 56;
+ public static final int AND = 32;
+ public static final int PRIVATE = 49;
+ public static final int IMPLIES = 35;
+ public static final int STATIC = 65;
+ public static final int EQUALS = 20;
+}
+
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/test.d.ts b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/test.d.ts
new file mode 100644
index 00000000..78122b5d
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/test.d.ts
@@ -0,0 +1,108 @@
+
+enum StatusEnum {
+ connected, connecting,
+ failed, waiting, offline
+}
+
+interface NodeListOf extends NodeList, T, U {
+ length: {
+ }
+ item(index: number /** Buffer **/ ): TNode;
+ [index: number]: TNode;
+ static : number;
+ static: number;
+ extends: string;
+ extends : string;
+ /**
+ * test
+ */
+}
+
+class Model extends ModelBase {
+
+ object(...keyValuePairs: any[][]): T;
+
+ /**
+ * Do not use, prefer TypeScript's extend functionality.
+ **/
+ private static extend(properties: any, classProperties?: any): any;
+
+ attributes: any;
+ changed: any[];
+ cid: string;
+ collection: Collection;
+}
+
+module 'm' {
+
+ // test
+
+ type T = string | number;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // SCEService
+ // see http://docs.angularjs.org/api/ng.$sce
+ ///////////////////////////////////////////////////////////////////////////
+
+ /**
+ * titi
+ */
+ interface ISCEService {
+ getTrusted(type: string, mayBeTrusted: any): any;
+ }
+
+ interface Tinytest {
+ add(name:string, func:Function):any;
+ addAsync(name:string, func:Function):any;
+ }
+
+ enum StatusEnum {
+ connected,
+ connecting,
+ failed,
+ waiting,
+ offline
+ }
+
+ export = i;
+
+ /** the * promise of the original server interaction that created this instance. ** **/
+ interface I2<{ test: string; }> extends I {
+
+ /** The notify function can either be passed a string or an object. */
+
+ (translationId: string[], interpolateParams?: any, interpolationId?: string): ng.IPromise<{ [key: string]: string }>;
+
+ var test: string;
+
+ a(b: any, c : number): string;
+
+ b(f : ((n: number) => void )[]) : t.x.y;
+
+ [a : number] : T;
+
+ (b: any, c: number): string;
+
+ a2(b: { p1: P1; f(x:number):string; } [], c : number): string;
+
+ function getLevel(nameOrValue: string): webdriver.logging.Level;
+
+ sendKeys(...var_args: string[]): webdriver.promise.Promise;
+ }
+
+ module logging {
+ var Preferences: any;
+
+ class LevelName extends webdriver.logging.LevelName { }
+ class Type extends webdriver.logging.Type { }
+ class Level extends webdriver.logging.Level { }
+ class Entry extends webdriver.logging.Entry { }
+
+ function getLevel(nameOrValue: string): webdriver.logging.Level;
+ function getLevel(nameOrValue: number): webdriver.logging.Level;
+ }
+
+
+}
+
+// TODO: support object_type @tsdef\angular-http-auth\angular-http-auth.d.ts
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/typescriptdef.cup b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/typescriptdef.cup
new file mode 100644
index 00000000..969c5da5
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/typescriptdef.cup
@@ -0,0 +1,628 @@
+
+/*
+ * This source code file is the exclusive property of its author. No copy or
+ * usage of the source code is permitted unless the author contractually
+ * allows it under the terms of a well-defined agreement.
+ */
+
+import java.util.*;
+import java.io.*;
+import org.apache.commons.lang3.*;
+import org.jsweet.input.typescriptdef.ast.*;
+
+parser code {:
+
+ public PrintStream out = System.out;
+ public PrintStream err = System.err;
+ public CompilationUnit compilationUnit;
+ public Stack comments = new Stack();
+
+ protected static TypescriptDefParser createParser(File file) throws java.io.FileNotFoundException {
+ TypescriptDefScanner scanner= new TypescriptDefScanner(new java.io.FileReader(file));
+ scanner.setFileName(file.getPath());
+ TypescriptDefParser parser= new TypescriptDefParser(scanner);
+ parser.compilationUnit = new CompilationUnit(file);
+ return parser;
+ }
+
+ public static TypescriptDefParser parseFile(File file) throws java.io.FileNotFoundException {
+ TypescriptDefParser parser= createParser(file);
+ try {
+ parser.parse();
+ } catch(Exception e) {
+ e.printStackTrace();
+ parser.errors.add(new SyntaxError(null, "internal parser error"));
+ }
+ return parser;
+ }
+
+ public List errors = new ArrayList();
+
+ public void syntax_error(java_cup.runtime.Symbol current) {
+ //errors.add(new SyntaxError("syntax error: '"+current.value + "' is not expected", at " + (current.left+1)+"("+(current.right+1)+")" );
+ SyntaxError e = new SyntaxError((Token)current.value, "'"+current.value + "' is not expected");
+ errors.add(e);
+ System.err.println(e);
+ }
+
+ public void syntax_error(Token current) {
+ SyntaxError e = new SyntaxError(current, "'"+current + "' is not expected");
+ errors.add(e);
+ System.err.println(e);
+ }
+
+ public void unrecovered_syntax_error(java_cup.runtime.Symbol current) {
+ System.err.println("unable to recover from previous error(s)... giving up!");
+ }
+
+ public void printErrors(PrintStream out) {
+ for (SyntaxError error : errors) {
+ out.println(error.toString());
+ }
+ }
+
+ public boolean hasErrors() {
+ return !errors.isEmpty();
+ }
+
+
+
+:};
+
+terminal COL, COMMA, DOT, DOTDOT, DOTDOTDOT, SEMI;
+terminal LPAREN, RPAREN, LCPAREN, RCPAREN, LSPAREN, RSPAREN, SQUARE;
+terminal LT, LTE, GTE, GT, ASSIGN, EQUALS, NOTEQUALS, MULT, DIV, MINUS, MINUSMINUS, PLUS, PLUSPLUS;
+terminal DOC, REFERENCE;
+
+terminal OROR, ANDAND, AND, NOT, TUBE, IMPLIES, MATCHES;
+terminal AT, ARROW_RIGHT;
+terminal INT, NUM, TRUE, FALSE;
+terminal IDENTIFIER;
+terminal QUESTION, DOLLAR;
+// keywords
+terminal IMPORT, EXPORT, FUNCTION, PRIVATE, PROTECTED, PUBLIC, ABSTRACT;
+terminal DECLARE, /*DECLARE_VAR,*/ DECLARE_MODULE, DECLARE_FUNCTION, DECLARE_CLASS, DECLARE_ENUM, TYPE_MACRO;
+terminal INTERFACE, CLASS, VAR, EXTENDS, IMPLEMENTS, NEW;
+//terminal MODULE;
+terminal STATIC, TYPEOF, CONST, IS, AS, FROM;
+terminal ENUM;
+terminal LF;
+terminal LPAREN_FUNC, RPAREN_FUNC;
+
+non terminal comp_unit, declaration_list_opt, declaration_list, declaration_with_error, declaration, declaration_nodoc;
+non terminal type_macro, type_decl, type_kind, var_decl, module_decl, func_decl, constructor_decl, index_sig_decl, export_decl, import_decl;
+non terminal param_list_opt, param_list, param, optional_opt, varargs_opt;
+non terminal member_list_opt, member_list, member_elt_with_error, member_elt, member_elt_nodoc;
+non terminal enum_decl, enum_member_list, enum_member_list_opt, enum_member_elt_with_error, enum_member_elt, enum_member_elt_nodoc;
+non terminal type_annotation_opt, type_annotation, type, basic_type, union_type, intersection_type, array_type, functional_type, new_functional_type, simple_type, object_type, typeof_type, is_type, tuple_type;
+non terminal declare_opt, var_opt, const_opt;
+non terminal qual_id;
+non terminal import_spec;
+non terminal type_param_list_opt, type_param_list, type_param;
+non terminal type_arg_list_opt, type_arg_list, type_arg_and;
+non terminal extends_opt, implements_opt;
+non terminal lf, semi_or_lf, semi_or_lf_opt, lf_opt, semi_or_comma_or_lf, semi_or_comma_or_lf_opt;
+non terminal type_list;
+non terminal doc_list, doc_list_opt, doc_opt;
+non terminal literal, export_opt, var_or_const, abstract_opt, export_element_list, export_element;
+
+precedence left AND, TUBE;
+precedence right LF;
+precedence right COMMA;
+precedence right DOC;
+
+start with comp_unit;
+
+/***************************************************************/
+/*** TYPESCRIPT DEFINITION FILES GRAMMAR **/
+/***************************************************************/
+
+comp_unit ::= declaration_list_opt:decls {: parser.compilationUnit.setDeclarations((Declaration[])decls); :};
+
+declaration_list_opt ::= lf_opt declaration_list:l semi_or_lf_opt {:
+ parser.comments.pop();
+ RESULT = l;
+ :} | lf_opt {: RESULT = new Declaration[0]; :};
+
+declaration_list ::= declaration_list:l semi_or_lf declaration_with_error:d
+ {:
+ if(d instanceof Declaration) {
+ Declaration[] list = (Declaration[])l;
+ Token doc = parser.comments.peek()[0];
+ if(doc!=null) {
+ ((Declaration)d).setDocumentation(doc.toString());
+ parser.comments.peek()[0]=null;
+ }
+ RESULT = ArrayUtils.add(list, (Declaration)d);
+ } else {
+ if(d instanceof Token) {
+ parser.comments.peek()[0] = (Token)d;
+ }
+ RESULT = l;
+ }
+ :}
+ | declaration_with_error:d {:
+ if(d instanceof Declaration) {
+ parser.comments.push(new Token[] { null });
+ RESULT = new Declaration[] { (Declaration)d };
+ } else {
+ parser.comments.push(new Token[] { (Token)d });
+ RESULT = new Declaration[0];
+ }
+ :}
+ ;
+
+declaration_with_error ::= declaration:d {: RESULT=d; :} | error;
+
+declaration ::= declaration_nodoc:d {: RESULT=d; :}
+ | DOC:d {:
+ RESULT=d;
+ :}
+;
+
+declaration_nodoc ::=
+ type_macro:d {: RESULT=d; :}
+ | type_decl:d {: RESULT=d; :}
+ | enum_decl:d {: RESULT=d; :}
+ | module_decl:d {: RESULT=d; :}
+ | var_decl:d {: RESULT=d; :}
+ | func_decl:d {: RESULT=d; :}
+ | export_decl:d {: RESULT=d; :}
+ | import_decl:d {: RESULT=d; :}
+;
+
+export_decl ::= EXPORT ASSIGN IDENTIFIER:exportedIdentifier lf_opt
+ {:
+ RESULT = new ReferenceDeclaration((Token)exportedIdentifier, null, exportedIdentifier.toString());
+ :}
+ | EXPORT LCPAREN export_element_list RCPAREN lf_opt
+ ;
+
+export_element_list ::= export_element_list:l COMMA lf_opt export_element:t
+ | export_element:t
+;
+
+export_element ::= IDENTIFIER | IDENTIFIER AS IDENTIFIER;
+
+export_opt ::= EXPORT |;
+
+import_decl ::=
+ export_opt IMPORT import_spec:s
+ {:
+ RESULT = s;
+ :}
+;
+
+import_spec ::=
+ MULT AS IDENTIFIER:alias FROM qual_id:imported
+ {:
+ RESULT = new ReferenceDeclaration((Token)alias, alias.toString(), imported.toString());
+ :}
+ | IDENTIFIER:alias ASSIGN qual_id:imported
+ {:
+ RESULT = new ReferenceDeclaration((Token)alias, alias.toString(), imported.toString());
+ :}
+ | IDENTIFIER:alias ASSIGN IDENTIFIER:require LPAREN qual_id:imported RPAREN
+ {:
+ if(!"require".equals(require.toString())) {
+ parser.syntax_error((Token)require);
+ } else {
+ RESULT = new ReferenceDeclaration((Token)alias, alias.toString(), imported.toString());
+ }
+ :}
+
+;
+
+type_macro ::= TYPE_MACRO IDENTIFIER:alias type_param_list_opt:tparams ASSIGN lf_opt type:type
+ {:
+ RESULT = new TypeMacroDeclaration((Token)alias, alias.toString(), (TypeParameterDeclaration[])tparams, (TypeReference)type);
+ :}
+ |
+ EXPORT TYPE_MACRO IDENTIFIER:alias type_param_list_opt:tparams ASSIGN type:type
+ {:
+ RESULT = new TypeMacroDeclaration((Token)alias, alias.toString(), (TypeParameterDeclaration[])tparams, (TypeReference)type);
+ :}
+;
+
+type_decl ::= declare_opt abstract_opt type_kind:def IDENTIFIER:name type_param_list_opt:tparams extends_opt:t implements_opt:t2 lf_opt LCPAREN member_list_opt:members RCPAREN
+ {:
+ RESULT = new TypeDeclaration((Token)name,def.toString(),name.toString(),(TypeParameterDeclaration[])tparams,t==null?(TypeReference[])t2:ArrayUtils.addAll((TypeReference[])t,(TypeReference[])t2),(Declaration[])members);
+ :} | declare_opt DECLARE_CLASS IDENTIFIER:name type_param_list_opt:tparams extends_opt:t implements_opt:t2 lf_opt LCPAREN member_list_opt:members RCPAREN
+ {:
+ RESULT = new TypeDeclaration((Token)name,"class",name.toString(),(TypeParameterDeclaration[])tparams,t==null?(TypeReference[])t2:ArrayUtils.addAll((TypeReference[])t,(TypeReference[])t2),(Declaration[])members);
+ :}
+;
+
+const_opt ::= CONST {: RESULT = true; :} | {: RESULT = false; :};
+
+abstract_opt ::= ABSTRACT {: RESULT = "abstract"; :} | ;
+
+enum_decl ::= declare_opt DECLARE_ENUM IDENTIFIER:name type_param_list_opt:tparams lf_opt LCPAREN enum_member_list_opt:members RCPAREN
+ {:
+ RESULT = new TypeDeclaration((Token)name,"enum",name.toString(),(TypeParameterDeclaration[])tparams,null,(Declaration[])members);
+ :}
+ | declare_opt const_opt ENUM IDENTIFIER:name type_param_list_opt:tparams lf_opt LCPAREN enum_member_list_opt:members RCPAREN
+ {:
+ RESULT = new TypeDeclaration((Token)name,"enum",name.toString(),(TypeParameterDeclaration[])tparams,null,(Declaration[])members);
+ :}
+;
+
+enum_member_list_opt ::= lf_opt enum_member_list:l lf_opt {: RESULT = l; :}
+ | lf_opt {: RESULT = new Declaration[0]; :};
+
+enum_member_list ::= enum_member_list:l COMMA lf_opt enum_member_elt_with_error:e
+ {:
+ if(e!=null) {
+ Declaration[] list = (Declaration[])l;
+ RESULT = ArrayUtils.add(list, (Declaration)e);
+ } else {
+ RESULT=l;
+ }
+ :}
+ | enum_member_elt_with_error:e
+ {:
+ if(e!=null) {
+ RESULT=new Declaration[] { (Declaration)e };
+ } else {
+ RESULT=new Declaration[0];
+ }
+ :}
+ | enum_member_list:l COMMA lf_opt
+ {:
+ RESULT=l;
+ :}
+ | enum_member_list:l lf_opt doc_list lf_opt
+ {:
+ RESULT=l;
+ :}
+ | enum_member_list:l COMMA lf_opt doc_list lf_opt
+ {:
+ RESULT=l;
+ :}
+;
+
+enum_member_elt_with_error ::= enum_member_elt:d {: RESULT=d; :} | error;
+
+enum_member_elt ::= doc_list:doc lf_opt enum_member_elt_nodoc:d
+ {:
+ if(d!=null) {
+ Declaration decl = (Declaration)d;
+ decl.setDocumentation(doc.toString());
+ RESULT=d;
+ }
+ :}
+ | enum_member_elt_nodoc:d
+ {:
+ RESULT=d;
+ :}
+;
+
+enum_member_elt_nodoc ::= IDENTIFIER:name {:
+ RESULT = new VariableDeclaration((Token)name, name.toString(), null, false, true);
+ :}
+ | IDENTIFIER:name ASSIGN literal:value {:
+ Literal literal = new Literal((Token)value, value.toString());
+ VariableDeclaration var = new VariableDeclaration((Token)name, name.toString(), null, false, true);
+ var.setInitializer(literal);
+ RESULT = var;
+ :}
+;
+
+literal ::= INT:i {: RESULT=i; :};
+
+type_kind ::= INTERFACE:def {: RESULT=def; :} | CLASS:def {: RESULT=def; :};
+
+extends_opt ::= EXTENDS type_list:t {: RESULT = t; :} | ;
+
+implements_opt ::= IMPLEMENTS lf_opt type_list:t {: RESULT = t; :} | ;
+
+type_list ::= type_list:l COMMA lf_opt type:t
+ {:
+ TypeReference[] list = (TypeReference[])l;
+ RESULT = ArrayUtils.add(list, (TypeReference)t);
+ :}
+| type:t
+ {:
+ RESULT=new TypeReference[] { (TypeReference)t };
+ :}
+;
+
+member_list_opt ::= lf_opt member_list:l semi_or_comma_or_lf_opt {:
+ parser.comments.pop();
+ RESULT = l;
+ :}
+ | lf_opt {: RESULT = new Declaration[0]; :};
+
+lf ::= lf LF | LF;
+
+lf_opt ::= lf |;
+
+semi_or_lf ::= SEMI lf | SEMI | lf;
+
+semi_or_lf_opt ::= semi_or_lf |;
+
+semi_or_comma_or_lf ::= SEMI lf | SEMI | COMMA lf | COMMA | lf;
+
+semi_or_comma_or_lf_opt ::= semi_or_comma_or_lf |;
+
+member_list ::= member_list:l semi_or_comma_or_lf member_elt_with_error:d
+ {:
+ if(d instanceof Declaration) {
+ Declaration[] list = (Declaration[])l;
+ Token doc = parser.comments.peek()[0];
+ if(doc!=null) {
+ ((Declaration)d).setDocumentation(doc.toString());
+ parser.comments.peek()[0]=null;
+ }
+ RESULT = ArrayUtils.add(list, (Declaration)d);
+ } else {
+ if(d instanceof Token) {
+ parser.comments.peek()[0] = (Token)d;
+ }
+ RESULT=l;
+ }
+ :}
+ | member_elt_with_error:d
+ {:
+ if(d instanceof Declaration) {
+ parser.comments.push(new Token[] { null });
+ RESULT = new Declaration[] { (Declaration)d };
+ } else {
+ parser.comments.push(new Token[] { (Token)d });
+ RESULT = new Declaration[0];
+ }
+ :}
+;
+
+member_elt_with_error ::= member_elt:d {: RESULT=d; :} | error;
+
+member_elt ::= member_elt_nodoc:d
+ {:
+ RESULT=d;
+ :}
+ | DOC:doc
+ {:
+ RESULT=doc;
+ :}
+;
+
+doc_list ::= DOC:doc lf_opt doc_list {: RESULT=doc; :} | DOC:doc lf_opt {: RESULT=doc; :};
+
+doc_list_opt ::= doc_list:l {: RESULT=l; :} |;
+
+doc_opt ::= DOC | ;
+
+member_elt_nodoc ::=
+ var_decl:d {: RESULT=d; :}
+ | func_decl:d {: RESULT=d; :}
+ | index_sig_decl:d {: RESULT=d; :}
+ | constructor_decl:d {: RESULT=d; :}
+;
+
+module_decl ::= declare_opt IDENTIFIER:t qual_id:name lf_opt LCPAREN declaration_list_opt:declarations RCPAREN
+ {:
+ if(!(t.toString().equals("module")||t.toString().equals("namespace"))) {
+ parser.syntax_error((Token)t);
+ }
+ RESULT = ModuleDeclaration.createQualifiedModuleDeclaration((Token)t,name.toString(),(Declaration[])declarations);
+ :}
+ | DECLARE_MODULE:t qual_id:name lf_opt LCPAREN declaration_list_opt:declarations RCPAREN
+ {:
+ RESULT = ModuleDeclaration.createQualifiedModuleDeclaration((Token)t,name.toString(),(Declaration[])declarations);
+ :}
+;
+
+var_or_const ::= VAR {: RESULT=false; :} | CONST {: RESULT = true; :};
+
+var_decl ::= declare_opt:mod var_or_const:readonly IDENTIFIER:name optional_opt:opt lf_opt type_annotation_opt:t
+ {:
+ VariableDeclaration var = new VariableDeclaration((Token)name,name.toString(),(TypeReference)t, (Boolean)opt, (Boolean)readonly);
+ if(mod!=null) var.addModifier((String)mod);
+ var.setHidden(var.hasModifier("private"));
+ RESULT = var;
+ :}
+ | declare_opt:mod IDENTIFIER:name optional_opt:opt lf_opt type_annotation_opt:t
+ {:
+ VariableDeclaration var = new VariableDeclaration((Token)name,name.toString(),(TypeReference)t, (Boolean)opt, false);
+ if(mod!=null) var.addModifier((String)mod);
+ var.setHidden(var.hasModifier("private"));
+ RESULT = var;
+ :}
+ | declare_opt:mod INT:name optional_opt:opt lf_opt type_annotation_opt:t
+ {:
+ VariableDeclaration var = new VariableDeclaration((Token)name,name.toString(),(TypeReference)t, (Boolean)opt, false);
+ if(mod!=null) var.addModifier((String)mod);
+ var.setHidden(var.hasModifier("private"));
+ RESULT = var;
+ :}
+ // case of a variable called 'new'
+ | declare_opt:mod NEW:name optional_opt:opt lf_opt type_annotation_opt:t
+ {:
+ VariableDeclaration var = new VariableDeclaration((Token)name,name.toString(),(TypeReference)t, (Boolean)opt, false);
+ if(mod!=null) var.addModifier((String)mod);
+ var.setHidden(var.hasModifier("private"));
+ RESULT = var;
+ :}
+// | DECLARE_VAR IDENTIFIER:name optional_opt:opt type_annotation_opt:t
+// {:
+// RESULT = new VariableDeclaration((Token)name,name.toString(),(TypeReference)t, (Boolean)opt);
+// :}
+;
+
+optional_opt ::= QUESTION {: RESULT=true; :} | {: RESULT=false; :};
+
+func_decl ::= declare_opt:mod IDENTIFIER:name optional_opt:opt type_param_list_opt:tparams LPAREN param_list_opt:params RPAREN type_annotation_opt:t
+ {:
+ //System.err.println("1");
+ FunctionDeclaration func = new FunctionDeclaration((Token)name,name.toString(),(TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+ if(mod!=null) func.addModifier((String)mod);
+ func.setHidden(func.hasModifier("private"));
+ RESULT = func;
+ :}
+ | declare_opt:mod FUNCTION IDENTIFIER:name optional_opt:opt type_param_list_opt:tparams LPAREN param_list_opt:params RPAREN type_annotation_opt:t
+ {:
+ //System.err.println("2");
+ FunctionDeclaration func = new FunctionDeclaration((Token)name,name.toString(),(TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+ if(mod!=null) func.addModifier((String)mod);
+ func.setHidden(func.hasModifier("private"));
+ RESULT = func;
+ :}
+ | DECLARE_FUNCTION IDENTIFIER:name optional_opt:opt type_param_list_opt:tparams LPAREN param_list_opt:params RPAREN type_annotation_opt:t
+ {:
+ //System.err.println("3");
+ RESULT = new FunctionDeclaration((Token)name,name.toString(),(TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+ :}
+;
+
+constructor_decl ::= declare_opt:mod type_param_list_opt:tparams LPAREN:token param_list_opt:params RPAREN type_annotation_opt:t
+ {:
+ //System.err.println("4");
+ RESULT = new FunctionDeclaration((Token)token,FunctionDeclaration.ANONYMOUS_FUNCTION_RESERVED_NAME,(TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+ :}
+ | declare_opt:mod NEW type_param_list_opt:tparams LPAREN:token param_list_opt:params RPAREN type_annotation_opt:t
+ {:
+ //System.err.println("5");
+ RESULT = new FunctionDeclaration((Token)token,FunctionDeclaration.NEW_FUNCTION_RESERVED_NAME,(TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+ :}
+;
+
+index_sig_decl ::= declare_opt type_param_list_opt:tparams LSPAREN:token param:param RSPAREN type_annotation_opt:t
+ {:
+ RESULT = new FunctionDeclaration((Token)token,FunctionDeclaration.INDEXSIG_RESERVED_NAME,(TypeReference)t, new ParameterDeclaration[] {(ParameterDeclaration)param}, (TypeParameterDeclaration[])tparams);
+ :} |
+ declare_opt CONST:readonly type_param_list_opt:tparams LSPAREN:token param:param RSPAREN type_annotation_opt:t
+ {:
+ RESULT = new FunctionDeclaration((Token)token,FunctionDeclaration.INDEXSIG_RESERVED_NAME,(TypeReference)t, new ParameterDeclaration[] {(ParameterDeclaration)param}, (TypeParameterDeclaration[])tparams);
+ :}
+;
+
+param_list_opt ::= lf_opt param_list:l lf_opt {: RESULT = l; :}
+ | lf_opt {: RESULT = new ParameterDeclaration[0]; :}
+;
+
+param_list ::= param_list:l lf_opt COMMA lf_opt param:p
+ {:
+ ParameterDeclaration[] list = (ParameterDeclaration[])l;
+ RESULT = ArrayUtils.add(list, (ParameterDeclaration)p);
+ :}
+ | param:p
+ {:
+ RESULT=new ParameterDeclaration[] { (ParameterDeclaration)p };
+ :}
+;
+
+param ::= doc_opt lf_opt varargs_opt:varargs IDENTIFIER:i optional_opt:opt type_annotation_opt:t doc_opt lf_opt
+ {:
+ RESULT = new ParameterDeclaration( (Token)i, i.toString(), (TypeReference)t, (Boolean)opt, varargs!=null);
+ :}
+;
+
+varargs_opt ::= DOTDOTDOT:varargs {: RESULT=varargs; :} | ;
+
+type_annotation_opt ::= type_annotation:t {: RESULT=t; :} |
+;
+
+type_annotation ::= COL lf_opt doc_opt lf_opt type:t {: RESULT=t; :}
+;
+
+type ::=
+ functional_type:t {: RESULT=t; :}
+ | typeof_type:t {: RESULT=t; :}
+ | is_type:t {: RESULT=t; :}
+ | union_type:t {: RESULT=t; :}
+ | intersection_type:t {: RESULT=t; :}
+ | object_type:t {: RESULT=t; :}
+ | array_type:t {: RESULT=t; :}
+ | simple_type:t {: RESULT=t; :}
+ | tuple_type:t {: RESULT=t; :}
+;
+
+union_type ::= type:t1 TUBE:t lf_opt type:t2 {: RESULT=new UnionTypeReference((Token)t, (TypeReference)t1, (TypeReference)t2); :}
+ | LPAREN union_type:t RPAREN {: RESULT=t; :}
+;
+
+intersection_type ::= type:t1 AND:t lf_opt type:t2 {: RESULT=new UnionTypeReference((Token)t, (TypeReference)t1, (TypeReference)t2, true); :}
+ | LPAREN intersection_type:t RPAREN {: RESULT=t; :}
+;
+
+simple_type ::= qual_id:q type_arg_list_opt:tparams {: RESULT=new TypeReference(null, (String)q, (TypeReference[])tparams); :};
+
+tuple_type ::=
+ LSPAREN type_list:types RSPAREN {: RESULT=new TypeReference(null, "$tuple$", (TypeReference[])types); :}
+;
+
+array_type ::=
+ simple_type:t SQUARE {: RESULT=new ArrayTypeReference( null, (TypeReference)t); :}
+ | object_type:t SQUARE {: RESULT=new ArrayTypeReference( null, (TypeReference)t); :}
+ | tuple_type:t SQUARE {: RESULT=new ArrayTypeReference( null, (TypeReference)t); :}
+ | LPAREN functional_type:t RPAREN SQUARE {: RESULT=new ArrayTypeReference(null, (TypeReference)t); :}
+ | array_type:t SQUARE {: RESULT=new ArrayTypeReference(null, (TypeReference)t); :}
+ | LPAREN union_type:t RPAREN SQUARE {: RESULT=new ArrayTypeReference(null, (TypeReference)t); :}
+;
+
+functional_type ::=
+ type_param_list_opt:tparams LPAREN_FUNC:token param_list_opt:params RPAREN_FUNC IMPLIES type:t {:
+ RESULT=new FunctionalTypeReference((Token)token, (TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+ :}
+ | NEW:i type_param_list_opt:tparams LPAREN_FUNC param_list_opt:params RPAREN_FUNC IMPLIES type:t {:
+ RESULT=new FunctionalTypeReference((Token)i, true, (TypeReference)t, (ParameterDeclaration[])params, (TypeParameterDeclaration[])tparams);
+ :}
+ | LPAREN functional_type:t RPAREN {: RESULT=t; :}
+;
+
+object_type ::= LCPAREN:token member_list_opt:members RCPAREN {: RESULT=new TypeReference((Token)token, (Declaration[])members); :}
+ | LPAREN object_type:t RPAREN {: RESULT=t; :}
+;
+
+typeof_type ::= TYPEOF qual_id:name {: TypeReference t = new TypeReference(null, (String)name, null); t.setTypeOf(true); RESULT=t; :}
+ | LPAREN TYPEOF qual_id:name RPAREN {: TypeReference t = new TypeReference(null, (String)name, null); t.setTypeOf(true); RESULT=t; :}
+;
+
+is_type ::= IDENTIFIER IS type {: RESULT=new TypeReference(null, "boolean", null); :}
+ | LPAREN IDENTIFIER IS type RPAREN {: RESULT=new TypeReference(null, "boolean", null); :}
+;
+
+declare_opt ::= EXPORT | DECLARE | STATIC {: RESULT = "static"; :} | PRIVATE {: RESULT = "private"; :} | PROTECTED {: RESULT = "protected"; :} | PRIVATE STATIC {: RESULT = "private static"; :} | PROTECTED STATIC {: RESULT = "protected static"; :} | PUBLIC {: RESULT = "public"; :} | PUBLIC STATIC {: RESULT = "public static"; :} | ;
+//declare_opt ::= DECLARE | EXPORT | ;
+//declare_opt ::= IDENTIFIER:i {: if(!i.toString().equals("declare") || !i.toString().equals("declare")) { throw new RuntimeException("declare or export expected: "); } RESULT=i; :} | ;
+
+qual_id ::= IDENTIFIER:i {: RESULT=i.toString(); :}
+ | IDENTIFIER:i DOT qual_id:q {: RESULT=i.toString()+"."+q.toString(); :}
+;
+
+type_arg_list_opt ::= LT type_arg_list:tparams GT {: RESULT = tparams; :} | ;
+
+type_arg_list ::= type_arg_list:l COMMA type:p
+ {:
+ TypeReference[] list = (TypeReference[])l;
+ RESULT = ArrayUtils.add(list, (TypeReference)p);
+ :}
+ | type:p
+ {:
+ RESULT=new TypeReference[] { (TypeReference)p };
+ :}
+;
+
+type_param_list_opt ::= LT type_param_list:tparams GT {: RESULT = tparams; :} | ;
+
+type_param_list ::= type_param_list:l COMMA type_param:p
+ {:
+ TypeParameterDeclaration[] list = (TypeParameterDeclaration[])l;
+ RESULT = ArrayUtils.add(list, (TypeParameterDeclaration)p);
+ :}
+ | type_param:p
+ {:
+ RESULT=new TypeParameterDeclaration[] { (TypeParameterDeclaration)p };
+ :}
+;
+
+type_param ::= type:t
+ {:
+ RESULT=new TypeParameterDeclaration(((TypeReference)t).getToken(), ((TypeReference)t).getName());
+ :}
+ | type:t EXTENDS type:s
+ {:
+ RESULT=new TypeParameterDeclaration(((TypeReference)t).getToken(), ((TypeReference)t).getName());
+ ((TypeParameterDeclaration)RESULT).setUpperBound((TypeReference)s);
+ :}
+;
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/typescriptdef.lex b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/typescriptdef.lex
new file mode 100644
index 00000000..188cd3a8
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/parser/typescriptdef.lex
@@ -0,0 +1,225 @@
+
+/*
+ * This source code file is the exclusive property of its author. No copy or
+ * usage of the source code is permitted unless the author contractually
+ * allows it under the terms of a well-defined agreement.
+ */
+
+package org.jsweet.input.typescriptdef.parser;
+
+import java_cup.runtime.*;
+import org.jsweet.input.typescriptdef.ast.Token;
+import java.util.*;
+
+%%
+
+%class TypescriptDefScanner
+%unicode
+%cup
+%line
+%column
+%state STRING
+%state CHAR
+%state TYPE_MACRO
+%state EOL_COMMENT
+
+%{
+ StringBuffer string=new StringBuffer();
+ String fileName;
+ public void setFileName(String name) {
+ fileName=name;
+ }
+ public String getFileName() {
+ return fileName;
+ }
+ private Symbol symbol(int type) {
+ return new Symbol(type,yyline,yycolumn,
+ new Token(type,fileName,yytext(),
+ yyline+1,yycolumn+1,
+ yycolumn+1+yytext().length()));
+ }
+ private Symbol symbol(int type, String value) {
+ return new Symbol(type,yyline,yycolumn,
+ new Token(type,fileName,value,
+ yyline+1,yycolumn+1,
+ yycolumn+1+yytext().length()));
+ }
+ private Stack openParens = new Stack();
+%}
+
+LineTerminator= \r|\n|\r\n
+InputCharacter = [^\r\n]
+WhiteSpace = {LineTerminator} | [ \t\f]
+WhiteSpaceChar = [ \t\f]
+Comment = {TraditionalComment} | {EndOfLineComment}
+
+StringText=(\\\"|[^\n\"]|\\{WhiteSpaceChar}*\\)*
+
+TraditionalComment = "/*" ~"*/"
+// Comment can be the last line of the file, without line terminator.
+//MetaComment = "///" {WhiteSpaceChar}* "<" {InputCharacter}* {LineTerminator}?
+EndOfLineComment = "//" {InputCharacter}* {LineTerminator}
+DocumentationComment = "/**" {CommentContent} [^*] "*/"
+CommentContent = ( [^*] | \*+ [^/*] )*
+O = [^()]*
+FunctionalTypeEnding = {O} ({O} "(" {O} ({O} "(" {O} ({O} "(" {O} ")" {O})* {O} ")" {O})* {O} ")" {O})* {O} ")" {WhiteSpaceChar}* "=>"
+
+Identifier = [A-Za-z0-9_$]*
+
+DecIntegerLiteral = [0-9] | [1-9][0-9]*
+HexDigit = [0-9A-Fa-f]
+Sign = ("+"|"-")
+DecFloatLiteral = {DecIntegerLiteral}\.{DecIntegerLiteral}
+
+KeywordEnding = {WhiteSpaceChar}+ [\'\"A-Za-z0-9_$/]
+SpecialKeywordEnding = {WhiteSpaceChar}+ [\'\"\[A-Za-z0-9_$/]
+//KeywordEnding = {WhiteSpaceChar}?[ ]?[^:(;]
+
+%%
+
+ {
+ /* keywords */
+ "interface" / {KeywordEnding} { return symbol(sym.INTERFACE); }
+ "class" / {KeywordEnding} { return symbol(sym.CLASS); }
+ //"declare" {WhiteSpace}* "var" { return symbol(sym.DECLARE_VAR); }
+ //"declare" {WhiteSpace}* "let" { return symbol(sym.DECLARE_VAR); }
+ //"declare" {WhiteSpace}* "const" { return symbol(sym.DECLARE_VAR); }
+ "declare" {WhiteSpace}* "module" { return symbol(sym.DECLARE_MODULE); }
+ "declare" {WhiteSpace}* "namespace" { return symbol(sym.DECLARE_MODULE); }
+ "declare" {WhiteSpace}* "function" { return symbol(sym.DECLARE_FUNCTION); }
+ "declare" {WhiteSpace}* "class" { return symbol(sym.DECLARE_CLASS); }
+ "declare" {WhiteSpace}* "enum" { return symbol(sym.DECLARE_ENUM); }
+ {LineTerminator} {WhiteSpaceChar}* "type" / {KeywordEnding} { yypushback(yylength()); yybegin(TYPE_MACRO); }
+ {LineTerminator} {WhiteSpaceChar}* "export" {WhiteSpace}* "type" / {KeywordEnding} { yypushback(yylength()); yybegin(TYPE_MACRO); }
+ {LineTerminator} {WhiteSpaceChar}* "declare" {WhiteSpace}* "type" / {KeywordEnding} { yypushback(yylength()); yybegin(TYPE_MACRO); }
+// {MetaComment} { return symbol(sym.REFERENCE); }
+ // most keyword can be used as identifiers, so we differentiate them with special ending
+ "declare" / {KeywordEnding} { return symbol(sym.DECLARE); }
+ "var" / {KeywordEnding} { return symbol(sym.VAR); }
+ "let" / {KeywordEnding} { return symbol(sym.VAR); }
+ //"const" / {KeywordEnding} { return symbol(sym.VAR); }
+ "static" / {KeywordEnding} { return symbol(sym.STATIC); }
+ "abstract" / {KeywordEnding} { return symbol(sym.ABSTRACT); }
+ "extends" / {KeywordEnding} { return symbol(sym.EXTENDS); }
+ "extends" / {WhiteSpaceChar}* "{" { return symbol(sym.EXTENDS); }
+ "extends" / {WhiteSpaceChar}* "(" {FunctionalTypeEnding} { return symbol(sym.EXTENDS); }
+ "implements" / {KeywordEnding} { return symbol(sym.IMPLEMENTS); }
+ "import" / {KeywordEnding} { return symbol(sym.IMPORT); }
+ "import" / {WhiteSpaceChar}* "*" { return symbol(sym.IMPORT); }
+ "export" / {KeywordEnding} { return symbol(sym.EXPORT); }
+ "export" / {WhiteSpace}* "=" { return symbol(sym.EXPORT); }
+ "export" / {WhiteSpace}* "{" { return symbol(sym.EXPORT); }
+ "private" / {KeywordEnding} { return symbol(sym.PRIVATE); }
+ "protected" / {KeywordEnding} { return symbol(sym.PROTECTED); }
+ "public" / {KeywordEnding} { return symbol(sym.PUBLIC); }
+ "function" / {KeywordEnding} { return symbol(sym.FUNCTION); }
+ "typeof" / {KeywordEnding} { return symbol(sym.TYPEOF); }
+ "enum" / {KeywordEnding} { return symbol(sym.ENUM); }
+ "const" / {KeywordEnding} { return symbol(sym.CONST); }
+ "readonly" / {SpecialKeywordEnding} { return symbol(sym.CONST); }
+ "is" / {KeywordEnding} { return symbol(sym.IS); }
+ "as" / {KeywordEnding} { return symbol(sym.AS); }
+ "from" / {KeywordEnding} { return symbol(sym.FROM); }
+ "new" { return symbol(sym.NEW); }
+
+ {Sign}? {DecIntegerLiteral} { return symbol(sym.INT); }
+ [0][xX]{HexDigit}+ { return symbol(sym.INT); }
+// {DecFloatLiteral} { return symbol(sym.NUM); }
+ {Identifier} { return symbol(sym.IDENTIFIER); }
+ ":" { return symbol(sym.COL); }
+ // hack to allow lf before : (would lead to hard disambiguation problem in the parser)
+ {LineTerminator} {WhiteSpaceChar}* ":" { return symbol(sym.COL); }
+ ";" { return symbol(sym.SEMI); }
+ "(" / {FunctionalTypeEnding} { return symbol(sym.LPAREN_FUNC); }
+ ")" / {WhiteSpaceChar}* "=>" { return symbol(sym.RPAREN_FUNC); }
+ "(" { return symbol(sym.LPAREN); }
+ ")" { return symbol(sym.RPAREN); }
+ "{" { return symbol(sym.LCPAREN); }
+ "}" { return symbol(sym.RCPAREN); }
+ "[" {WhiteSpaceChar}* "]" { return symbol(sym.SQUARE); }
+ "[" { return symbol(sym.LSPAREN); }
+ "]" { return symbol(sym.RSPAREN); }
+ "<" { return symbol(sym.LT); }
+ ">" { return symbol(sym.GT); }
+ "<=" { return symbol(sym.LTE); }
+ ">=" { return symbol(sym.GTE); }
+ "," { return symbol(sym.COMMA); }
+ "." { return symbol(sym.DOT); }
+ "=" { return symbol(sym.ASSIGN); }
+ "==" { return symbol(sym.EQUALS); }
+ "!=" { return symbol(sym.NOTEQUALS); }
+ "~" { return symbol(sym.MATCHES); }
+ "||" { return symbol(sym.OROR); }
+ "?" { return symbol(sym.QUESTION); }
+ "&" { return symbol(sym.AND); }
+ "&&" { return symbol(sym.ANDAND); }
+ "=>" { return symbol(sym.IMPLIES); }
+ "!" { return symbol(sym.NOT); }
+ "+" { return symbol(sym.PLUS); }
+ "++" { return symbol(sym.PLUSPLUS); }
+ "-" { return symbol(sym.MINUS); }
+ "--" { return symbol(sym.MINUSMINUS); }
+ "/" { return symbol(sym.DIV); }
+ "*" { return symbol(sym.MULT); }
+ // hack to allow lf after | (would lead to hard disambiguation problem in the parser)
+ "|" {WhiteSpaceChar}* {LineTerminator} { return symbol(sym.TUBE); }
+ "|" { return symbol(sym.TUBE); }
+ // hack to allow lf before | (would lead to hard disambiguation problem in the parser)
+ {LineTerminator} {WhiteSpaceChar}* "|" {WhiteSpaceChar}* {LineTerminator}? { return symbol(sym.TUBE); }
+ "..." { return symbol(sym.DOTDOTDOT); }
+ ".." { return symbol(sym.DOTDOT); }
+ "@" { return symbol(sym.AT); }
+ "'" { string.setLength(0); yybegin(CHAR); }
+ \" { string.setLength(0); yybegin(STRING); }
+ {DocumentationComment} { return symbol(sym.DOC); }
+ {TraditionalComment} { /*System.err.println("COMMENT: "+yytext());*/ /* ignore */ }
+ "//" { yybegin(EOL_COMMENT); }
+ {LineTerminator} { /*System.err.println("LF");*/ return symbol(sym.LF); }
+ {WhiteSpaceChar} { /* ignore */ }
+ //{WhiteSpace} { /* ignore */ }
+ [] { /* ignore */ }
+}
+
+ {
+ \" { yybegin(YYINITIAL);
+ return symbol(sym.IDENTIFIER,
+ "\""+string.toString()+"\""); }
+ [^\n\r\"\\]+ { string.append( yytext() ); }
+ \\t { string.append('\t'); }
+ \\n { string.append('\n'); }
+
+ \\r { string.append('\r'); }
+ \\\" { string.append('\"'); }
+ \\\\ { string.append('\\'); }
+ \\ { string.append('\\'); }
+}
+
+ {
+ \' { yybegin(YYINITIAL);
+ return symbol(sym.IDENTIFIER,
+ "\""+string.toString()+"\""); }
+ [^\n\r\'\\]+ { string.append( yytext() ); }
+ \\t { string.append('\t'); }
+ \\n { string.append('\n'); }
+
+ \\r { string.append('\r'); }
+ \\\' { string.append('\''); }
+ \\\\ { string.append('\\'); }
+ \\ { string.append('\\'); }
+}
+
+ {
+ {LineTerminator} ({WhiteSpace}* | {Comment})* { return symbol(sym.LF); }
+ "type" { yybegin(YYINITIAL); return symbol(sym.TYPE_MACRO); }
+ "export" { /* ignore */ }
+ "declare" { /* ignore */ }
+ {WhiteSpaceChar}* { /* ignore */ }
+}
+
+ {
+ {LineTerminator} { yybegin(YYINITIAL); yypushback(yylength()); }
+ <> { yybegin(YYINITIAL); }
+ [^] { /* ignore */ }
+}
+
+.|\n { System.out.println("unmatched:"+yytext()); }
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/util/CopyrightHelper.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/util/CopyrightHelper.java
new file mode 100644
index 00000000..61f41c7d
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/util/CopyrightHelper.java
@@ -0,0 +1,57 @@
+package org.jsweet.input.typescriptdef.util;
+
+import java.io.File;
+
+import org.apache.commons.io.FileUtils;
+
+public class CopyrightHelper {
+
+ public static void main(String[] args) {
+ if (args.length < 2) {
+ System.err.println("usage: CopyrightHelper ");
+ System.exit(1);
+ }
+ File processedDir;
+ processedDir = new File(args[1]);
+ File copyrightFile = new File(args[0]);
+ if (!copyrightFile.exists()) {
+ System.err.println(copyrightFile + " does not exist");
+ System.err.println("current directory: "+ new File("").getAbsolutePath());
+ System.exit(1);
+ }
+ try {
+ String copyrightText = FileUtils.readFileToString(copyrightFile);
+ insertCopyright(processedDir, copyrightText);
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ System.exit(0);
+ }
+
+ private static void insertCopyright(File file, String licenceText) throws Exception {
+ for (File f : file.listFiles()) {
+ if (f.isDirectory()) {
+ insertCopyright(f, licenceText);
+ } else {
+ if (f.getName().endsWith(".java")) {
+ System.out.println("inserting copyright in " + f);
+ String text = FileUtils.readFileToString(f);
+ int insertIndex = text.indexOf("package");
+ int otherIndex = text.indexOf("/**");
+ if (otherIndex != -1) {
+ insertIndex = Math.min(insertIndex, otherIndex);
+ }
+ otherIndex = text.indexOf("@");
+ if (otherIndex != -1) {
+ insertIndex = Math.min(insertIndex, otherIndex);
+ }
+ text = text.substring(insertIndex);
+ FileUtils.write(f, licenceText + "\n");
+ FileUtils.write(f, text, true);
+ }
+ }
+ }
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/util/DeclarationFinder.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/util/DeclarationFinder.java
new file mode 100644
index 00000000..5f63f60e
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/util/DeclarationFinder.java
@@ -0,0 +1,71 @@
+package org.jsweet.input.typescriptdef.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jsweet.input.typescriptdef.ast.Context;
+import org.jsweet.input.typescriptdef.ast.Declaration;
+import org.jsweet.input.typescriptdef.ast.QualifiedDeclaration;
+import org.jsweet.input.typescriptdef.ast.Scanner;
+import org.jsweet.input.typescriptdef.ast.Visitable;
+
+public class DeclarationFinder extends Scanner {
+
+ public interface Matcher {
+ void matches(DeclarationFinder finder, Visitable visitable);
+ }
+
+ protected List> matches = new ArrayList<>();
+ private Matcher matcher;
+ private boolean match = false;
+ private boolean stopScan = false;
+
+ public DeclarationFinder(Context context, Matcher matcher) {
+ super(context);
+ this.matcher = matcher;
+ }
+
+ public DeclarationFinder(Scanner parentScanner, Matcher matcher) {
+ super(parentScanner);
+ this.matcher = matcher;
+ }
+
+ @Override
+ public void scan(Visitable visitable) {
+ if (visitable != null && !visitable.isHidden()) {
+ enter(visitable);
+ try {
+ matcher.matches(this, visitable);
+ if (match) {
+ @SuppressWarnings("unchecked")
+ T match = (T) visitable;
+ matches.add(new QualifiedDeclaration(match, getCurrentDeclarationName()));
+ }
+ if (!stopScan) {
+ visitable.accept(this);
+ }
+ } finally {
+ exit();
+ }
+ }
+ }
+
+ public List> getMatches() {
+ return matches;
+ }
+
+ /**
+ * To be called by a matcher to set the current match state of this finder.
+ *
+ * @param match
+ * tells is the matcher matches the current node
+ * @param continueScanning
+ * tells if the matcher want to continue scanning or stop at the
+ * current node
+ */
+ public void setMatchState(boolean match, boolean continueScanning) {
+ this.match = match;
+ this.stopScan = !continueScanning;
+ }
+
+}
diff --git a/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/util/DirectedGraph.java b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/util/DirectedGraph.java
new file mode 100644
index 00000000..42aadc87
--- /dev/null
+++ b/jsweet-candy-generator/src/main/java/org/jsweet/input/typescriptdef/util/DirectedGraph.java
@@ -0,0 +1,503 @@
+package org.jsweet.input.typescriptdef.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Consumer;
+
+/**
+ * This class defines a directed graph collection type, that is to say a set of
+ * elements (aka nodes) linked together with directed edges. It is particularly
+ * useful for the topological sort, which is implemented as depicted in
+ * Wikipedia and this StackOverflow thread
+ *
+ *
+ * Example of use:
+ *
+ *
+ * Graph<Integer> g = new Graph<Integer>();
+ * g.add(7, 5, 3, 11, 8, 2, 9, 10);
+ * g.buildEdges(new Comparator<Integer>() {
+ * @Override
+ * public int compare(Integer o1, Integer o2) {
+ * if (o1 == 5 && o2 == 3) {
+ * return 1;
+ * }
+ * return 0;
+ * }
+ * });
+ * System.out.println(g.topologicalSort());
+ *
+ *
+ *
+ * Prints out: [11, 10, 8, 7, 2, 3, 5, 9] (5 is always after 3,
+ * because of the edge built by the comparator, however, the remainder is in
+ * random order).
+ *
+ * @author Renaud Pawlak
+ *
+ * @param
+ * the types of the nodes in the graph
+ */
+public class DirectedGraph implements Collection