edu.mit.ai.psg.strings
Class Prettify.ASCIISyntax

java.lang.Object
  |
  +--edu.mit.ai.psg.strings.Prettify.ASCIISyntax
Direct Known Subclasses:
Prettify.JavaSyntax
Enclosing class:
Prettify

public static class Prettify.ASCIISyntax
extends Object
implements Prettify.Syntax

ASCII-only syntax


Constructor Summary
Prettify.ASCIISyntax()
           
 
Method Summary
 boolean isClose(char c)
          is ), ], or }
 boolean isCloseQuote(char c)
          is '\"'
 boolean isEscapeChar(char c)
          is '\\'
 boolean isLetterOrDigit(char c)
          is a-z, A-Z, or 0-9
 boolean isMatchedClose(char open, char close)
          is (), [], or {}
 boolean isMatchedCloseQuote(char open, char close)
          is ""
 boolean isOpen(char c)
          is (, [, or {
 boolean isOpenQuote(char c)
          is '\"'
 boolean isSeparator(char c)
          is ',' or ';'
 boolean isWhitespace(char c)
          is ' ', '\t', '\n', '\r', or '\f'
 int skipString(String input, int position)
          skips "contiguous strings" from open quote to matching close quote
 int skipWhitespace(String input, int position)
          skip over space.
 int skipWord(String input, int position)
          skips contiguous sequences of characters which satisfy isLetterOrDigit(char) or is not any of isWhitespace(char), isSeparator(char), isOpen(char), isClose(char), isOpenQuote(char), or isCloseQuote(char).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Prettify.ASCIISyntax

public Prettify.ASCIISyntax()
Method Detail

isWhitespace

public boolean isWhitespace(char c)
is ' ', '\t', '\n', '\r', or '\f'
Specified by:
isWhitespace in interface Prettify.Syntax
Tags copied from interface: Prettify.Syntax
See Also:
Character.isWhitespace

isLetterOrDigit

public boolean isLetterOrDigit(char c)
is a-z, A-Z, or 0-9
Specified by:
isLetterOrDigit in interface Prettify.Syntax
Tags copied from interface: Prettify.Syntax
See Also:
Character.isLetterOrDigit

isOpen

public boolean isOpen(char c)
is (, [, or {
Specified by:
isOpen in interface Prettify.Syntax

isClose

public boolean isClose(char c)
is ), ], or }
Specified by:
isClose in interface Prettify.Syntax

isMatchedClose

public boolean isMatchedClose(char open,
                              char close)
is (), [], or {}
Specified by:
isMatchedClose in interface Prettify.Syntax

isSeparator

public boolean isSeparator(char c)
is ',' or ';'
Specified by:
isSeparator in interface Prettify.Syntax

isOpenQuote

public boolean isOpenQuote(char c)
is '\"'
Specified by:
isOpenQuote in interface Prettify.Syntax

isCloseQuote

public boolean isCloseQuote(char c)
is '\"'
Specified by:
isCloseQuote in interface Prettify.Syntax

isMatchedCloseQuote

public boolean isMatchedCloseQuote(char open,
                                   char close)
is ""
Specified by:
isMatchedCloseQuote in interface Prettify.Syntax

isEscapeChar

public boolean isEscapeChar(char c)
is '\\'
Specified by:
isEscapeChar in interface Prettify.Syntax

skipWhitespace

public int skipWhitespace(String input,
                          int position)
Description copied from interface: Prettify.Syntax
skip over space.
Specified by:
skipWhitespace in interface Prettify.Syntax
Tags copied from interface: Prettify.Syntax
Returns:
index in input string of first nonspace character searching from position, or length of string if none

skipWord

public int skipWord(String input,
                    int position)
             throws StringIndexOutOfBoundsException
skips contiguous sequences of characters which satisfy isLetterOrDigit(char) or is not any of isWhitespace(char), isSeparator(char), isOpen(char), isClose(char), isOpenQuote(char), or isCloseQuote(char).
Specified by:
skipWord in interface Prettify.Syntax
Tags copied from interface: Prettify.Syntax
Returns:
index in input string of first possible line break or length of string if none
Throws:
IllegalArgumentException - if escape char at end of input.

skipString

public int skipString(String input,
                      int position)
               throws StringIndexOutOfBoundsException
skips "contiguous strings" from open quote to matching close quote
Specified by:
skipString in interface Prettify.Syntax
Tags copied from interface: Prettify.Syntax
Returns:
index in input string of first char after matching quote.
Throws:
IllegalArgumentException - if no matching quote found.

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu