Back to index

wims  3.65+svn20090927
Package Functions | Package Attributes | Static Package Attributes | Private Attributes
org.javia.arity.DeclarationParser Class Reference
Inheritance diagram for org.javia.arity.DeclarationParser:
Inheritance graph
[legend]
Collaboration diagram for org.javia.arity.DeclarationParser:
Collaboration graph
[legend]

List of all members.

Package Functions

 DeclarationParser (SyntaxException e)
void start ()
void push (Token token) throws SyntaxException
String[] argNames ()
 DeclarationParser (SyntaxException e)
void start ()
void push (Token token) throws SyntaxException
String[] argNames ()

Package Attributes

String name
int arity = UNKNOWN_ARITY
Vector args = new Vector()

Static Package Attributes

static final String NO_ARGS [] = new String[0]
static final int UNKNOWN_ARITY = -2
static final int MAX_ARITY = 5

Private Attributes

SyntaxException exception

Detailed Description

Definition at line 21 of file DeclarationParser.java.


Constructor & Destructor Documentation

Definition at line 32 of file DeclarationParser.java.

                                         {
        this.exception = e;
    }

Definition at line 32 of file DeclarationParser.java.

                                         {
        this.exception = e;
    }

Member Function Documentation

String [] org.javia.arity.DeclarationParser.argNames ( ) [inline, package]

Definition at line 79 of file DeclarationParser.java.

                        {
        if (arity > 0) {
            String argNames[] = new String[arity];
            args.copyInto(argNames);
            return argNames;
        } else {
            return NO_ARGS;
        }
    }

Here is the caller graph for this function:

String [] org.javia.arity.DeclarationParser.argNames ( ) [inline, package]

Definition at line 79 of file DeclarationParser.java.

                        {
        if (arity > 0) {
            String argNames[] = new String[arity];
            args.copyInto(argNames);
            return argNames;
        } else {
            return NO_ARGS;
        }
    }

Here is the call graph for this function:

void org.javia.arity.DeclarationParser.push ( Token  token) throws SyntaxException [inline, package, virtual]

Implements org.javia.arity.TokenConsumer.

Definition at line 43 of file DeclarationParser.java.

                                                  {
        switch (token.id) {
        case Lexer.CALL:
            if (name == null) {
                name = token.name;
                arity = 0;
            } else {
                throw exception.set("repeated CALL in declaration", token.position);
            }
            break;

        case Lexer.CONST:
            if (name == null) {
                name = token.name;
                arity = UNKNOWN_ARITY;
            } else if (arity >= 0) {
                args.addElement(token.name);
                ++arity;
                if (arity > MAX_ARITY) {
                    throw exception.set("Arity too large " + arity, token.position);
                }
            } else {
                throw exception.set("Invalid declaration", token.position);
            }
            break;

        case Lexer.RPAREN:            
        case Lexer.COMMA:
        case Lexer.END:
            break;

        default:
            throw exception.set("invalid token in declaration", token.position);
        }
    }

Here is the call graph for this function:

void org.javia.arity.DeclarationParser.push ( Token  token) throws SyntaxException [inline, package, virtual]

Implements org.javia.arity.TokenConsumer.

Definition at line 43 of file DeclarationParser.java.

                                                  {
        switch (token.id) {
        case Lexer.CALL:
            if (name == null) {
                name = token.name;
                arity = 0;
            } else {
                throw exception.set("repeated CALL in declaration", token.position);
            }
            break;

        case Lexer.CONST:
            if (name == null) {
                name = token.name;
                arity = UNKNOWN_ARITY;
            } else if (arity >= 0) {
                args.addElement(token.name);
                ++arity;
                if (arity > MAX_ARITY) {
                    throw exception.set("Arity too large " + arity, token.position);
                }
            } else {
                throw exception.set("Invalid declaration", token.position);
            }
            break;

        case Lexer.RPAREN:            
        case Lexer.COMMA:
        case Lexer.END:
            break;

        default:
            throw exception.set("invalid token in declaration", token.position);
        }
    }

Here is the call graph for this function:

void org.javia.arity.DeclarationParser.start ( ) [inline, package]

Reimplemented from org.javia.arity.TokenConsumer.

Definition at line 37 of file DeclarationParser.java.

                 {
        name = null;
        args.setSize(0);
    }
void org.javia.arity.DeclarationParser.start ( ) [inline, package]

Reimplemented from org.javia.arity.TokenConsumer.

Definition at line 37 of file DeclarationParser.java.

                 {
        name = null;
        args.setSize(0);
    }

Member Data Documentation

Vector org.javia.arity.DeclarationParser.args = new Vector() [package]

Definition at line 28 of file DeclarationParser.java.

Definition at line 27 of file DeclarationParser.java.

Definition at line 30 of file DeclarationParser.java.

static final int org.javia.arity.DeclarationParser.MAX_ARITY = 5 [static, package]

Definition at line 24 of file DeclarationParser.java.

Definition at line 26 of file DeclarationParser.java.

static final String org.javia.arity.DeclarationParser.NO_ARGS = new String[0] [static, package]

Definition at line 22 of file DeclarationParser.java.

static final int org.javia.arity.DeclarationParser.UNKNOWN_ARITY = -2 [static, package]

Definition at line 23 of file DeclarationParser.java.


The documentation for this class was generated from the following files: