Macros

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.core.parser.JFlex
Class Macros

    java.lang.Object
      weka.core.parser.JFlex.Macros

    public final class Macros

extends java.lang.Object

Symbol table and expander for macros. Maps macros to their (expanded) definitions, detects cycles and unused macros.

Version:
  JFlex 1.4.1, $Revision: 1.1 $, $Date: 2008-05-09 09:14:11 $
Author:
  Gerwin Klein

Constructor Summary
`Macros()` Creates a new macro expander.

Method Summary
`void` | `expand()` Expands all stored macros, so that getDefinition always returns a defintion that doesn't contain any macro usages.
`RegExp` | `getDefinition(java.lang.String name)` Fetches the definition of the macro with the specified name,
`boolean` | `insert(java.lang.String name, RegExp definition)` Stores a new macro and its definition.
`boolean` | `isUsed(java.lang.String name)` Tests if a macro has been used.
`boolean` | `markUsed(java.lang.String name)` Marks a makro as used.
`java.util.Enumeration` | `unused()` Returns all unused macros.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Macros

    public Macros()

  Creates a new macro expander.

Method Detail

### insert

    public boolean insert(java.lang.String name,
                          RegExp definition)

  Stores a new macro and its definition.

  Parameters:
    `name` - the name of the new macro
    `definition` - the definition of the new macro
  Returns:
    `true`, iff the macro name has not been stored before.

### markUsed

    public boolean markUsed(java.lang.String name)

  Marks a makro as used.

  Returns:
    `true`, iff the macro name has been stored before.

### isUsed

    public boolean isUsed(java.lang.String name)

  Tests if a macro has been used.

  Returns:
    `true`, iff the macro has been used in a regular expression.

### unused

    public java.util.Enumeration unused()

  Returns all unused macros.

  Returns:
    the enumeration of macro names that have not been used.

### getDefinition

    public RegExp getDefinition(java.lang.String name)

  Fetches the definition of the macro with the specified name,

  The definition will either be the same as stored (expand() not called), or an equivalent one, that doesn't contain any macro usages (expand() called before).

  Parameters:
    `name` - the name of the macro
  Returns:
    the definition of the macro, `null` if no macro with the specified name has been stored.
  See Also:
    `JFlex.Macros#expand`

### expand

    public void expand()
                throws MacroException

  Expands all stored macros, so that getDefinition always returns a defintion that doesn't contain any macro usages.

  Throws:
    `MacroException` - if there is a cycle in the macro usage graph.

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD