本文整理汇总了Java中org.eclipse.jface.text.rules.ICharacterScanner.getColumn方法的典型用法代码示例。如果您正苦于以下问题:Java ICharacterScanner.getColumn方法的具体用法?Java ICharacterScanner.getColumn怎么用?Java ICharacterScanner.getColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.text.rules.ICharacterScanner
的用法示例。
在下文中一共展示了ICharacterScanner.getColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
@Override
public IToken evaluate(ICharacterScanner scanner) {
int c = scanner.read();
if (c != ICharacterScanner.EOF && 0 == scanner.getColumn() - 1) {
try {
if (dotStarts(scanner, c)) {
gotoEOB(scanner, c);
return getSuccessToken();
}
} catch (BadLocationException e) {
Log.error("DotCodeRule", e);
}
}
scanner.unread();
return Token.UNDEFINED;
}
示例2: evaluate
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
@Override
public IToken evaluate(ICharacterScanner scanner) {
int col = scanner.getColumn();
if (col == 1) {
scanner.unread();
int p = scanner.read();
if (p == '\n') col = 0;
}
try {
if (col == 0) {
String text = getScanText(scanner);
if (tagStarts(text)) {
gotoEOB(scanner);
return getSuccessToken();
}
}
} catch (BadLocationException e) {
Log.error("HtmlCodeRule", e);
}
return Token.UNDEFINED;
}
示例3: 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;
}
示例4: evaluate
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
@Override
public IToken evaluate(ICharacterScanner scanner) {
found = false;
int c = scanner.read();
scanner.unread();
if (isHws(c)) {
int col = scanner.getColumn();
if (col == 1) {
scanner.unread();
int p = scanner.read();
if (p == '\n') col = 0;
}
if (col == 0) {
tabWidth = FluentMkUI.getDefault().getPreferenceStore().getInt(Prefs.EDITOR_TAB_WIDTH);
if (tabWidth < 2) tabWidth = 4;
line = 0;
while (evaluateLine(scanner)) {
found = true;
line++;
}
}
}
if (found) return token;
return Token.UNDEFINED;
}
示例5: 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] && fColumn == scanner.getColumn()) {
if (((RuleBasedScanner) scanner).getTokenOffset() == 0) {
return doEvaluate(scanner, resume);
}
}
return Token.UNDEFINED;
}
示例6: gotoEOB
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
private void gotoEOB(ICharacterScanner scanner) {
// Log.error("Beg block at " + getOffset(scanner));
int mark = scanner.getColumn();
while (!gotoEOL(scanner, true)) { // read line, testing for blank
mark = scanner.getColumn(); // mark beginning of each line
}
rewindToMark(scanner, mark); // to start of blank line
rewindEOL(scanner); // rewind through EOL
// Log.error("End block at " + getOffset(scanner));
}
示例7: evaluate
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
public IToken evaluate(ICharacterScanner scanner) {
if (scanner.getColumn() != 0) {
return Token.UNDEFINED;
}
// // Fast mode
// if (scanner.read() != '-') {
// scanner.unread();
// return Token.UNDEFINED;
// }
// if (Character.isWhitespace(scanner.read())) {
// return fToken;
// }
// scanner.unread();
// scanner.unread();
// return Token.UNDEFINED;
// // Fast mode
int readCount = 0;
int c;
while ((c = scanner.read()) != ICharacterScanner.EOF) {
readCount++;
if (!Character.isWhitespace(c)) {
int after = scanner.read();
// readCount++;
scanner.unread();
// if ( markerList.contains(c) && Character.isWhitespace( after ) ) {
if ((c == '-' || c == '+' || c == '*') && Character.isWhitespace(after)) {
return fToken;
} else {
for (; readCount > 0; readCount--)
scanner.unread();
return Token.UNDEFINED;
}
}
}
// Reached ICharacterScanner.EOF
for (; readCount > 0; readCount--)
scanner.unread();
return Token.UNDEFINED;
}
示例8: 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])
return (fColumn == scanner.getColumn() ? doEvaluate(scanner, resume) : Token.UNDEFINED);
return Token.UNDEFINED;
}
示例9: evaluateLine
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
private boolean evaluateLine(ICharacterScanner scanner) {
// Log.error("Examining line at offset " + getOffset(scanner));
boolean found = false;
String indents = "";
int mark = scanner.getColumn(); // mark BOL
int c = scanner.read();
if (isEol(c)) { // stop if blank line
// Log.error("Min blank line");
rewindToMark(scanner, mark); // rewind to BOL
return false;
}
while (isHws(c)) { // collect the indent
indents += (char) c;
c = scanner.read();
if (isEol(c)) { // stop if blank line
// Log.error("Indented blank line");
rewindToMark(scanner, mark); // rewind to BOL
return false;
}
}
scanner.unread();
if (line == 0) { // check only first line of codeblock
if (isList(scanner)) { // stop if a list
// Log.error("List line");
rewindToMark(scanner, mark); // rewind to BOL
return false;
}
}
if (isCodeIndent(indents)) { // consume through EOL if code indent
found = true;
gotoEOL(scanner, true);
} else { // otherwise rewind to BOL
rewindToMark(scanner, mark);
}
return found;
}
示例10: sequenceDetected
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) {
/* sequence is not the word found by word detector but the start sequence!!!!! (in this case always the exact word)*/
// -------------------------------------------------
// example: exactWord='test'
//
// subjects: atest,test,testa
// ^----------------only result!
Counter counter = new Counter();
if (trace){
// trace contains NOT first character, this is done at PatternRule
traceSb = new StringBuilder();
}
int column=scanner.getColumn();
boolean wordHasPrefix;
if (column==1){
wordHasPrefix=false;
}else{
scannerUnread(scanner, counter);
scannerUnread(scanner, counter);
char charBefore =(char)scannerRead(scanner, counter);
scannerRead(scanner, counter);
wordHasPrefix = isIllegalPrefixCharacter(charBefore);
}
if (wordHasPrefix){
scannerRead(scanner, counter);
return counter.cleanupAndReturn(scanner,false);
}
for (int i= 1; i < sequence.length; i++) {
int c= scannerRead(scanner, counter);
if (c == ICharacterScanner.EOF){
if (eofAllowed) {
return counter.cleanupAndReturn(scanner,true);
}else{
return counter.cleanupAndReturn(scanner,false);
}
} else if (c != sequence[i]) {
scannerUnread(scanner, counter);
for (int j= i-1; j > 0; j--){
scannerUnread(scanner, counter);
}
return counter.cleanupAndReturn(scanner,false);
}
}
int read = scannerRead(scanner, counter);
char charAfter = (char)read;
scannerUnread(scanner, counter);
/* when not allowedPostFix and not a whitespace and not end reached - do cleanup*/
if (charAfter!=allowedPostfix && ! Character.isWhitespace(charAfter) && ICharacterScanner.EOF!=read){
/* the word is more than the exact one - e.g. instead of 'test' 'testx' ... so not correct*/
return counter.cleanupAndReturn(scanner,false);
}
return counter.cleanupAndReturn(scanner,true);
}
示例11: sequenceDetected
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) {
/* sequence is not the word found by word detector but the start sequence!!!!! (in this case always the exact word)*/
// -------------------------------------------------
// example: exactWord='test'
//
// subjects: atest,test,testa
// ^----------------only result!
Counter counter = new Counter();
if (trace){
// trace contains NOT first character, this is done at PatternRule
traceSb = new StringBuilder();
}
int column=scanner.getColumn();
boolean wordHasPrefix;
if (column==1){
wordHasPrefix=false;
}else{
scannerUnread(scanner, counter);
scannerUnread(scanner, counter);
char charBefore =(char)scannerRead(scanner, counter);
scannerRead(scanner, counter);
wordHasPrefix = isPrefixCharacter(charBefore);
}
if (wordHasPrefix){
scannerRead(scanner, counter);
return counter.cleanupAndReturn(scanner,false);
}
for (int i= 1; i < sequence.length; i++) {
int c= scannerRead(scanner, counter);
if (c == ICharacterScanner.EOF){
if (eofAllowed) {
return counter.cleanupAndReturn(scanner,true);
}else{
return counter.cleanupAndReturn(scanner,false);
}
} else if (c != sequence[i]) {
scannerUnread(scanner, counter);
for (int j= i-1; j > 0; j--){
scannerUnread(scanner, counter);
}
return counter.cleanupAndReturn(scanner,false);
}
}
int read = scannerRead(scanner, counter);
char charAfter = (char)read;
scannerUnread(scanner, counter);
/* when not a = at end- do cleanup*/
if (charAfter != '=' ){
/* the word is more than the exact one - e.g. instead of 'test' 'testx' ... so not correct*/
return counter.cleanupAndReturn(scanner,false);
}
return counter.cleanupAndReturn(scanner,true);
}
示例12: sequenceDetected
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) {
/* sequence is not the word found by word detector but the start sequence!!!!! (in this case always the exact word)*/
// -------------------------------------------------
// example: exactWord='test'
//
// subjects: atest,test,testa
// ^----------------only result!
Counter counter = new Counter();
if (trace){
// trace contains NOT first character, this is done at PatternRule
traceSb = new StringBuilder();
}
int column=scanner.getColumn();
boolean wordHasPrefix;
if (column==1){
wordHasPrefix=false;
}else{
scannerUnread(scanner, counter);
scannerUnread(scanner, counter);
char charBefore =(char)scannerRead(scanner, counter);
scannerRead(scanner, counter);
wordHasPrefix = isPrefixCharacter(charBefore);
}
if (wordHasPrefix){
scannerRead(scanner, counter);
return counter.cleanupAndReturn(scanner,false);
}
for (int i= 1; i < sequence.length; i++) {
int c= scannerRead(scanner, counter);
if (c == ICharacterScanner.EOF){
if (eofAllowed) {
return counter.cleanupAndReturn(scanner,true);
}else{
return counter.cleanupAndReturn(scanner,false);
}
} else if (c != sequence[i]) {
scannerUnread(scanner, counter);
for (int j= i-1; j > 0; j--){
scannerUnread(scanner, counter);
}
return counter.cleanupAndReturn(scanner,false);
}
}
int read = scannerRead(scanner, counter);
char charAfter = (char)read;
scannerUnread(scanner, counter);
/* when not a whitespace and not end reached - do cleanup*/
if (! Character.isWhitespace(charAfter) && ICharacterScanner.EOF!=read){
/* the word is more than the exact one - e.g. instead of 'test' 'testx' ... so not correct*/
return counter.cleanupAndReturn(scanner,false);
}
return counter.cleanupAndReturn(scanner,true);
}
示例13: sequenceDetected
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) {
/* sequence is not the word found by word detector but the start sequence!!!!! (in this case always the exact word)*/
// -------------------------------------------------
// example: exactWord='test'
//
// subjects: atest,test,testa
// ^----------------only result!
Counter counter = new Counter();
if (trace){
// trace contains NOT first character, this is done at PatternRule
traceSb = new StringBuilder();
}
int column=scanner.getColumn();
boolean wordHasPrefix;
if (column==1){
wordHasPrefix=false;
}else{
scannerUnread(scanner, counter);
scannerUnread(scanner, counter);
char charBefore =(char)scannerRead(scanner, counter);
scannerRead(scanner, counter);
wordHasPrefix =fDetector.isWordPart(charBefore);
}
if (wordHasPrefix){
scannerRead(scanner, counter);
return counter.cleanupAndReturn(scanner,false);
}
for (int i= 1; i < sequence.length; i++) {
int c= scannerRead(scanner, counter);
if (c == ICharacterScanner.EOF){
if (eofAllowed) {
return counter.cleanupAndReturn(scanner,true);
}else{
return counter.cleanupAndReturn(scanner,false);
}
} else if (c != sequence[i]) {
scannerUnread(scanner, counter);
for (int j= i-1; j > 0; j--){
scannerUnread(scanner, counter);
}
return counter.cleanupAndReturn(scanner,false);
}
}
int read = scannerRead(scanner, counter);
char charAfter = (char)read;
scannerUnread(scanner, counter);
if (ICharacterScanner.EOF!=read && fDetector.isWordPart(charAfter)){
/* the word is more than the exact one - e.g. instead of 'test' 'testx' ... so not correct*/
return counter.cleanupAndReturn(scanner,false);
}
return counter.cleanupAndReturn(scanner,true);
}
示例14: evaluate
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
public IToken evaluate(ICharacterScanner scanner) {
// Should be connected only on the right side
scanner.unread();
boolean sawSpaceBefore = Character.isWhitespace(scanner.read());
if (!sawSpaceBefore && scanner.getColumn() != 0) {
return Token.UNDEFINED;
}
int c = scanner.read();
// Should be connected only on right side
if (c != fSequence[0] || !sequenceDetected(scanner, fSequence, false)) {
scanner.unread();
return Token.UNDEFINED;
}
int readCount = fSequence.length;
if (fDelimiters == null) {
fDelimiters = scanner.getLegalLineDelimiters();
}
// Start sequence detected
int delimiterFound = 0;
// Is it a list item marker, or just a floating *?
if (sawSpaceBefore) {
boolean after = Character.isWhitespace(scanner.read());
scanner.unread();
if (after) delimiterFound = 2;
}
while (delimiterFound < 2 && (c = scanner.read()) != ICharacterScanner.EOF) {
readCount++;
if (!sawSpaceBefore && c == fSequence[0] && sequenceDetected(scanner, fSequence, false)) {
return fToken;
}
int i;
for (i = 0; i < fDelimiters.length; i++) {
if (c == fDelimiters[i][0] && sequenceDetected(scanner, fDelimiters[i], true)) {
delimiterFound++;
break;
}
}
if (i == fDelimiters.length) delimiterFound = 0;
sawSpaceBefore = Character.isWhitespace(c);
}
// Reached ICharacterScanner.EOF
for (; readCount > 0; readCount--) {
scanner.unread();
}
return Token.UNDEFINED;
}
示例15: rewindToMark
import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
private void rewindToMark(ICharacterScanner scanner, int mark) {
for (int idx = scanner.getColumn(); idx > mark; idx--) {
scanner.unread();
}
}