net.sf.retrotranslator.runtime.asm.signature
Class SignatureReader

java.lang.Object
  extended by net.sf.retrotranslator.runtime.asm.signature.SignatureReader

public class SignatureReader
extends java.lang.Object

A type signature parser to make a signature visitor visit an existing signature.

Author:
Thomas Hallgren, Eric Bruneton

Field Summary
private  java.lang.String signature
          The signature to be read.
 
Constructor Summary
SignatureReader(java.lang.String signature)
          Constructs a SignatureReader for the given signature.
 
Method Summary
 void accept(SignatureVisitor v)
          Makes the given visitor visit the signature of this SignatureReader.
 void acceptType(SignatureVisitor v)
          Makes the given visitor visit the signature of this SignatureReader.
private static int parseType(java.lang.String signature, int pos, SignatureVisitor v)
          Parses a field type signature and makes the given visitor visit it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

signature

private final java.lang.String signature
The signature to be read.

Constructor Detail

SignatureReader

public SignatureReader(java.lang.String signature)
Constructs a SignatureReader for the given signature.

Parameters:
signature - A ClassSignature, MethodTypeSignature, or FieldTypeSignature.
Method Detail

accept

public void accept(SignatureVisitor v)
Makes the given visitor visit the signature of this SignatureReader. This signature is the one specified in the constructor (see SignatureReader). This method is intended to be called on a SignatureReader that was created using a ClassSignature (such as the signature parameter of the ClassVisitor.visit method) or a MethodTypeSignature (such as the signature parameter of the ClassVisitor.visitMethod method).

Parameters:
v - the visitor that must visit this signature.

acceptType

public void acceptType(SignatureVisitor v)
Makes the given visitor visit the signature of this SignatureReader. This signature is the one specified in the constructor (see SignatureReader). This method is intended to be called on a SignatureReader that was created using a FieldTypeSignature, such as the signature parameter of the ClassVisitor.visitField or MethodVisitor.visitLocalVariable methods.

Parameters:
v - the visitor that must visit this signature.

parseType

private static int parseType(java.lang.String signature,
                             int pos,
                             SignatureVisitor v)
Parses a field type signature and makes the given visitor visit it.

Parameters:
signature - a string containing the signature that must be parsed.
pos - index of the first character of the signature to parsed.
v - the visitor that must visit this signature.
Returns:
the index of the first character after the parsed signature.