coins.casttohir
クラス ParseString

java.lang.Object
  |
  +--coins.casttohir.ParseString

public class ParseString
extends java.lang.Object

ParseString class Parse given String operand. Successive call of getNextToken() will return tokens in the given string successively. The token kind is one of DIGITS, IDENTIFIER, STRING, DELIMITER, UNKNOWN The token kind are listed up as public static final int item in this class. DIGITS is a string consisting of digit character only. IDENTIFIER is a string consisting of alphabet (upper case and lower case), digits, and special characters specified by the parameter pSpIdChars. IDENTIFIER does not begin with digit. STRING is a character string starting with '"' and ending with '"'. DELIMITER is a character specified by the parameter pDelimiters. Characters indicated by the parameter pSpaces are skipped in the parsing operation. To see if there is no more token left, call hasNext(). If there is no token remaining, getNextToken() will return ""; If token kind is undefined, getNextToken() will return "".


フィールドの概要
(パッケージプライベート) static java.lang.String[] alphabetCharacters
           
static int DELIMITER
           
(パッケージプライベート) static java.lang.String[] digitCharacters
           
static int DIGITS
           
static int IDENTIFIER
           
static int STRING
           
static int UNDEFINED
           
 
コンストラクタの概要
ParseString(java.lang.String pText, java.util.Set pDelimiters, java.util.Set pSpaces, java.util.Set pIdSpChars)
          ParseString constructor Example: ParseString lParseString = new ParseString( "#param %I32, %I32, w%I32\n", fromStringToSet("#%,\n"), fromStringToSet(" \t"), fromStringToSet("_"));
 
メソッドの概要
(パッケージプライベート)  java.lang.String characterString()
           
(パッケージプライベート)  java.lang.String digitString()
           
static java.util.Set fromStringToSet(java.lang.String pString)
          Make a set of Strings by taking out characters contained in the parameter pString and changing each character to a string of length 1.
 java.lang.String getNextToken()
          getNextToken Get the next token and advance the token position.
 int getTokenKind()
          Get the token kind of the token returned by getNextToken().
 boolean hasNext()
           
(パッケージプライベート)  java.lang.String identifierString()
           
 java.lang.String seeCurrentToken()
          getNextToken Get the next token and advance the token position.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

UNDEFINED

public static final int UNDEFINED
関連項目:
定数フィールド値

IDENTIFIER

public static final int IDENTIFIER
関連項目:
定数フィールド値

DELIMITER

public static final int DELIMITER
関連項目:
定数フィールド値

DIGITS

public static final int DIGITS
関連項目:
定数フィールド値

STRING

public static final int STRING
関連項目:
定数フィールド値

alphabetCharacters

static final java.lang.String[] alphabetCharacters

digitCharacters

static final java.lang.String[] digitCharacters
コンストラクタの詳細

ParseString

public ParseString(java.lang.String pText,
                   java.util.Set pDelimiters,
                   java.util.Set pSpaces,
                   java.util.Set pIdSpChars)
ParseString constructor Example: ParseString lParseString = new ParseString( "#param %I32, %I32, w%I32\n", fromStringToSet("#%,\n"), fromStringToSet(" \t"), fromStringToSet("_"));

パラメータ:
pText - Text string to be parsed.
pDelimiters - Set of character strings (character in the form of String) to be treated as a delimiting token.
pSpaces - Set of character strings to be treated as a space (not a token).
pIdSpChars - Set of special character (non-alphanumeric character) strings used in identifiers.
メソッドの詳細

hasNext

public boolean hasNext()

getNextToken

public java.lang.String getNextToken()
getNextToken Get the next token and advance the token position. The resultant string is applied intern(). To see its token kind, call getTokenKind().

戻り値:
the character string of the next token.

seeCurrentToken

public java.lang.String seeCurrentToken()
getNextToken Get the next token and advance the token position. To see its token kind, call getTokenKind().

戻り値:
the character string of the next token.

getTokenKind

public int getTokenKind()
Get the token kind of the token returned by getNextToken(). The token kind is one of DIGIT, IDENTIFIER, STRING, DELIMITER, UNDEFINED.

戻り値:
the token kind of the token returned by

fromStringToSet

public static java.util.Set fromStringToSet(java.lang.String pString)
Make a set of Strings by taking out characters contained in the parameter pString and changing each character to a string of length 1. For example, if pString is "(),:;" then the resultant set is { "(", ")", ",", ":", ";" }

パラメータ:
pString - specifies the characters to be included in the resultant set.
戻り値:
the set of strings obtained from pString.

digitString

java.lang.String digitString()

characterString

java.lang.String characterString()

identifierString

java.lang.String identifierString()