net.sourceforge.nrl.parser.preprocessing
Class ReferencePreprocessor

java.lang.Object
  extended by net.sourceforge.nrl.parser.preprocessing.ReferencePreprocessor

public class ReferencePreprocessor
extends Object

The reference processor class detects fragment references, and resolves them before the main parsing stage.

It scans the rule file for fragment declarations, and then for any sentence fragments that equal the fragment declaration. If it finds any, it puts the curly brackets that the parser expects around them.

For example, if "this is a fragment" is declared as a fragment somewhere and the text this is a fragment is detected in the rule file, it has curly brackets placed around it.

Author:
Christian Nentwich

Field Summary
protected static String ACTION_FRAGMENT_KEYWORD
           
protected static char PROP_END
           
protected static char PROP_START
           
protected static String VALIDATION_FRAGMENT_KEYWORD
           
 
Constructor Summary
ReferencePreprocessor()
           
 
Method Summary
 String[] getFragmentNames(String input)
          Return all fragment names declared in a file
protected  boolean isQuotedLine(String input, int pos)
          Return true if the position is in a quoted line
 String process(String input)
           
 String process(String input, String[] properties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATION_FRAGMENT_KEYWORD

protected static final String VALIDATION_FRAGMENT_KEYWORD
See Also:
Constant Field Values

ACTION_FRAGMENT_KEYWORD

protected static final String ACTION_FRAGMENT_KEYWORD
See Also:
Constant Field Values

PROP_START

protected static final char PROP_START
See Also:
Constant Field Values

PROP_END

protected static final char PROP_END
See Also:
Constant Field Values
Constructor Detail

ReferencePreprocessor

public ReferencePreprocessor()
Method Detail

process

public String process(String input)

process

public String process(String input,
                      String[] properties)

getFragmentNames

public String[] getFragmentNames(String input)
Return all fragment names declared in a file

Returns:
the fragment names

isQuotedLine

protected boolean isQuotedLine(String input,
                               int pos)
Return true if the position is in a quoted line

Parameters:
input - the document
pos - position
Returns:
true if quoted, false otherwise


Copyright © 2006-2013. All Rights Reserved.