Package cruise.umple.parser
Class TextParser
java.lang.Object
cruise.umple.parser.TextParser
public class TextParser
extends java.lang.Object
Parses textual input and used in conjunction with the umple parser and internal parser to tokenize the contents of a file such
as an Umple file.
Copyright: All contributers to the Umple Project
This file is made available subject to the open source license found at:
http://umple.org/license
-
Constructor Summary
Constructors Constructor Description TextParser()
TextParser(java.lang.String input)
TextParser(java.lang.String filename, java.lang.String input)
-
Method Summary
Modifier and Type Method Description java.lang.String
all()
void
backUpWhitespace()
undoes parsing back to the last non-whitespace useful when we want to determine the real end of a tokenint
currentIndex()
Position
currentPosition()
Used to get positional data on the textual parser.Position
currentPosition(boolean doSkipWhitespace)
void
delete()
java.lang.String
extractFrom(int startIndex)
java.lang.String
getFilename()
java.lang.String
getText()
``````````````````````` INTERFACE ```````````````````````void
insert(java.lang.String newText)
void
insertAfter(Token t, java.lang.String insertText)
void
load(java.lang.String text)
Initializes the textual data in the text file into the parsers character array, for future use in parsing with.java.lang.String
lookFor(java.lang.String startCharacter, java.lang.String stopCharacter, boolean goUntilWhitespace)
java.lang.String
name()
java.lang.String
next()
java.lang.String
nextAfter(boolean stopAtSpace, java.lang.String... stopAfter)
java.lang.String
nextAfter(java.lang.String... stopAfter)
java.lang.String
nextAt(java.lang.String... stopAt)
java.lang.String
nextLine()
java.lang.String
nextUntil(boolean stopAtSpace, boolean alphanumeric, java.lang.String... stopBefore)
java.lang.String
nextUntil(boolean stopAtSpace, java.lang.String... stopBefore)
java.lang.String
nextUntil(java.lang.String... stopBefore)
java.lang.String
nextVariable()
java.lang.String
peek()
java.lang.String
peekAt(java.lang.String... stopAt)
int
previousIndex()
void
replace(Token t, java.lang.String overwriteToken)
void
replace(java.lang.String newText)
void
reset(int startIndex)
Resets the parsers positional data based on a specified index.java.lang.String
section(int startIndex)
void
skipWhitespace()
java.lang.String
toString()
``````````````````````` OBJECT INTERFACE ```````````````````````
-
Constructor Details
-
TextParser
public TextParser() -
TextParser
public TextParser(java.lang.String filename, java.lang.String input) -
TextParser
public TextParser(java.lang.String input)
-
-
Method Details
-
delete
public void delete() -
getText
public java.lang.String getText()``````````````````````` INTERFACE ``````````````````````` -
getFilename
public java.lang.String getFilename() -
reset
public void reset(int startIndex)Resets the parsers positional data based on a specified index.- Parameters:
startIndex
- The specified index that the position will be reset to in the parser.
-
load
public void load(java.lang.String text)Initializes the textual data in the text file into the parsers character array, for future use in parsing with.- Parameters:
text
- The textual input to transform into a character array.
-
all
public java.lang.String all() -
insert
public void insert(java.lang.String newText) -
insertAfter
-
replace
-
replace
public void replace(java.lang.String newText) -
lookFor
public java.lang.String lookFor(java.lang.String startCharacter, java.lang.String stopCharacter, boolean goUntilWhitespace) -
skipWhitespace
public void skipWhitespace() -
backUpWhitespace
public void backUpWhitespace()undoes parsing back to the last non-whitespace useful when we want to determine the real end of a token -
next
public java.lang.String next() -
nextVariable
public java.lang.String nextVariable() -
extractFrom
public java.lang.String extractFrom(int startIndex) -
peek
public java.lang.String peek() -
peekAt
public java.lang.String peekAt(java.lang.String... stopAt) -
nextAt
public java.lang.String nextAt(java.lang.String... stopAt) -
nextUntil
public java.lang.String nextUntil(java.lang.String... stopBefore) -
nextLine
public java.lang.String nextLine() -
nextUntil
public java.lang.String nextUntil(boolean stopAtSpace, java.lang.String... stopBefore) -
nextUntil
public java.lang.String nextUntil(boolean stopAtSpace, boolean alphanumeric, java.lang.String... stopBefore) -
nextAfter
public java.lang.String nextAfter(boolean stopAtSpace, java.lang.String... stopAfter) -
nextAfter
public java.lang.String nextAfter(java.lang.String... stopAfter) -
previousIndex
public int previousIndex() -
currentIndex
public int currentIndex() -
currentPosition
Used to get positional data on the textual parser.- Returns:
- A Position object based off the filename the parser is based on, along with the line number and character index its sitting at.
-
currentPosition
-
section
public java.lang.String section(int startIndex) -
name
public java.lang.String name() -
toString
public java.lang.String toString()``````````````````````` OBJECT INTERFACE ```````````````````````- Overrides:
toString
in classjava.lang.Object
-