OCL

org.topcased.editors.ocleditor.assistant
Class OCLContentScanner

java.lang.Object
  extended by org.topcased.editors.ocleditor.assistant.OCLContentScanner

public class OCLContentScanner
extends java.lang.Object

The OCL Scanner


Field Summary
static java.lang.Integer ARROW
           
static java.lang.Integer BAR
           
static java.lang.Integer BASIC_OPERATION
           
static java.lang.Integer BRACES
           
static java.lang.Integer COLLECTION
           
static java.lang.Integer COLON
           
static java.lang.Integer COMA
           
static java.lang.Integer COMMENT
           
static java.lang.Integer DOT
           
static java.lang.Integer DOUBLE_COLON
           
static java.lang.Integer KEYWORD
           
static java.lang.Integer LEFT_BRACKET
           
static java.lang.Integer NUMBER
           
static java.lang.Integer OPERATIONS
           
static java.lang.Integer REGIONWORD
           
static java.lang.Integer RIGHT_BRACKET
           
static java.lang.Integer SEPARATOR
           
static java.lang.Integer STRING
           
static java.lang.Integer WORD
           
 
Constructor Summary
OCLContentScanner()
          Constructor
 
Method Summary
 boolean endOfScanner()
          Returns if the end of the range of the document has been reached.
 boolean findBar()
           
 boolean findMatchingRightBracket()
          This function move the scanner forward until the matching bracket is found.
 int getTokenOffset()
           
 java.lang.String getTokenValue()
           
 org.eclipse.jface.text.rules.IToken lookFor(java.lang.String element, int offset, int length)
          This function uses the scanner to look for the element in the given range of the document The scanner is positionned right after the element.
 org.eclipse.jface.text.rules.IToken nextToken()
          Returns the next token in the document that is not a whitespace.
 void setDocument(org.eclipse.jface.text.IDocument document)
           
 void setRange(int offset, int length)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WORD

public static final java.lang.Integer WORD

SEPARATOR

public static final java.lang.Integer SEPARATOR

COMMENT

public static final java.lang.Integer COMMENT

COLON

public static final java.lang.Integer COLON

KEYWORD

public static final java.lang.Integer KEYWORD

LEFT_BRACKET

public static final java.lang.Integer LEFT_BRACKET

RIGHT_BRACKET

public static final java.lang.Integer RIGHT_BRACKET

BASIC_OPERATION

public static final java.lang.Integer BASIC_OPERATION

DOT

public static final java.lang.Integer DOT

ARROW

public static final java.lang.Integer ARROW

BAR

public static final java.lang.Integer BAR

COMA

public static final java.lang.Integer COMA

DOUBLE_COLON

public static final java.lang.Integer DOUBLE_COLON

COLLECTION

public static final java.lang.Integer COLLECTION

BRACES

public static final java.lang.Integer BRACES

NUMBER

public static final java.lang.Integer NUMBER

STRING

public static final java.lang.Integer STRING

REGIONWORD

public static final java.lang.Integer REGIONWORD

OPERATIONS

public static final java.lang.Integer OPERATIONS
Constructor Detail

OCLContentScanner

public OCLContentScanner()
Constructor

Method Detail

setDocument

public void setDocument(org.eclipse.jface.text.IDocument document)

setRange

public void setRange(int offset,
                     int length)

nextToken

public org.eclipse.jface.text.rules.IToken nextToken()
Returns the next token in the document that is not a whitespace.
Returns a token where isEOF is true if the end of the document has been reached.

Returns:
the next token

getTokenValue

public java.lang.String getTokenValue()

lookFor

public org.eclipse.jface.text.rules.IToken lookFor(java.lang.String element,
                                                   int offset,
                                                   int length)
This function uses the scanner to look for the element in the given range of the document The scanner is positionned right after the element.

Parameters:
element - the string to be looked for
offset - the search starting offset
length - the search length
Returns:
the token corresponding to the element or null if not found.

getTokenOffset

public int getTokenOffset()

findMatchingRightBracket

public boolean findMatchingRightBracket()
This function move the scanner forward until the matching bracket is found. If no matching bracket is found the scanner is set at the end of the text and return false.

Returns:
true if a matching bracket is found, false otherwise

endOfScanner

public boolean endOfScanner()
Returns if the end of the range of the document has been reached.
If false is returned, then the next token will return false to the method isEOF.

Returns:
true if the next token returns true with the method isEOF

findBar

public boolean findBar()

OCL

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.