[jruby~main:33855d89] Java Method Signature parser (initial landing)

  • From: nicksieger@kenai.com
  • To: commits@jruby.kenai.com
  • Subject: [jruby~main:33855d89] Java Method Signature parser (initial landing)
  • Date: Wed, 3 Mar 2010 20:30:35 +0000

Project:    jruby
Repository: main
Revision:   33855d89f379f4760592cfe7e6a8b97fd5ba3d77
Author:     nicksieger
Date:       2010-03-03 20:29:40 UTC
Link:       

Log Message:
------------
Java Method Signature parser (initial landing)


Revisions:
----------
33855d89f379f4760592cfe7e6a8b97fd5ba3d77


Modified Paths:
---------------
default.build.properties


Added Paths:
------------
rakelib/parser.rake
src/org/jruby/ast/java_signature/MethodSignatureNode.java
src/org/jruby/ast/java_signature/Modifier.java
src/org/jruby/ast/java_signature/ParameterNode.java
src/org/jruby/ast/java_signature/PrimitiveTypeNode.java
src/org/jruby/ast/java_signature/ReferenceTypeNode.java
src/org/jruby/ast/java_signature/TypeNode.java
src/org/jruby/ast/java_signature/TypedReferenceNode.java
src/org/jruby/ast/java_signature/TypedReferenceTypeNode.java
src/org/jruby/lexer/JavaSignatureLexer.flex
src/org/jruby/lexer/JavaSignatureLexer.java
src/org/jruby/parser/JavaSignatureParser.java
src/org/jruby/parser/JavaSignatureParser.y
src/org/jruby/parser/ParserSyntaxException.java
src/org/jruby/parser/signature_skeleton.parser


Diffs:
------
diff --git a/default.build.properties b/default.build.properties
index 6a4caf2..577d1e5 100644
--- a/default.build.properties
+++ b/default.build.properties
@@ -23,6 +23,9 @@ mspec.tar.file=${build.dir}/mspec.tgz
 rubyspec.1.8.dir=${rubyspec.dir}/1.8
 spec.tags.dir=${spec.dir}/tags
 build.lib.dir=build_lib
+parser.dir=src/org/jruby/parser
+jflex.bin=jflex
+jay.bin=jay
 rspec.gem=${build.lib.dir}/rspec-1.3.0.gem
 rake.gem=${build.lib.dir}/rake-0.8.7.gem
 ruby.debug.gem=${build.lib.dir}/ruby-debug-0.10.3.gem
diff --git a/rakelib/parser.rake b/rakelib/parser.rake
new file mode 100644
index 0000000..5ef4ab5
--- /dev/null
+++ b/rakelib/parser.rake
@@ -0,0 +1,15 @@
+def jflex(file)
+  sh "#{JFLEX_BIN} #{file}"
+end
+
+def jay(name='JavaSignatureParser', skeleton='signature_skeleton.parser')
+  sh "#{JAY_BIN} #{PARSER_DIR}/#{name}.y  < #{PARSER_DIR}/#{skeleton} | grep 
-v ^//t > #{PARSER_DIR}/#{name}.java"
+end
+
+
+namespace :parse do
+  task :generate_java_signature_parser do
+    jflex 'src/org/jruby/lexer/JavaSignatureLexer.flex'
+    jay 'JavaSignatureParser', 'signature_skeleton.parser'
+  end
+end
diff --git a/src/org/jruby/ast/java_signature/MethodSignatureNode.java 
b/src/org/jruby/ast/java_signature/MethodSignatureNode.java
new file mode 100644
index 0000000..c785b6b
--- /dev/null
+++ b/src/org/jruby/ast/java_signature/MethodSignatureNode.java
@@ -0,0 +1,84 @@
+package org.jruby.ast.java_signature;
+
+import java.util.List;
+
+/**
+ * Java Method signature declaration
+ */
+public class MethodSignatureNode {
+    protected List<Modifier> modifiers;
+    protected String name;
+    protected List<ParameterNode> parameterList;
+    protected TypeNode returnType;
+    protected List<TypeNode> throwTypes;
+
+    public MethodSignatureNode(String name, List<ParameterNode> 
parameterList) {
+        this.name = name;
+        this.parameterList = parameterList;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public List<ParameterNode> getParameterList() {
+        return parameterList;
+    }
+
+    public TypeNode getReturnType() {
+        return returnType;
+    }
+
+    public void setReturnType(TypeNode returnType) {
+        this.returnType = returnType;
+    }
+
+    public void setModifiers(List<Modifier> modifiers) {
+        this.modifiers = modifiers;
+    }
+
+    public List<Modifier> getModifiers() {
+        return modifiers;
+    }
+
+    public void setThrows(List<TypeNode> throwTypes) {
+        this.throwTypes = throwTypes;
+    }
+
+    public List<TypeNode> getThrows() {
+        return throwTypes;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+
+        for (Modifier modifier: modifiers) {
+            builder.append(modifier).append(' ');
+        }
+        
+        builder.append(returnType).append(' ');
+        
+        builder.append(name).append('(');
+
+        int length = parameterList.size();
+        for (int i = 0; i < length - 1; i++) {
+            builder.append(parameterList.get(i)).append(", ");
+        }
+
+        if (length > 0) builder.append(parameterList.get(length - 1));
+
+        builder.append(')');
+
+        length = throwTypes.size();
+        if (length > 0) {
+            builder.append(" throws ");
+            for (int i = 0; i < length - 1; i++) {
+                builder.append(throwTypes.get(i)).append(", ");
+            }
+            builder.append(throwTypes.get(length - 1));
+        }
+
+        return builder.toString();
+    }
+}
\ No newline at end of file
diff --git a/src/org/jruby/ast/java_signature/Modifier.java 
b/src/org/jruby/ast/java_signature/Modifier.java
new file mode 100644
index 0000000..2e7e17e
--- /dev/null
+++ b/src/org/jruby/ast/java_signature/Modifier.java
@@ -0,0 +1,21 @@
+package org.jruby.ast.java_signature;
+
+/**
+ * valid method declaration modifiers
+ */
+public enum Modifier {
+    PUBLIC("public"), PROTECTED("protected"), PRIVATE("private"), 
STATIC("static"),
+    ABSTRACT("abstract"), FINAL("final"), NATIVE("native"), 
SYNCHRONIZED("synchronized"),
+    TRANSIENT("transient"), VOLATILE("volatile"), STRICTFP("strictfp");
+
+    private String name;
+
+    Modifier(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+}
diff --git a/src/org/jruby/ast/java_signature/ParameterNode.java 
b/src/org/jruby/ast/java_signature/ParameterNode.java
new file mode 100644
index 0000000..0ec11d7
--- /dev/null
+++ b/src/org/jruby/ast/java_signature/ParameterNode.java
@@ -0,0 +1,55 @@
+package org.jruby.ast.java_signature;
+
+// Fixme: varargs and variableNames with [] on them should ammend type on 
construction to save
+// consumer the effort.
+public class ParameterNode {
+    private final TypeNode type;
+    private final String variableName;
+    private boolean isFinal = false;
+    private boolean isVarArgs = false;
+    
+    public ParameterNode(TypeNode type, String variableName) {
+        this.type = type;
+        this.variableName = variableName;
+    }
+
+    public ParameterNode(TypeNode type, String variableName, boolean 
isFinal) {
+        this(type, variableName);
+
+        this.isFinal = isFinal;
+    }
+
+    public ParameterNode(TypeNode type, String variableName, boolean 
isFinal, boolean isVarArgs) {
+        this(type, variableName, isFinal);
+
+        this.isVarArgs = isVarArgs;
+    }
+
+    public TypeNode getType() {
+        return type;
+    }
+
+    public String getVariableName() {
+        return variableName;
+    }
+
+    public boolean isFinal() {
+        return isFinal;
+    }
+
+    public boolean isVarArgs() {
+        return isVarArgs;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+
+        if (isFinal) builder.append("final ");
+        builder.append(type);
+        if (isVarArgs()) builder.append("...");
+        if (variableName != null) builder.append(" ").append(variableName);
+
+        return builder.toString();
+    }
+}
diff --git a/src/org/jruby/ast/java_signature/PrimitiveTypeNode.java 
b/src/org/jruby/ast/java_signature/PrimitiveTypeNode.java
new file mode 100644
index 0000000..156f550
--- /dev/null
+++ b/src/org/jruby/ast/java_signature/PrimitiveTypeNode.java
@@ -0,0 +1,37 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jruby.ast.java_signature;
+
+/**
+ * For Java primitive types: byte, short, int, long, char, float, double, 
boolean, void
+ */
+public class PrimitiveTypeNode extends TypeNode {
+    public static PrimitiveTypeNode BYTE = new PrimitiveTypeNode("byte");
+    public static PrimitiveTypeNode SHORT = new PrimitiveTypeNode("short");
+    public static PrimitiveTypeNode INT = new PrimitiveTypeNode("int");
+    public static PrimitiveTypeNode LONG = new PrimitiveTypeNode("long");
+    public static PrimitiveTypeNode CHAR = new PrimitiveTypeNode("char");
+    public static PrimitiveTypeNode FLOAT = new PrimitiveTypeNode("float");
+    public static PrimitiveTypeNode DOUBLE = new PrimitiveTypeNode("double");
+    public static PrimitiveTypeNode BOOLEAN = new 
PrimitiveTypeNode("boolean");
+    public static PrimitiveTypeNode VOID = new PrimitiveTypeNode("void");
+
+    // This should only be used by constants above, but I left it a little 
open if you want to
+    // add your own new primitives!
+    protected PrimitiveTypeNode(String name) {
+        super(name);
+    }
+
+    @Override
+    public boolean isPrimitive() {
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+}
diff --git a/src/org/jruby/ast/java_signature/ReferenceTypeNode.java 
b/src/org/jruby/ast/java_signature/ReferenceTypeNode.java
new file mode 100644
index 0000000..1a406d9
--- /dev/null
+++ b/src/org/jruby/ast/java_signature/ReferenceTypeNode.java
@@ -0,0 +1,21 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jruby.ast.java_signature;
+
+/**
+ *
+ * @author enebo
+ */
+public class ReferenceTypeNode extends TypeNode {
+    public ReferenceTypeNode(String name) {
+        super(name);
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+}
diff --git a/src/org/jruby/ast/java_signature/TypeNode.java 
b/src/org/jruby/ast/java_signature/TypeNode.java
new file mode 100644
index 0000000..5733a38
--- /dev/null
+++ b/src/org/jruby/ast/java_signature/TypeNode.java
@@ -0,0 +1,33 @@
+package org.jruby.ast.java_signature;
+
+/**
+ * Base class for all typed nodes
+ */
+public class TypeNode {
+    protected String name;
+    protected boolean isArray = false;
+
+    public TypeNode(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public boolean isPrimitive() {
+        return false;
+    }
+
+    public boolean isTyped() {
+        return false;
+    }
+
+    public boolean isArray() {
+        return isArray;
+    }
+
+    public void setIsArray(boolean isArray) {
+        this.isArray = isArray;
+    }
+}
diff --git a/src/org/jruby/ast/java_signature/TypedReferenceNode.java 
b/src/org/jruby/ast/java_signature/TypedReferenceNode.java
new file mode 100644
index 0000000..26a5a73
--- /dev/null
+++ b/src/org/jruby/ast/java_signature/TypedReferenceNode.java
@@ -0,0 +1,14 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jruby.ast.java_signature;
+
+/**
+ *
+ * @author enebo
+ */
+public class TypedReferenceNode {
+
+}
diff --git a/src/org/jruby/ast/java_signature/TypedReferenceTypeNode.java 
b/src/org/jruby/ast/java_signature/TypedReferenceTypeNode.java
new file mode 100644
index 0000000..7b82668
--- /dev/null
+++ b/src/org/jruby/ast/java_signature/TypedReferenceTypeNode.java
@@ -0,0 +1,25 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jruby.ast.java_signature;
+
+/**
+ *
+ * @author enebo
+ */
+public class TypedReferenceTypeNode extends ReferenceTypeNode {
+    protected Object typeParameter;
+
+    public TypedReferenceTypeNode(String typeName, Object typeParameter) {
+        super(typeName);
+
+        this.typeParameter = typeParameter;
+    }
+
+    @Override
+    public boolean isTyped() {
+        return true;
+    }
+}
diff --git a/src/org/jruby/lexer/JavaSignatureLexer.flex 
b/src/org/jruby/lexer/JavaSignatureLexer.flex
new file mode 100644
index 0000000..20009a1
--- /dev/null
+++ b/src/org/jruby/lexer/JavaSignatureLexer.flex
@@ -0,0 +1,76 @@
+package org.jruby.lexer;
+
+import org.jruby.parser.JavaSignatureParser;
+
+%%
+%public
+%class JavaSignatureLexer
+%standalone
+%unicode
+%line
+%column
+%{
+  public Object value() {
+    return yytext();
+  }
+
+  public static JavaSignatureLexer create(java.io.InputStream stream) {
+    return new JavaSignatureLexer(stream);
+  }
+%}
+
+LineTerminator = \r|\n|\r\n
+InputCharacter = [^\r\n]
+WhiteSpace     = {LineTerminator} | [ \t\f]
+Identifier     = [:jletter:] [:jletterdigit:]*
+
+%%
+
+<YYINITIAL> {
+    // primitive types
+    "boolean"       { return JavaSignatureParser.BOOLEAN;      }
+    "byte"          { return JavaSignatureParser.VOID;         }
+    "short"         { return JavaSignatureParser.SHORT;        }
+    "int"           { return JavaSignatureParser.INT;          }
+    "long"          { return JavaSignatureParser.LONG;         }
+    "char"          { return JavaSignatureParser.CHAR;         }
+    "float"         { return JavaSignatureParser.FLOAT;        }
+    "double"        { return JavaSignatureParser.DOUBLE;       }
+    "void"          { return JavaSignatureParser.VOID;         }
+
+    // modifiers
+    "public"        { return JavaSignatureParser.PUBLIC;       }
+    "protected"     { return JavaSignatureParser.PROTECTED;    }
+    "private"       { return JavaSignatureParser.PRIVATE;      }
+    "static"        { return JavaSignatureParser.STATIC;       }
+    "abstract"      { return JavaSignatureParser.ABSTRACT;     }
+    "final"         { return JavaSignatureParser.FINAL;        }
+    "native"        { return JavaSignatureParser.NATIVE;       }
+    "synchronized"  { return JavaSignatureParser.SYNCHRONIZED; }
+    "transient"     { return JavaSignatureParser.TRANSIENT;    }
+    "volatile"      { return JavaSignatureParser.VOLATILE;     }
+    "strictfp"      { return JavaSignatureParser.STRICTFP;     }
+
+    "&"             { return JavaSignatureParser.AND;          }
+    "."             { return JavaSignatureParser.DOT;          }
+    ","             { return JavaSignatureParser.COMMA;        }
+    "\u2026"        { return JavaSignatureParser.ELLIPSIS;     }
+    "..."           { return JavaSignatureParser.ELLIPSIS;     }
+    "("             { return JavaSignatureParser.LPAREN;       }
+    ")"             { return JavaSignatureParser.RPAREN;       }
+    "["             { return JavaSignatureParser.LBRACK;       }
+    "]"             { return JavaSignatureParser.RBRACK;       }
+    "?"             { return JavaSignatureParser.QUESTION;     }
+    "<"             { return JavaSignatureParser.LT;           }
+    ">"             { return JavaSignatureParser.GT;           }
+    "throws"        { return JavaSignatureParser.THROWS;       }
+    "extends"       { return JavaSignatureParser.EXTENDS;      }
+    "super"         { return JavaSignatureParser.SUPER;        }
+    ">>"            { return JavaSignatureParser.RSHIFT;       }
+    ">>>"           { return JavaSignatureParser.URSHIFT;      }
+
+    {Identifier}              { return JavaSignatureParser.IDENTIFIER;   }
+    {WhiteSpace}              { }
+}
+
+.|\n  { throw new Error("Invalid character ("+yytext()+")"); }
diff --git a/src/org/jruby/lexer/JavaSignatureLexer.java 
b/src/org/jruby/lexer/JavaSignatureLexer.java
new file mode 100644
index 0000000..09a026f
--- /dev/null
+++ b/src/org/jruby/lexer/JavaSignatureLexer.java
@@ -0,0 +1,976 @@
+/* The following code was generated by JFlex 1.4.3 on 3/3/10 2:24 PM */
+
+package org.jruby.lexer;
+
+import org.jruby.parser.JavaSignatureParser;
+
+
+/**
+ * This class is a scanner generated by 
+ * <a href="http://www.jflex.de/";>JFlex</a> 1.4.3
+ * on 3/3/10 2:24 PM from the specification file
+ * <tt>src/org/jruby/lexer/JavaSignatureLexer.flex</tt>
+ */
+public class JavaSignatureLexer {
+
+  /** This character denotes the end of file */
+  public static final int YYEOF = -1;
+
+  /** initial size of the lookahead buffer */
+  private static final int ZZ_BUFFERSIZE = 16384;
+
+  /** lexical states */
+  public static final int YYINITIAL = 0;
+
+  /**
+   * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
+   * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
+   *                  at the beginning of a line
+   * l is of the form l = 2*k, k a non negative integer
+   */
+  private static final int ZZ_LEXSTATE[] = { 
+     0, 0
+  };
+
+  /** 
+   * Translates characters to character classes
+   */
+  private static final String ZZ_CMAP_PACKED = 
+    "\11\5\1\3\1\2\1\0\1\3\1\1\16\5\4\0\1\3\3\0"+
+    "\1\4\1\0\1\32\1\0\1\36\1\37\2\0\1\34\1\0\1\33"+
+    "\1\0\12\5\2\0\1\43\1\0\1\44\1\42\1\0\32\4\1\40"+
+    "\1\0\1\41\1\0\1\4\1\0\1\12\1\6\1\23\1\25\1\11"+
+    "\1\24\1\22\1\17\1\21\2\4\1\10\1\4\1\13\1\7\1\30"+
+    "\1\4\1\20\1\16\1\15\1\26\1\27\1\45\1\46\1\14\1\31"+
+    "\4\0\41\5\2\0\4\4\4\0\1\4\2\0\1\5\7\0\1\4"+
+    "\4\0\1\4\5\0\27\4\1\0\37\4\1\0\u013f\4\31\0\162\4"+
+    "\4\0\14\4\16\0\5\4\11\0\1\4\21\0\130\5\5\0\23\5"+
+    "\12\0\1\4\13\0\1\4\1\0\3\4\1\0\1\4\1\0\24\4"+
+    "\1\0\54\4\1\0\46\4\1\0\5\4\4\0\202\4\1\0\4\5"+
+    "\3\0\105\4\1\0\46\4\2\0\2\4\6\0\20\4\41\0\46\4"+
+    "\2\0\1\4\7\0\47\4\11\0\21\5\1\0\27\5\1\0\3\5"+
+    "\1\0\1\5\1\0\2\5\1\0\1\5\13\0\33\4\5\0\3\4"+
+    "\15\0\4\5\14\0\6\5\13\0\32\4\5\0\13\4\16\5\7\0"+
+    "\12\5\4\0\2\4\1\5\143\4\1\0\1\4\10\5\1\0\6\5"+
+    "\2\4\2\5\1\0\4\5\2\4\12\5\3\4\2\0\1\4\17\0"+
+    "\1\5\1\4\1\5\36\4\33\5\2\0\3\4\60\0\46\4\13\5"+
+    "\1\4\u014f\0\3\5\66\4\2\0\1\5\1\4\20\5\2\0\1\4"+
+    "\4\5\3\0\12\4\2\5\2\0\12\5\21\0\3\5\1\0\10\4"+
+    "\2\0\2\4\2\0\26\4\1\0\7\4\1\0\1\4\3\0\4\4"+
+    "\2\0\1\5\1\4\7\5\2\0\2\5\2\0\3\5\11\0\1\5"+
+    "\4\0\2\4\1\0\3\4\2\5\2\0\12\5\4\4\15\0\3\5"+
+    "\1\0\6\4\4\0\2\4\2\0\26\4\1\0\7\4\1\0\2\4"+
+    "\1\0\2\4\1\0\2\4\2\0\1\5\1\0\5\5\4\0\2\5"+
+    "\2\0\3\5\13\0\4\4\1\0\1\4\7\0\14\5\3\4\14\0"+
+    "\3\5\1\0\11\4\1\0\3\4\1\0\26\4\1\0\7\4\1\0"+
+    "\2\4\1\0\5\4\2\0\1\5\1\4\10\5\1\0\3\5\1\0"+
+    "\3\5\2\0\1\4\17\0\2\4\2\5\2\0\12\5\1\0\1\4"+
+    "\17\0\3\5\1\0\10\4\2\0\2\4\2\0\26\4\1\0\7\4"+
+    "\1\0\2\4\1\0\5\4\2\0\1\5\1\4\6\5\3\0\2\5"+
+    "\2\0\3\5\10\0\2\5\4\0\2\4\1\0\3\4\4\0\12\5"+
+    "\1\0\1\4\20\0\1\5\1\4\1\0\6\4\3\0\3\4\1\0"+
+    "\4\4\3\0\2\4\1\0\1\4\1\0\2\4\3\0\2\4\3\0"+
+    "\3\4\3\0\10\4\1\0\3\4\4\0\5\5\3\0\3\5\1\0"+
+    "\4\5\11\0\1\5\17\0\11\5\11\0\1\4\7\0\3\5\1\0"+
+    "\10\4\1\0\3\4\1\0\27\4\1\0\12\4\1\0\5\4\4\0"+
+    "\7\5\1\0\3\5\1\0\4\5\7\0\2\5\11\0\2\4\4\0"+
+    "\12\5\22\0\2\5\1\0\10\4\1\0\3\4\1\0\27\4\1\0"+
+    "\12\4\1\0\5\4\2\0\1\5\1\4\7\5\1\0\3\5\1\0"+
+    "\4\5\7\0\2\5\7\0\1\4\1\0\2\4\4\0\12\5\22\0"+
+    "\2\5\1\0\10\4\1\0\3\4\1\0\27\4\1\0\20\4\4\0"+
+    "\6\5\2\0\3\5\1\0\4\5\11\0\1\5\10\0\2\4\4\0"+
+    "\12\5\22\0\2\5\1\0\22\4\3\0\30\4\1\0\11\4\1\0"+
+    "\1\4\2\0\7\4\3\0\1\5\4\0\6\5\1\0\1\5\1\0"+
+    "\10\5\22\0\2\5\15\0\60\4\1\5\2\4\7\5\4\0\10\4"+
+    "\10\5\1\0\12\5\47\0\2\4\1\0\1\4\2\0\2\4\1\0"+
+    "\1\4\2\0\1\4\6\0\4\4\1\0\7\4\1\0\3\4\1\0"+
+    "\1\4\1\0\1\4\2\0\2\4\1\0\4\4\1\5\2\4\6\5"+
+    "\1\0\2\5\1\4\2\0\5\4\1\0\1\4\1\0\6\5\2\0"+
+    "\12\5\2\0\2\4\42\0\1\4\27\0\2\5\6\0\12\5\13\0"+
+    "\1\5\1\0\1\5\1\0\1\5\4\0\2\5\10\4\1\0\42\4"+
+    "\6\0\24\5\1\0\2\5\4\4\4\0\10\5\1\0\44\5\11\0"+
+    "\1\5\71\0\42\4\1\0\5\4\1\0\2\4\1\0\7\5\3\0"+
+    "\4\5\6\0\12\5\6\0\6\4\4\5\106\0\46\4\12\0\51\4"+
+    "\7\0\132\4\5\0\104\4\5\0\122\4\6\0\7\4\1\0\77\4"+
+    "\1\0\1\4\1\0\4\4\2\0\7\4\1\0\1\4\1\0\4\4"+
+    "\2\0\47\4\1\0\1\4\1\0\4\4\2\0\37\4\1\0\1\4"+
+    "\1\0\4\4\2\0\7\4\1\0\1\4\1\0\4\4\2\0\7\4"+
+    "\1\0\7\4\1\0\27\4\1\0\37\4\1\0\1\4\1\0\4\4"+
+    "\2\0\7\4\1\0\47\4\1\0\23\4\16\0\11\5\56\0\125\4"+
+    "\14\0\u026c\4\2\0\10\4\12\0\32\4\5\0\113\4\3\0\3\4"+
+    "\17\0\15\4\1\0\4\4\3\5\13\0\22\4\3\5\13\0\22\4"+
+    "\2\5\14\0\15\4\1\0\3\4\1\0\2\5\14\0\64\4\40\5"+
+    "\3\0\1\4\3\0\2\4\1\5\2\0\12\5\41\0\3\5\2\0"+
+    "\12\5\6\0\130\4\10\0\51\4\1\5\126\0\35\4\3\0\14\5"+
+    "\4\0\14\5\12\0\12\5\36\4\2\0\5\4\u038b\0\154\4\224\0"+
+    "\234\4\4\0\132\4\6\0\26\4\2\0\6\4\2\0\46\4\2\0"+
+    "\6\4\2\0\10\4\1\0\1\4\1\0\1\4\1\0\1\4\1\0"+
+    "\37\4\2\0\65\4\1\0\7\4\1\0\1\4\3\0\3\4\1\0"+
+    "\7\4\3\0\4\4\2\0\6\4\4\0\15\4\5\0\3\4\1\0"+
+    "\7\4\17\0\4\5\26\0\1\35\3\0\5\5\20\0\2\4\23\0"+
+    "\1\4\13\0\4\5\6\0\6\5\1\0\1\4\15\0\1\4\40\0"+
+    "\22\4\36\0\15\5\4\0\1\5\3\0\6\5\27\0\1\4\4\0"+
+    "\1\4\2\0\12\4\1\0\1\4\3\0\5\4\6\0\1\4\1\0"+
+    "\1\4\1\0\1\4\1\0\4\4\1\0\3\4\1\0\7\4\3\0"+
+    "\3\4\5\0\5\4\26\0\44\4\u0e81\0\3\4\31\0\11\4\6\5"+
+    "\1\0\5\4\2\0\5\4\4\0\126\4\2\0\2\5\2\0\3\4"+
+    "\1\0\137\4\5\0\50\4\4\0\136\4\21\0\30\4\70\0\20\4"+
+    
"\u0200\0\u19b6\4\112\0\u51a6\4\132\0\u048d\4\u0773\0\u2ba4\4\u215c\0\u012e\4"+
+    "\2\0\73\4\225\0\7\4\14\0\5\4\5\0\1\4\1\5\12\4"+
+    "\1\0\15\4\1\0\5\4\1\0\1\4\1\0\2\4\1\0\2\4"+
+    "\1\0\154\4\41\0\u016b\4\22\0\100\4\2\0\66\4\50\0\15\4"+
+    "\3\0\20\5\20\0\4\5\17\0\2\4\30\0\3\4\31\0\1\4"+
+    "\6\0\5\4\1\0\207\4\2\0\1\5\4\0\1\4\13\0\12\5"+
+    "\7\0\32\4\4\0\1\4\1\0\32\4\12\0\132\4\3\0\6\4"+
+    "\2\0\6\4\2\0\6\4\2\0\3\4\3\0\2\4\3\0\2\4"+
+    "\22\0\3\5\4\0";
+
+  /** 
+   * Translates characters to character classes
+   */
+  private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
+
+  /** 
+   * Translates DFA states to action switch labels.
+   */
+  private static final int [] ZZ_ACTION = zzUnpackAction();
+
+  private static final String ZZ_ACTION_PACKED_0 =
+    "\1\0\1\1\2\2\16\3\1\4\1\5\1\6\1\7"+
+    "\1\10\1\11\1\12\1\13\1\14\1\15\1\16\24\3"+
+    "\1\0\1\17\15\3\1\20\11\3\1\21\1\3\1\22"+
+    "\1\23\12\3\1\24\20\3\1\25\1\26\1\27\1\30"+
+    "\10\3\1\31\1\32\2\3\1\33\1\3\1\34\3\3"+
+    "\1\35\1\36\1\37\6\3\1\40\1\41\2\3\1\42"+
+    "\1\43\1\3\1\44\1\3\1\45\2\3\1\46";
+
+  private static int [] zzUnpackAction() {
+    int [] result = new int[149];
+    int offset = 0;
+    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackAction(String packed, int offset, int [] 
result) {
+    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++);
+      do result[j++] = value; while (--count > 0);
+    }
+    return j;
+  }
+
+
+  /** 
+   * Translates a state to a row index in the transition table
+   */
+  private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
+
+  private static final String ZZ_ROWMAP_PACKED_0 =
+    "\0\0\0\47\0\116\0\47\0\165\0\234\0\303\0\352"+
+    "\0\u0111\0\u0138\0\u015f\0\u0186\0\u01ad\0\u01d4\0\u01fb\0\u0222"+
+    "\0\u0249\0\u0270\0\47\0\u0297\0\47\0\47\0\47\0\47"+
+    "\0\47\0\47\0\47\0\47\0\u02be\0\u02e5\0\u030c\0\u0333"+
+    "\0\u035a\0\u0381\0\u03a8\0\u03cf\0\u03f6\0\u041d\0\u0444\0\u046b"+
+    "\0\u0492\0\u04b9\0\u04e0\0\u0507\0\u052e\0\u0555\0\u057c\0\u05a3"+
+    "\0\u05ca\0\u05f1\0\u0618\0\u063f\0\u0666\0\u068d\0\u06b4\0\u06db"+
+    "\0\u0702\0\u0729\0\u0750\0\u0777\0\u079e\0\u07c5\0\u07ec\0\u0813"+
+    "\0\165\0\u083a\0\u0861\0\u0888\0\u08af\0\u08d6\0\u08fd\0\u0924"+
+    "\0\u094b\0\u0972\0\47\0\u0999\0\165\0\165\0\u09c0\0\u09e7"+
+    "\0\u0a0e\0\u0a35\0\u0a5c\0\u0a83\0\u0aaa\0\u0ad1\0\u0af8\0\u0b1f"+
+    "\0\165\0\u0b46\0\u0b6d\0\u0b94\0\u0bbb\0\u0be2\0\u0c09\0\u0c30"+
+    "\0\u0c57\0\u0c7e\0\u0ca5\0\u0ccc\0\u0cf3\0\u0d1a\0\u0d41\0\u0d68"+
+    "\0\u0d8f\0\165\0\165\0\165\0\165\0\u0db6\0\u0ddd\0\u0e04"+
+    "\0\u0e2b\0\u0e52\0\u0e79\0\u0ea0\0\u0ec7\0\165\0\165\0\u0eee"+
+    "\0\u0f15\0\165\0\u0f3c\0\165\0\u0f63\0\u0f8a\0\u0fb1\0\165"+
+    "\0\165\0\165\0\u0fd8\0\u0fff\0\u1026\0\u104d\0\u1074\0\u109b"+
+    "\0\165\0\165\0\u10c2\0\u10e9\0\165\0\165\0\u1110\0\165"+
+    "\0\u1137\0\165\0\u115e\0\u1185\0\165";
+
+  private static int [] zzUnpackRowMap() {
+    int [] result = new int[149];
+    int offset = 0;
+    offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackRowMap(String packed, int offset, int [] 
result) {
+    int i = 0;  /* index in packed string  */
+    int j = offset;  /* index in unpacked array */
+    int l = packed.length();
+    while (i < l) {
+      int high = packed.charAt(i++) << 16;
+      result[j++] = high | packed.charAt(i++);
+    }
+    return j;
+  }
+
+  /** 
+   * The transition table of the DFA
+   */
+  private static final int [] ZZ_TRANS = zzUnpackTrans();
+
+  private static final String ZZ_TRANS_PACKED_0 =
+    "\1\2\1\3\2\4\1\5\1\2\1\6\1\5\1\7"+
+    "\1\10\1\11\1\12\1\5\1\13\1\14\2\5\1\15"+
+    "\1\5\1\16\1\17\1\20\1\5\1\21\1\22\1\5"+
+    "\1\23\1\24\1\25\1\26\1\27\1\30\1\31\1\32"+
+    "\1\33\1\34\1\35\2\5\51\0\1\4\50\0\26\5"+
+    "\13\0\2\5\4\0\3\5\1\36\4\5\1\37\15\5"+
+    "\13\0\2\5\4\0\3\5\1\40\22\5\13\0\2\5"+
+    "\4\0\26\5\13\0\1\5\1\41\4\0\2\5\1\42"+
+    "\23\5\13\0\2\5\4\0\6\5\1\43\17\5\13\0"+
+    "\2\5\4\0\13\5\1\44\1\45\11\5\13\0\2\5"+
+    "\4\0\10\5\1\46\1\47\1\5\1\50\6\5\1\51"+
+    "\3\5\13\0\2\5\4\0\7\5\1\52\16\5\13\0"+
+    "\2\5\4\0\13\5\1\53\12\5\13\0\2\5\4\0"+
+    "\4\5\1\54\10\5\1\55\10\5\13\0\2\5\4\0"+
+    "\3\5\1\56\22\5\13\0\2\5\4\0\3\5\1\57"+
+    "\22\5\13\0\2\5\4\0\14\5\1\60\5\5\1\61"+
+    "\3\5\13\0\2\5\33\0\1\62\57\0\1\63\6\0"+
+    "\3\5\1\64\22\5\13\0\2\5\4\0\11\5\1\65"+
+    "\14\5\13\0\2\5\4\0\7\5\1\66\16\5\13\0"+
+    "\2\5\4\0\11\5\1\67\14\5\13\0\2\5\4\0"+
+    "\12\5\1\70\13\5\13\0\2\5\4\0\11\5\1\71"+
+    "\14\5\13\0\2\5\4\0\14\5\1\72\11\5\13\0"+
+    "\2\5\4\0\6\5\1\73\17\5\13\0\2\5\4\0"+
+    "\7\5\1\74\16\5\13\0\2\5\4\0\6\5\1\75"+
+    "\5\5\1\76\11\5\13\0\2\5\4\0\3\5\1\77"+
+    "\22\5\13\0\2\5\4\0\24\5\1\100\1\5\13\0"+
+    "\2\5\4\0\11\5\1\101\14\5\13\0\2\5\4\0"+
+    "\6\5\1\102\17\5\13\0\2\5\4\0\3\5\1\103"+
+    "\22\5\13\0\2\5\4\0\7\5\1\104\16\5\13\0"+
+    "\2\5\4\0\22\5\1\105\3\5\13\0\2\5\4\0"+
+    "\4\5\1\106\10\5\1\107\10\5\13\0\2\5\4\0"+
+    "\3\5\1\110\11\5\1\111\10\5\13\0\2\5\4\0"+
+    "\2\5\1\112\23\5\13\0\2\5\33\0\1\26\57\0"+
+    "\1\113\6\0\4\5\1\114\21\5\13\0\2\5\4\0"+
+    "\5\5\1\115\20\5\13\0\2\5\4\0\16\5\1\116"+
+    "\7\5\13\0\2\5\4\0\5\5\1\117\20\5\13\0"+
+    "\2\5\4\0\11\5\1\120\14\5\13\0\2\5\4\0"+
+    "\15\5\1\121\10\5\13\0\2\5\4\0\3\5\1\122"+
+    "\22\5\13\0\2\5\4\0\7\5\1\123\16\5\13\0"+
+    "\2\5\4\0\17\5\1\124\6\5\13\0\2\5\4\0"+
+    "\11\5\1\125\14\5\13\0\2\5\4\0\15\5\1\126"+
+    "\10\5\13\0\2\5\4\0\14\5\1\127\11\5\13\0"+
+    "\2\5\4\0\5\5\1\130\20\5\13\0\2\5\4\0"+
+    "\14\5\1\131\11\5\13\0\2\5\4\0\6\5\1\132"+
+    "\17\5\13\0\2\5\4\0\6\5\1\133\17\5\13\0"+
+    "\2\5\4\0\2\5\1\134\23\5\13\0\2\5\4\0"+
+    "\6\5\1\135\17\5\13\0\2\5\4\0\21\5\1\115"+
+    "\4\5\13\0\2\5\4\0\11\5\1\136\14\5\13\0"+
+    "\2\5\4\0\23\5\1\137\2\5\13\0\2\5\4\0"+
+    "\4\5\1\140\21\5\13\0\2\5\4\0\5\5\1\141"+
+    "\20\5\13\0\2\5\4\0\7\5\1\142\16\5\13\0"+
+    "\2\5\4\0\14\5\1\143\11\5\13\0\2\5\4\0"+
+    "\23\5\1\144\2\5\13\0\2\5\4\0\26\5\13\0"+
+    "\1\145\1\5\4\0\12\5\1\146\13\5\13\0\2\5"+
+    "\4\0\13\5\1\147\12\5\13\0\2\5\4\0\15\5"+
+    "\1\150\10\5\13\0\2\5\4\0\17\5\1\151\6\5"+
+    "\13\0\2\5\4\0\11\5\1\152\14\5\13\0\2\5"+
+    "\4\0\14\5\1\153\11\5\13\0\2\5\4\0\11\5"+
+    "\1\154\14\5\13\0\2\5\4\0\4\5\1\155\21\5"+
+    "\13\0\2\5\4\0\4\5\1\156\21\5\13\0\2\5"+
+    "\4\0\11\5\1\157\14\5\13\0\2\5\4\0\5\5"+
+    "\1\160\20\5\13\0\2\5\4\0\6\5\1\161\17\5"+
+    "\13\0\2\5\4\0\15\5\1\162\10\5\13\0\2\5"+
+    "\4\0\6\5\1\163\17\5\13\0\2\5\4\0\21\5"+
+    "\1\164\4\5\13\0\2\5\4\0\6\5\1\165\17\5"+
+    "\13\0\2\5\4\0\5\5\1\166\20\5\13\0\2\5"+
+    "\4\0\12\5\1\167\13\5\13\0\2\5\4\0\15\5"+
+    "\1\170\10\5\13\0\2\5\4\0\14\5\1\171\11\5"+
+    "\13\0\2\5\4\0\17\5\1\172\6\5\13\0\2\5"+
+    "\4\0\11\5\1\173\14\5\13\0\2\5\4\0\5\5"+
+    "\1\174\20\5\13\0\2\5\4\0\15\5\1\175\10\5"+
+    "\13\0\2\5\4\0\17\5\1\176\6\5\13\0\2\5"+
+    "\4\0\11\5\1\177\14\5\13\0\2\5\4\0\17\5"+
+    "\1\200\6\5\13\0\2\5\4\0\7\5\1\201\16\5"+
+    "\13\0\2\5\4\0\12\5\1\202\13\5\13\0\2\5"+
+    "\4\0\17\5\1\203\6\5\13\0\2\5\4\0\5\5"+
+    "\1\204\20\5\13\0\2\5\4\0\3\5\1\205\22\5"+
+    "\13\0\2\5\4\0\20\5\1\206\5\5\13\0\2\5"+
+    "\4\0\4\5\1\207\21\5\13\0\2\5\4\0\11\5"+
+    "\1\210\14\5\13\0\2\5\4\0\5\5\1\211\20\5"+
+    "\13\0\2\5\4\0\11\5\1\212\14\5\13\0\2\5"+
+    "\4\0\7\5\1\213\16\5\13\0\2\5\4\0\7\5"+
+    "\1\214\16\5\13\0\2\5\4\0\24\5\1\215\1\5"+
+    "\13\0\2\5\4\0\5\5\1\216\20\5\13\0\2\5"+
+    "\4\0\5\5\1\217\20\5\13\0\2\5\4\0\11\5"+
+    "\1\220\14\5\13\0\2\5\4\0\15\5\1\221\10\5"+
+    "\13\0\2\5\4\0\21\5\1\222\4\5\13\0\2\5"+
+    "\4\0\25\5\1\223\13\0\2\5\4\0\5\5\1\224"+
+    "\20\5\13\0\2\5\4\0\21\5\1\225\4\5\13\0"+
+    "\2\5";
+
+  private static int [] zzUnpackTrans() {
+    int [] result = new int[4524];
+    int offset = 0;
+    offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackTrans(String packed, int offset, int [] result) 
{
+    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 result[j++] = value; while (--count > 0);
+    }
+    return j;
+  }
+
+
+  /* error codes */
+  private static final int ZZ_UNKNOWN_ERROR = 0;
+  private static final int ZZ_NO_MATCH = 1;
+  private static final int ZZ_PUSHBACK_2BIG = 2;
+
+  /* error messages for the codes above */
+  private static final String ZZ_ERROR_MSG[] = {
+    "Unkown internal scanner error",
+    "Error: could not match input",
+    "Error: pushback value was too large"
+  };
+
+  /**
+   * ZZ_ATTRIBUTE[aState] contains the attributes of state 
<code>aState</code>
+   */
+  private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
+
+  private static final String ZZ_ATTRIBUTE_PACKED_0 =
+    "\1\0\1\11\1\1\1\11\16\1\1\11\1\1\10\11"+
+    "\25\1\1\0\30\1\1\11\112\1";
+
+  private static int [] zzUnpackAttribute() {
+    int [] result = new int[149];
+    int offset = 0;
+    offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackAttribute(String packed, int offset, int [] 
result) {
+    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++);
+      do result[j++] = value; while (--count > 0);
+    }
+    return j;
+  }
+
+  /** the input device */
+  private java.io.Reader zzReader;
+
+  /** the current state of the DFA */
+  private int zzState;
+
+  /** the current lexical state */
+  private int zzLexicalState = YYINITIAL;
+
+  /** this buffer contains the current text to be matched and is
+      the source of the yytext() string */
+  private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
+
+  /** the textposition at the last accepting state */
+  private int zzMarkedPos;
+
+  /** the current text position in the buffer */
+  private int zzCurrentPos;
+
+  /** startRead marks the beginning of the yytext() string in the buffer */
+  private int zzStartRead;
+
+  /** endRead marks the last character in the buffer, that has been read
+      from input */
+  private int zzEndRead;
+
+  /** 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;
+
+  /** 
+   * zzAtBOL == true <=> the scanner is currently at the beginning of a line
+   */
+  private boolean zzAtBOL = true;
+
+  /** zzAtEOF == true <=> the scanner is at the EOF */
+  private boolean zzAtEOF;
+
+  /** denotes if the user-EOF-code has already been executed */
+  private boolean zzEOFDone;
+
+  /* user code: */
+  public Object value() {
+    return yytext();
+  }
+
+  public static JavaSignatureLexer create(java.io.InputStream stream) {
+    return new JavaSignatureLexer(stream);
+  }
+
+
+  /**
+   * 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.
+   */
+  public JavaSignatureLexer(java.io.Reader in) {
+    this.zzReader = 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.
+   */
+  public JavaSignatureLexer(java.io.InputStream in) {
+    this(new java.io.InputStreamReader(in));
+  }
+
+  /** 
+   * Unpacks the compressed character translation table.
+   *
+   * @param packed   the packed character translation table
+   * @return         the unpacked character translation table
+   */
+  private static char [] zzUnpackCMap(String packed) {
+    char [] map = new char[0x10000];
+    int i = 0;  /* index in packed string  */
+    int j = 0;  /* index in unpacked array */
+    while (i < 1746) {
+      int  count = packed.charAt(i++);
+      char value = packed.charAt(i++);
+      do map[j++] = value; while (--count > 0);
+    }
+    return map;
+  }
+
+
+  /**
+   * Refills the input buffer.
+   *
+   * @return      <code>false</code>, iff there was new input.
+   * 
+   * @exception   java.io.IOException  if any I/O-Error occurs
+   */
+  private boolean zzRefill() throws java.io.IOException {
+
+    /* first: make room (if you can) */
+    if (zzStartRead > 0) {
+      System.arraycopy(zzBuffer, zzStartRead,
+                       zzBuffer, 0,
+                       zzEndRead-zzStartRead);
+
+      /* translate stored positions */
+      zzEndRead-= zzStartRead;
+      zzCurrentPos-= zzStartRead;
+      zzMarkedPos-= zzStartRead;
+      zzStartRead = 0;
+    }
+
+    /* is the buffer big enough? */
+    if (zzCurrentPos >= zzBuffer.length) {
+      /* if not: blow it up */
+      char newBuffer[] = new char[zzCurrentPos*2];
+      System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
+      zzBuffer = newBuffer;
+    }
+
+    /* finally: fill the buffer with new input */
+    int numRead = zzReader.read(zzBuffer, zzEndRead,
+                                            zzBuffer.length-zzEndRead);
+
+    if (numRead > 0) {
+      zzEndRead+= numRead;
+      return false;
+    }
+    // unlikely but not impossible: read 0 characters, but not at end of 
stream    
+    if (numRead == 0) {
+      int c = zzReader.read();
+      if (c == -1) {
+        return true;
+      } else {
+        zzBuffer[zzEndRead++] = (char) c;
+        return false;
+      }     
+    }
+
+       // numRead < 0
+    return true;
+  }
+
+    
+  /**
+   * Closes the input stream.
+   */
+  public final void yyclose() throws java.io.IOException {
+    zzAtEOF = true;            /* indicate end of file */
+    zzEndRead = zzStartRead;  /* invalidate buffer    */
+
+    if (zzReader != null)
+      zzReader.close();
+  }
+
+
+  /**
+   * Resets the scanner to read from a new input stream.
+   * Does not close the old reader.
+   *
+   * All internal variables are reset, the old input stream 
+   * <b>cannot</b> be reused (internal buffer is discarded and lost).
+   * Lexical state is set to <tt>ZZ_INITIAL</tt>.
+   *
+   * @param reader   the new input stream 
+   */
+  public final void yyreset(java.io.Reader reader) {
+    zzReader = reader;
+    zzAtBOL  = true;
+    zzAtEOF  = false;
+    zzEOFDone = false;
+    zzEndRead = zzStartRead = 0;
+    zzCurrentPos = zzMarkedPos = 0;
+    yyline = yychar = yycolumn = 0;
+    zzLexicalState = YYINITIAL;
+  }
+
+
+  /**
+   * Returns the current lexical state.
+   */
+  public final int yystate() {
+    return zzLexicalState;
+  }
+
+
+  /**
+   * Enters a new lexical state
+   *
+   * @param newState the new lexical state
+   */
+  public final void yybegin(int newState) {
+    zzLexicalState = newState;
+  }
+
+
+  /**
+   * Returns the text matched by the current regular expression.
+   */
+  public final String yytext() {
+    return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
+  }
+
+
+  /**
+   * Returns the character at position <tt>pos</tt> 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
+   */
+  public final char yycharat(int pos) {
+    return zzBuffer[zzStartRead+pos];
+  }
+
+
+  /**
+   * Returns the length of the matched text region.
+   */
+  public final int yylength() {
+    return zzMarkedPos-zzStartRead;
+  }
+
+
+  /**
+   * 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 zzScanError(int errorCode) {
+    String message;
+    try {
+      message = ZZ_ERROR_MSG[errorCode];
+    }
+    catch (ArrayIndexOutOfBoundsException e) {
+      message = ZZ_ERROR_MSG[ZZ_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()!
+   */
+  public void yypushback(int number)  {
+    if ( number > yylength() )
+      zzScanError(ZZ_PUSHBACK_2BIG);
+
+    zzMarkedPos -= number;
+  }
+
+
+  /**
+   * 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   java.io.IOException  if any I/O-Error occurs
+   */
+  public int yylex() throws java.io.IOException {
+    int zzInput;
+    int zzAction;
+
+    // cached fields:
+    int zzCurrentPosL;
+    int zzMarkedPosL;
+    int zzEndReadL = zzEndRead;
+    char [] zzBufferL = zzBuffer;
+    char [] zzCMapL = ZZ_CMAP;
+
+    int [] zzTransL = ZZ_TRANS;
+    int [] zzRowMapL = ZZ_ROWMAP;
+    int [] zzAttrL = ZZ_ATTRIBUTE;
+
+    while (true) {
+      zzMarkedPosL = zzMarkedPos;
+
+      boolean zzR = false;
+      for (zzCurrentPosL = zzStartRead; zzCurrentPosL < zzMarkedPosL;
+                                                             
zzCurrentPosL++) {
+        switch (zzBufferL[zzCurrentPosL]) {
+        case '\u000B':
+        case '\u000C':
+        case '\u0085':
+        case '\u2028':
+        case '\u2029':
+          yyline++;
+          yycolumn = 0;
+          zzR = false;
+          break;
+        case '\r':
+          yyline++;
+          yycolumn = 0;
+          zzR = true;
+          break;
+        case '\n':
+          if (zzR)
+            zzR = false;
+          else {
+            yyline++;
+            yycolumn = 0;
+          }
+          break;
+        default:
+          zzR = false;
+          yycolumn++;
+        }
+      }
+
+      if (zzR) {
+        // peek one character ahead if it is \n (if we have counted one line 
too much)
+        boolean zzPeek;
+        if (zzMarkedPosL < zzEndReadL)
+          zzPeek = zzBufferL[zzMarkedPosL] == '\n';
+        else if (zzAtEOF)
+          zzPeek = false;
+        else {
+          boolean eof = zzRefill();
+          zzEndReadL = zzEndRead;
+          zzMarkedPosL = zzMarkedPos;
+          zzBufferL = zzBuffer;
+          if (eof) 
+            zzPeek = false;
+          else 
+            zzPeek = zzBufferL[zzMarkedPosL] == '\n';
+        }
+        if (zzPeek) yyline--;
+      }
+      zzAction = -1;
+
+      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
+  
+      zzState = ZZ_LEXSTATE[zzLexicalState];
+
+
+      zzForAction: {
+        while (true) {
+    
+          if (zzCurrentPosL < zzEndReadL)
+            zzInput = zzBufferL[zzCurrentPosL++];
+          else if (zzAtEOF) {
+            zzInput = YYEOF;
+            break zzForAction;
+          }
+          else {
+            // store back cached positions
+            zzCurrentPos  = zzCurrentPosL;
+            zzMarkedPos   = zzMarkedPosL;
+            boolean eof = zzRefill();
+            // get translated positions and possibly new buffer
+            zzCurrentPosL  = zzCurrentPos;
+            zzMarkedPosL   = zzMarkedPos;
+            zzBufferL      = zzBuffer;
+            zzEndReadL     = zzEndRead;
+            if (eof) {
+              zzInput = YYEOF;
+              break zzForAction;
+            }
+            else {
+              zzInput = zzBufferL[zzCurrentPosL++];
+            }
+          }
+          int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
+          if (zzNext == -1) break zzForAction;
+          zzState = zzNext;
+
+          int zzAttributes = zzAttrL[zzState];
+          if ( (zzAttributes & 1) == 1 ) {
+            zzAction = zzState;
+            zzMarkedPosL = zzCurrentPosL;
+            if ( (zzAttributes & 8) == 8 ) break zzForAction;
+          }
+
+        }
+      }
+
+      // store back cached position
+      zzMarkedPos = zzMarkedPosL;
+
+      switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
+        case 31: 
+          { return JavaSignatureParser.EXTENDS;
+          }
+        case 39: break;
+        case 20: 
+          { return JavaSignatureParser.CHAR;
+          }
+        case 40: break;
+        case 36: 
+          { return JavaSignatureParser.TRANSIENT;
+          }
+        case 41: break;
+        case 21: 
+          { return JavaSignatureParser.SHORT;
+          }
+        case 42: break;
+        case 22: 
+          { return JavaSignatureParser.SUPER;
+          }
+        case 43: break;
+        case 33: 
+          { return JavaSignatureParser.ABSTRACT;
+          }
+        case 44: break;
+        case 12: 
+          { return JavaSignatureParser.QUESTION;
+          }
+        case 45: break;
+        case 15: 
+          { return JavaSignatureParser.RSHIFT;
+          }
+        case 46: break;
+        case 37: 
+          { return JavaSignatureParser.PROTECTED;
+          }
+        case 47: break;
+        case 3: 
+          { return JavaSignatureParser.IDENTIFIER;
+          }
+        case 48: break;
+        case 23: 
+          { return JavaSignatureParser.FLOAT;
+          }
+        case 49: break;
+        case 14: 
+          { return JavaSignatureParser.GT;
+          }
+        case 50: break;
+        case 24: 
+          { return JavaSignatureParser.FINAL;
+          }
+        case 51: break;
+        case 29: 
+          { return JavaSignatureParser.PUBLIC;
+          }
+        case 52: break;
+        case 8: 
+          { return JavaSignatureParser.LPAREN;
+          }
+        case 53: break;
+        case 9: 
+          { return JavaSignatureParser.RPAREN;
+          }
+        case 54: break;
+        case 27: 
+          { return JavaSignatureParser.STATIC;
+          }
+        case 55: break;
+        case 17: 
+          { return JavaSignatureParser.URSHIFT;
+          }
+        case 56: break;
+        case 34: 
+          { return JavaSignatureParser.STRICTFP;
+          }
+        case 57: break;
+        case 18: 
+          { return JavaSignatureParser.VOID;
+          }
+        case 58: break;
+        case 1: 
+          { throw new Error("Invalid character ("+yytext()+")");
+          }
+        case 59: break;
+        case 7: 
+          { return JavaSignatureParser.ELLIPSIS;
+          }
+        case 60: break;
+        case 19: 
+          { return JavaSignatureParser.LONG;
+          }
+        case 61: break;
+        case 30: 
+          { return JavaSignatureParser.BOOLEAN;
+          }
+        case 62: break;
+        case 26: 
+          { return JavaSignatureParser.THROWS;
+          }
+        case 63: break;
+        case 25: 
+          { return JavaSignatureParser.NATIVE;
+          }
+        case 64: break;
+        case 10: 
+          { return JavaSignatureParser.LBRACK;
+          }
+        case 65: break;
+        case 11: 
+          { return JavaSignatureParser.RBRACK;
+          }
+        case 66: break;
+        case 13: 
+          { return JavaSignatureParser.LT;
+          }
+        case 67: break;
+        case 38: 
+          { return JavaSignatureParser.SYNCHRONIZED;
+          }
+        case 68: break;
+        case 5: 
+          { return JavaSignatureParser.DOT;
+          }
+        case 69: break;
+        case 35: 
+          { return JavaSignatureParser.VOLATILE;
+          }
+        case 70: break;
+        case 28: 
+          { return JavaSignatureParser.DOUBLE;
+          }
+        case 71: break;
+        case 6: 
+          { return JavaSignatureParser.COMMA;
+          }
+        case 72: break;
+        case 4: 
+          { return JavaSignatureParser.AND;
+          }
+        case 73: break;
+        case 32: 
+          { return JavaSignatureParser.PRIVATE;
+          }
+        case 74: break;
+        case 16: 
+          { return JavaSignatureParser.INT;
+          }
+        case 75: break;
+        case 2: 
+          { 
+          }
+        case 76: break;
+        default: 
+          if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
+            zzAtEOF = true;
+            return YYEOF;
+          } 
+          else {
+            zzScanError(ZZ_NO_MATCH);
+          }
+      }
+    }
+  }
+
+  /**
+   * Runs the scanner on input files.
+   *
+   * This is a standalone scanner, it will print any unmatched
+   * text to System.out unchanged.
+   *
+   * @param argv   the command line, contains the filenames to run
+   *               the scanner on.
+   */
+  public static void main(String argv[]) {
+    if (argv.length == 0) {
+      System.out.println("Usage : java JavaSignatureLexer <inputfile>");
+    }
+    else {
+      for (int i = 0; i < argv.length; i++) {
+        JavaSignatureLexer scanner = null;
+        try {
+          scanner = new JavaSignatureLexer( new java.io.FileReader(argv[i]) 
);
+          while ( !scanner.zzAtEOF ) scanner.yylex();
+        }
+        catch (java.io.FileNotFoundException e) {
+          System.out.println("File not found : \""+argv[i]+"\"");
+        }
+        catch (java.io.IOException e) {
+          System.out.println("IO error scanning file \""+argv[i]+"\"");
+          System.out.println(e);
+        }
+        catch (Exception e) {
+          System.out.println("Unexpected exception:");
+          e.printStackTrace();
+        }
+      }
+    }
+  }
+
+
+}
diff --git a/src/org/jruby/parser/JavaSignatureParser.java 
b/src/org/jruby/parser/JavaSignatureParser.java
new file mode 100644
index 0000000..3845cea
--- /dev/null
+++ b/src/org/jruby/parser/JavaSignatureParser.java
@@ -0,0 +1,899 @@
+// created by jay 1.0.2 (c) 2002-2004 ats@cs.rit.edu
+// skeleton Java 1.0 (c) 2002 ats@cs.rit.edu
+
+                                       // line 17 
"src/org/jruby/parser/JavaSignatureParser.y"

+package org.jruby.parser;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jruby.ast.java_signature.MethodSignatureNode;
+import org.jruby.ast.java_signature.Modifier;
+import org.jruby.ast.java_signature.ParameterNode;
+import org.jruby.ast.java_signature.PrimitiveTypeNode;
+import org.jruby.ast.java_signature.ReferenceTypeNode;
+import org.jruby.ast.java_signature.TypeNode;
+import org.jruby.lexer.JavaSignatureLexer;
+
+public class JavaSignatureParser {
+    private static JavaSignatureParser parser = new JavaSignatureParser();
+
+    public static MethodSignatureNode parse(InputStream in) throws 
IOException, ParserSyntaxException {
+        return (MethodSignatureNode) 
parser.yyparse(JavaSignatureLexer.create(in));
+    }
+                                       // line 28 "-"
+  // %token constants
+  public static final int BOOLEAN = 257;
+  public static final int BYTE = 258;
+  public static final int SHORT = 259;
+  public static final int INT = 260;
+  public static final int LONG = 261;
+  public static final int CHAR = 262;
+  public static final int FLOAT = 263;
+  public static final int DOUBLE = 264;
+  public static final int VOID = 265;
+  public static final int PUBLIC = 266;
+  public static final int PROTECTED = 267;
+  public static final int PRIVATE = 268;
+  public static final int STATIC = 269;
+  public static final int ABSTRACT = 270;
+  public static final int FINAL = 271;
+  public static final int NATIVE = 272;
+  public static final int SYNCHRONIZED = 273;
+  public static final int TRANSIENT = 274;
+  public static final int VOLATILE = 275;
+  public static final int STRICTFP = 276;
+  public static final int IDENTIFIER = 277;
+  public static final int AND = 278;
+  public static final int DOT = 279;
+  public static final int COMMA = 280;
+  public static final int ELLIPSIS = 281;
+  public static final int LPAREN = 282;
+  public static final int RPAREN = 283;
+  public static final int LBRACK = 284;
+  public static final int RBRACK = 285;
+  public static final int QUESTION = 286;
+  public static final int LT = 287;
+  public static final int GT = 288;
+  public static final int THROWS = 289;
+  public static final int EXTENDS = 290;
+  public static final int SUPER = 291;
+  public static final int RSHIFT = 292;
+  public static final int URSHIFT = 293;
+  public static final int yyErrorCode = 256;
+
+  /** number of final state.
+    */
+  protected static final int yyFinal = 12;
+
+  /** parser tables.
+      Order is mandated by <i>jay</i>.
+    */
+  protected static final short[] yyLhs = {
+//yyLhs 121
+    -1,     0,    11,    11,    10,    10,    10,    10,    10,    10,
+    10,    10,    12,    12,    19,    14,    14,    15,    15,    17,
+    16,    13,    13,    13,    13,    23,    23,    23,    24,    24,
+    24,    25,    25,    25,    26,    26,    26,    27,    27,    28,
+    28,    29,    30,    30,    31,    31,    32,    32,    33,    33,
+    34,    34,    35,    35,    36,    36,    37,    37,     4,     4,
+     5,     5,     6,    21,    21,    21,    21,    21,    21,    21,
+    21,    21,    21,    21,    18,    18,    22,    22,     7,     7,
+     8,     8,     1,     2,     2,     3,     3,     9,     9,     9,
+     9,     9,     9,     9,     9,    20,    20,    44,    44,    38,
+    38,    45,    39,    39,    40,    40,    46,    46,    47,    50,
+    50,    43,    43,    41,    41,    42,    48,    49,    49,    49,
+    49,
+    }, yyLen = {
+//yyLen 121
+     2,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+     1,     1,     1,     1,     1,     1,     5,     1,     3,     1,
+     1,     2,     2,     6,     4,     1,     3,     3,     2,     3,
+     3,     2,     3,     3,     2,     3,     3,     2,     3,     2,
+     3,     2,     1,     3,     1,     3,     1,     3,     1,     3,
+     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+     1,     2,     0,     1,     1,     1,     1,     1,     1,     1,
+     1,     1,     1,     1,     1,     3,     2,     3,     2,     0,
+     1,     3,     4,     1,     0,     1,     3,     2,     1,     3,
+     2,     3,     2,     4,     3,     1,     3,     3,     1,     1,
+     3,     2,     2,     2,     2,     3,     1,     1,     3,     1,
+     1,     2,     1,     2,     2,     2,     0,     4,     6,     4,
+     6,
+    }, yyDefRed = {
+//yyDefRed 180
+     0,    63,    64,    65,    66,    67,    68,    69,    70,    71,
+    72,    73,     0,     0,     0,    59,    60,     1,     9,     4,
+     5,     6,     7,     8,    10,    11,     0,    74,     0,     0,
+     0,     3,    13,     0,    12,     0,    61,     0,     0,    14,
+     0,     0,    99,     0,    98,     0,     0,     0,     0,     0,
+     0,     0,     0,   119,   102,     0,   103,   101,   106,   107,
+     0,     0,     0,    76,     0,   117,     0,     0,     0,     0,
+    51,
[truncated due to length]



[jruby~main:33855d89] Java Method Signature parser (initial landing)

nicksieger 03/03/2010
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close