本文整理汇总了Java中org.eclipse.jface.text.rules.ICharacterScanner.read方法的典型用法代码示例。如果您正苦于以下问题:Java ICharacterScanner.read方法的具体用法?Java ICharacterScanner.read怎么用?Java ICharacterScanner.read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.text.rules.ICharacterScanner
的用法示例。
在下文中一共展示了ICharacterScanner.read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cleanupAndReturn
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
boolean cleanupAndReturn(ICharacterScanner scanner, boolean result){
if (result){
return true; // do not clean up - pos is as wanted
}
if (count==0){
return result;
}
if (count>0){
while(count!=0){
scanner.unread();
count--;
}
}else{
while(count!=0){
scanner.read();
count++;
}
}
return false;
}
示例2: evaluate
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
int r = scanner.read();
scanner.unread();
/* fast guard closing:*/
if (ICharacterScanner.EOF==r || r!='<'){
return Token.UNDEFINED;
}
ICharacterScannerCodePosSupport codePosSupport = new ICharacterScannerCodePosSupport(scanner);
if (hereStringSupport.isHereStringStateHandled(codePosSupport)){
return getSuccessToken();
}
codePosSupport.resetToStartPos();
return Token.UNDEFINED;
}
示例3: evaluate
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
int r = scanner.read();
scanner.unread();
/* fast guard closing:*/
if (ICharacterScanner.EOF==r || r!='<'){
return Token.UNDEFINED;
}
ICharacterScannerCodePosSupport codePosSupport = new ICharacterScannerCodePosSupport(scanner);
if (hereDocSupport.isHereDocStateHandled(codePosSupport)){
return getSuccessToken();
}
codePosSupport.resetToStartPos();
return Token.UNDEFINED;
}
示例4: doEvaluate
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
@Override
protected IToken doEvaluate(final ICharacterScanner scanner, final boolean resume) {
if (resume) {
if (this.endSequenceDetected(scanner)) {
return this.fToken;
}
} else {
final int c = scanner.read();
if (c == this.fStartSequence[0]) {
if (this.sequenceDetected(scanner, this.fStartSequence, false)) {
if (this.endSequenceDetected(scanner)) {
return this.fToken;
}
}
}
}
scanner.unread();
return Token.UNDEFINED;
}
示例5: gotoEOL
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
private boolean gotoEOL(ICharacterScanner scanner, boolean consumeEOL) {
boolean blank = true;
int b = scanner.read();
while (!isEol(b)) {
blank = blank && Character.isWhitespace(b);
b = scanner.read();
}
if (b == ICharacterScanner.EOF) scanner.unread();
if (consumeEOL) {
b = scanner.read();
if (b == '\r') {
b = scanner.read();
}
if (b == ICharacterScanner.EOF) scanner.unread();
}
return blank;
}
示例6: sequenceDetected
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
private boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean forward, boolean eofAllowed) {
int c = scanner.read();
if (c == ICharacterScanner.EOF) {
if (forward) return false;
return eofAllowed ? true : false;
}
scanner.unread();
try {
String txt = getScanText(scanner, 6, forward);
String regex = String.valueOf(sequence);
if (forward && txt.matches(regex + ".*")) {
return true;
}
if (!forward && txt.matches(".*" + regex)) {
return true;
}
} catch (BadLocationException e) {}
return false;
}
示例7: sequenceDetected
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
protected boolean sequenceDetected( ICharacterScanner scanner, char[] sequence, boolean eofAllowed){
int c = scanner.read();
if (sequence[0] == '<') {
if (c == '?') {
// processing instruction - abort
scanner.unread();
return false;
}
if (c == '!') {
scanner.unread();
// comment - abort
return false;
}
} else if (sequence[0] == '>') {
scanner.unread();
}
return super.sequenceDetected(scanner, sequence, eofAllowed);
}
示例8: doEvaluate
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
/**
* Does the actual evaluation of the stream.
*
* @param scanner The scanner
* @param count The initial count of {
* @return <code>fToken</code> on success, <code>Token.UNDEFINED</code> if
* the match doesn't succeed
*/
private IToken doEvaluate(ICharacterScanner scanner, int count) {
boolean inString = false;
int c = scanner.read();
if (((char) c) == '{') {
do {
c = scanner.read();
if (((char) c) == '{' && !inString)
count++;
else if (((char) c) == '}' && !inString)
count--;
else if (((char) c) == '"' && !inString)
inString = true;
else if (((char) c) == '"' && inString)
inString = false;
else if (c == ICharacterScanner.EOF)
return Token.UNDEFINED;
} while (count > 0);
return fToken;
}
scanner.unread();
return Token.UNDEFINED;
}
示例9: evaluate
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
if (resume) {
boolean inString = false;
do {
int c = scanner.read();
if (((char) c) == ',' && !inString)
break;
else if (((char) c) == '@') {
scanner.unread();
return Token.UNDEFINED;
} else if (((char) c) == '"' && !inString)
inString = true;
else if (((char) c) == '"' && inString)
inString = false;
else if (c == ICharacterScanner.EOF)
return Token.UNDEFINED;
} while (true);
}
return doEvaluate(scanner, 1);
}
示例10: evaluate
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
if (fColumn == UNDEFINED) return doEvaluate(scanner, resume);
int c = scanner.read();
scanner.unread();
if (c == fStartSequence[0]) {
int col = scanner.getColumn();
if (col == 1) {
scanner.unread();
int p = scanner.read();
if (p == '\n') col = 0;
}
return (fColumn == col ? doEvaluate(scanner, resume) : Token.UNDEFINED);
}
return Token.UNDEFINED;
}
示例11: sequenceDetected
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
protected boolean sequenceDetected(ICharacterScanner scanner,
char[] sequence, boolean eofAllowed) {
int c = scanner.read();
if (sequence[0] == '<') {
if (c == '?') {
// processing instruction - abort
scanner.unread();
return false;
}
if (c == '!') {
scanner.unread();
// comment - abort
return false;
}
if (c == '/') {
// end tag
scanner.unread();
return false;
}
} else if (sequence[0] == '>') {
scanner.unread();
}
return super.sequenceDetected(scanner, sequence, eofAllowed);
}
示例12: gotoEOL
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
private boolean gotoEOL(ICharacterScanner scanner, boolean consumeEOL) {
int b = scanner.read();
scanner.unread();
while (!isEol(b)) {
b = scanner.read();
}
if (b == ICharacterScanner.EOF) {
scanner.unread();
return false;
}
if (consumeEOL) {
b = scanner.read();
if (b == '\r') {
b = scanner.read();
}
if (b == ICharacterScanner.EOF) {
scanner.unread();
return false;
}
}
return true;
}
示例13: scannerRead
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
private int scannerRead(ICharacterScanner scanner, Counter counter) {
int c = scanner.read();
if (c==ICharacterScanner.EOF){
return c;
}
counter.count++;
if (trace){
traceSb.append((char)c);
}
return c;
}
示例14: doEvaluate
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
protected IToken doEvaluate(ICharacterScanner scanner, boolean resume) {
if (resume) {
if (endSequenceDetected(scanner))
return fToken;
} else {
int c= scanner.read();
if (c == fStartSequence[0]) {
scanner.unread();
scanner.unread();
int before = scanner.read();
if (before=='\\'){
return Token.UNDEFINED;
}
scanner.read();
if (sequenceDetected(scanner, fStartSequence, false)) {
if (endSequenceDetected(scanner))
return fToken;
}
}
}
scanner.unread();
return Token.UNDEFINED;
}
示例15: evaluate
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
char start = (char) scanner.read();
if ('-' !=start) {
scanner.unread();
return Token.UNDEFINED;
}
/* check if the former character is a space - if not this is not an argument */
scanner.unread();
scanner.unread();
char beforeStart = (char) scanner.read();
if (' ' !=beforeStart){
/* no unread necessary, scanner is at start start*/
return Token.UNDEFINED;
}
/* go after start again*/
scanner.read();
/* okay could be a parameter*/
do {
char c = (char) scanner.read();
if (! isPartOfParameter(c)) {
scanner.unread();
break;
}
} while (true);
return getSuccessToken();
}