當前位置: 首頁>>代碼示例>>Java>>正文


Java Syntax類代碼示例

本文整理匯總了Java中org.netbeans.editor.Syntax的典型用法代碼示例。如果您正苦於以下問題:Java Syntax類的具體用法?Java Syntax怎麽用?Java Syntax使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Syntax類屬於org.netbeans.editor包,在下文中一共展示了Syntax類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: load

import org.netbeans.editor.Syntax; //導入依賴的package包/類
/** Goes through all the syntaxes and inits them. If the multi-state-info has
* valid state-info for the given syntax the state-info is used.
* Otherwise the syntax is inited to the init state.
*/
void load(MultiSyntax masterSyntax, char[] buffer, int offset, int len,
          boolean lastBuffer, int stopPosition) {
    SyntaxInfo syntaxItem = masterSyntax.slaveSyntaxChain;
    while (syntaxItem != null) {
        StateInfo loadInfo = null;
        int masterOffsetDelta = 0;
        Syntax s = syntaxItem.syntax;
        if (syntaxItem.active) {
            Class sc = s.getClass();
            ChainItem item = stateInfoChain;
            while (item != null) {
                if (item.syntaxClass == sc && item.valid) {
                    loadInfo = item.stateInfo;
                    masterOffsetDelta = item.masterOffsetDelta;
                    break;
                }
                item = item.prev;
            }
        }
        s.load(loadInfo, buffer, offset + masterOffsetDelta,
               len - masterOffsetDelta, lastBuffer, stopPosition);
        syntaxItem = syntaxItem.next;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:MultiSyntax.java

示例2: compare

import org.netbeans.editor.Syntax; //導入依賴的package包/類
int compare(MultiSyntax masterSyntax) {
    int ret = Syntax.EQUAL_STATE;
    // Go through valid state-info chain items
    ChainItem item = stateInfoChain;
    while (item != null && ret == Syntax.EQUAL_STATE) {
        if (item.valid) {
            Class sc = item.syntaxClass;
            SyntaxInfo syntaxItem = masterSyntax.slaveSyntaxChain;
            while (syntaxItem != null) {
                if (syntaxItem.syntax.getClass() == sc) {
                    if (syntaxItem.active) {
                        ret = syntaxItem.syntax.compareState(item.stateInfo);
                    } else { // syntax not active but should be
                        ret = Syntax.DIFFERENT_STATE;
                    }
                    break;
                }
                syntaxItem = syntaxItem.next;
            }
        }
        item = item.prev;
    }
    return ret;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:MultiSyntax.java

示例3: doParse

import org.netbeans.editor.Syntax; //導入依賴的package包/類
private void doParse(String m, TokenID[] expected) {
    Syntax s = new PolicySyntax();
    s.load(null, m.toCharArray(), 0, m.length(), true, m.length());

    TokenID token = null;
    Iterator i = Arrays.asList(expected).iterator();
    do {
        token = s.nextToken();
        if (token != null) {
            if (!i.hasNext()) {
                fail("More tokens returned than expected.");
            } else {
                assertSame("Tokens differ", i.next(), token);
            }
        } else {
            assertFalse("More tokens expected than returned.", i.hasNext());
        }
        System.out.println(token);
    } while (token != null);
    System.out.println("---");
}
 
開發者ID:bernhardhuber,項目名稱:netbeansplugins,代碼行數:22,代碼來源:PolicySyntaxTest.java

示例4: doParse

import org.netbeans.editor.Syntax; //導入依賴的package包/類
public void doParse(String m, List expected) {
    Syntax s = new ManifestSyntax();
    s.load(null, m.toCharArray(), 0, m.length(), true, m.length());
    
    TokenID token = null;
    Iterator i = expected.iterator();
    do {
        token = s.nextToken();
        if (token != null) {
            if (!i.hasNext()) {
                fail("More tokens returned than expected.");
            } else {
                assertSame("Tokens differ", i.next(), token);
            }
        } else {
            assertFalse("More tokens expected than returned.", i.hasNext());
        }
        System.out.println(token);
    } while (token != null);
}
 
開發者ID:bernhardhuber,項目名稱:netbeansplugins,代碼行數:21,代碼來源:ManifestSyntaxTest.java

示例5: doParse

import org.netbeans.editor.Syntax; //導入依賴的package包/類
private void doParse(String m, TokenID[] expected) {
    Syntax s = new ManifestSyntax();
    s.load(null, m.toCharArray(), 0, m.length(), true, m.length());

    TokenID token = null;
    Iterator i = Arrays.asList(expected).iterator();
    do {
        token = s.nextToken();
        if (token != null) {
            if (!i.hasNext()) {
                fail("More tokens returned than expected.");
            } else {
                assertSame("Tokens differ", i.next(), token);
            }
        } else {
            assertFalse("More tokens expected than returned.", i.hasNext());
        }
        System.out.println(token);
    } while (token != null);
}
 
開發者ID:bernhardhuber,項目名稱:netbeansplugins,代碼行數:21,代碼來源:ManifestSyntaxTest.java

示例6: registerSyntax

import org.netbeans.editor.Syntax; //導入依賴的package包/類
/** Register a particular slave syntax. */
protected void registerSyntax(Syntax slaveSyntax) {
    slaveSyntaxChainEnd = new SyntaxInfo(slaveSyntax, slaveSyntaxChainEnd);
    if (slaveSyntaxChain == null) {
        slaveSyntaxChain = slaveSyntaxChainEnd;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:MultiSyntax.java

示例7: store

import org.netbeans.editor.Syntax; //導入依賴的package包/類
void store(MultiSyntax masterSyntax) {
    // Invalidate all state-info chain items
    ChainItem item = stateInfoChain;
    while (item != null) {
        item.valid = false;
        item = item.prev;
    }

    // Go through active syntaxes and store their info and master-offset
    SyntaxInfo syntaxItem = masterSyntax.slaveSyntaxChain;
    while (syntaxItem != null) {
        if (syntaxItem.active) {
            Syntax s = syntaxItem.syntax;
            Class sc = s.getClass();
            item = stateInfoChain;
            while (item != null) {
                if (item.syntaxClass == sc) { // found right item
                    break;
                }
                item = item.prev;
            }
            if (item == null) { // not found, add new
                item = stateInfoChain = new ChainItem(s.createStateInfo(),
                                                      sc, stateInfoChain);
            }
            // Store the state and compute masterOffsetDelta
            s.storeState(item.stateInfo);
            item.masterOffsetDelta = s.getOffset() - masterSyntax.getOffset();
            item.valid = true;
        }
        syntaxItem = syntaxItem.next;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:34,代碼來源:MultiSyntax.java

示例8: SyntaxInfo

import org.netbeans.editor.Syntax; //導入依賴的package包/類
SyntaxInfo(Syntax syntax, SyntaxInfo prevChainEnd) {
    this.syntax = syntax;

    if (prevChainEnd != null) {
        prev = prevChainEnd;
        prevChainEnd.next = this;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:MultiSyntax.java

示例9: compareSubStates

import org.netbeans.editor.Syntax; //導入依賴的package包/類
/** @return whether passed substates equals to this substates. */
public int compareSubStates(int[] sub) {
    if (states == null) return Syntax.DIFFERENT_STATE;
    if (sub == null) return Syntax.DIFFERENT_STATE;
    if (states.length != sub.length) return Syntax.DIFFERENT_STATE;
    
    for (int i = states.length-1; i>=0; i--) {  //faster
        if (states[i] != sub[i]) return Syntax.DIFFERENT_STATE;
    }
    return Syntax.EQUAL_STATE;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:JJStateInfo.java

示例10: createSyntax

import org.netbeans.editor.Syntax; //導入依賴的package包/類
@Override
public Syntax createSyntax(Document doc) {
    Syntax syn = null;
    LegacySyntaxBridge bridge = MimeLookup.getLookup(getContentType()).lookup(LegacySyntaxBridge.class);
    if (bridge != null) {
        syn = bridge.createSyntax(this, doc, getContentType());
    }
    return syn != null ? syn : super.createSyntax(doc);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:UniKit.java

示例11: createSyntax

import org.netbeans.editor.Syntax; //導入依賴的package包/類
/**
 * Create a syntax object suitable for highlighting Policy file syntax
 */
public Syntax createSyntax(Document doc) {
    if (LOG) {
        LOGGER.log(ErrorManager.INFORMATIONAL, "createSyntax"); // NOI18N
    }
    return new PolicySyntax();
}
 
開發者ID:bernhardhuber,項目名稱:netbeansplugins,代碼行數:10,代碼來源:PolicyEditorKit.java

示例12: createSyntax

import org.netbeans.editor.Syntax; //導入依賴的package包/類
/**
 * Create a syntax object suitable for highlighting Manifest file syntax
 */
public Syntax createSyntax(Document doc) {
    if (LOG) {
        LOGGER.log(ErrorManager.INFORMATIONAL, "createSyntax"); // NOI18N
    }
    return new ManifestSyntax();
}
 
開發者ID:bernhardhuber,項目名稱:netbeansplugins,代碼行數:10,代碼來源:ManifestEditorKit.java

示例13: toString

import org.netbeans.editor.Syntax; //導入依賴的package包/類
public String toString(Syntax syntax) {
    return super.toString(syntax) 
        + ", subState=" + syntax.getStateName(getSubState())            // NOI18N
        + ", inDTD=" + subState;                                        // NOI18N
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:XMLDefaultSyntax.java

示例14: acceptSyntax

import org.netbeans.editor.Syntax; //導入依賴的package包/類
protected boolean acceptSyntax(Syntax syntax) {
    return (syntax instanceof JJEditorSyntax);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:XMLFormatter.java

示例15: createSyntax

import org.netbeans.editor.Syntax; //導入依賴的package包/類
/** Create new instance of syntax coloring parser */
@Override
public Syntax createSyntax(Document doc) {
    return new PropertiesSyntax();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:PropertiesKit.java


注:本文中的org.netbeans.editor.Syntax類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。