站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

LanguageEmbedding (Lexer) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.lexer/2 1.19.0 1

org.netbeans.spi.lexer
Class LanguageEmbedding<T extends TokenId>

java.lang.Object
  extended by org.netbeans.spi.lexer.LanguageEmbedding<T>

public final class LanguageEmbedding<T extends TokenId>
extends Object

Description of a particular language embedding including starting and ending skipped regions of a token containing this embedding and a definition of an embedded language hierarchy.


Method Summary
static
<T extends TokenId>
LanguageEmbedding<T>
create(Language<T> language, int startSkipLength, int endSkipLength)
          Create language embedding that does not join embedded sections.
static
<T extends TokenId>
LanguageEmbedding<T>
create(Language<T> language, int startSkipLength, int endSkipLength, boolean joinSections)
          Construct new language embedding for the given parameters or get an existing cached one.
 int endSkipLength()
          Get length of the ending part of the token (for which the embedding is being created) that should be skipped so it will be excluded from lexing and no tokens will be created for it.
 boolean joinSections()
          Whether sections with this embedding should be joined with the other sections with this embedding at the same level.
 Language<T> language()
          Get the embedded language.
 int startSkipLength()
          Get length of the initial part of the token (for which the embedding is being created) that should be skipped so it will be excluded from lexing and no tokens will be created for it.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static <T extends TokenId> LanguageEmbedding<T> create(Language<T> language,
                                                              int startSkipLength,
                                                              int endSkipLength)
Create language embedding that does not join embedded sections.

See Also:
create(Language, int, int, boolean)

create

public static <T extends TokenId> LanguageEmbedding<T> create(Language<T> language,
                                                              int startSkipLength,
                                                              int endSkipLength,
                                                              boolean joinSections)
Construct new language embedding for the given parameters or get an existing cached one.

Parameters:
language - non-null language.
startSkipLength - >=0 number of characters in an initial part of the token for which the language embedding is defined that should be excluded from the embedded section. The excluded characters will not be lexed and there will be no tokens created for them.
endSkipLength - >=0 number of characters at the end of the token for which the language embedding is defined that should be excluded from the embedded section. The excluded characters will not be lexed and there will be no tokens created for them.
joinSections - whether sections with this embedding should be joined across the input source or whether they should stay separate.
For example for HTML sections embedded in JSP this flag should be true:
   <!-- HTML comment start
       <% System.out.println("Hello"); %>
            still in HTML comment --<
  

Only the embedded sections with the same language path can be joined.

language

public Language<T> language()
Get the embedded language.

Returns:
non-null embedded language.

startSkipLength

public int startSkipLength()
Get length of the initial part of the token (for which the embedding is being created) that should be skipped so it will be excluded from lexing and no tokens will be created for it.

Returns:
>=0 number of characters in an initial part of the token (for which the language embedding is defined) that should be excluded from the embedded section. The excluded characters will not be lexed and there will be no tokens created for them.

endSkipLength

public int endSkipLength()
Get length of the ending part of the token (for which the embedding is being created) that should be skipped so it will be excluded from lexing and no tokens will be created for it.

Returns:
>=0 number of characters at the end of the token (for which the language embedding is defined) that should be excluded from the embedded section. The excluded characters will not be lexed and there will be no tokens created for them.

joinSections

public boolean joinSections()
Whether sections with this embedding should be joined with the other sections with this embedding at the same level.

Returns:
joinSections whether sections with this embedding should be joined across the input source or whether they should stay separate.

toString

public String toString()
Overrides:
toString in class Object

org.netbeans.modules.lexer/2 1.19.0 1

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.