abc.parser
Class AbcParserAbstract

java.lang.Object
  extended byabc.parser.AbcParserAbstract
Direct Known Subclasses:
AbcFileParser, TuneParser

public class AbcParserAbstract
extends java.lang.Object

Abstract class from which all abc notation parsers inherit. Known limitations: ELEMSKIP is not supported. The context to switch from abc header parsing to abc music parsing is done in

private KeySignature parseFieldKey(Set follow)
.


Constructor Summary
AbcParserAbstract()
          Constructs a new tune parser.
 
Method Summary
 void addListener(TuneParserListenerInterface listener)
          Adds a listener to catch events thrown by the parser durin tune parsing.
 Scanner getScanner()
          Returns the scanner internally used for parsing.
 Tune parse(java.io.Reader charStream)
          Parses the specified stream in ABC notation.
 Tune parse(java.lang.String tune)
          Parse the given string and creates a Tune object as parsing result.
 Tune parseHeader(java.io.Reader charStream)
          Parse the given string and creates a Tune object with no score as parsing result.
 Tune parseHeader(java.lang.String tune)
          Parses the header of the specified tune notation.
 void removeListener(TuneParserListenerInterface listener)
          Removes a listener from this parser.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbcParserAbstract

public AbcParserAbstract()
Constructs a new tune parser.

Method Detail

getScanner

public Scanner getScanner()
Returns the scanner internally used for parsing.

Returns:
The scanner internally used for parsing.

addListener

public void addListener(TuneParserListenerInterface listener)
Adds a listener to catch events thrown by the parser durin tune parsing.

Parameters:
listener - Object that implements the TuneParserListenerInterface.

removeListener

public void removeListener(TuneParserListenerInterface listener)
Removes a listener from this parser.

Parameters:
listener - The listener to be removed.

parse

public Tune parse(java.lang.String tune)
Parse the given string and creates a Tune object as parsing result.

Parameters:
tune - The abc tune, as a String, to be parsed.
Returns:
An object representation of the abc notation string.

parse

public Tune parse(java.io.Reader charStream)
Parses the specified stream in ABC notation.

Parameters:
charStream - Tune stream in ABC notation.
Returns:
A tune representing the ABC notation stream.

parseHeader

public Tune parseHeader(java.lang.String tune)
Parses the header of the specified tune notation.

Parameters:
tune - A tune notation in ABC.
Returns:
A tune representing the ABC notation with header values only.

parseHeader

public Tune parseHeader(java.io.Reader charStream)
Parse the given string and creates a Tune object with no score as parsing result. This purpose of this method method is to provide a faster parsing when just abc header fields are needed.

Parameters:
charStream - The stream to be parsed.
Returns:
An object representation with no score of the abc notation string.