| 
org.netbeans.modules.lexer/2 1.19.0 1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.netbeans.api.lexer.InputAttributes
public final class InputAttributes
Supplementary information about particular input
 that may be used to influence the lexer's operation.
 
 For example there may be a version of the language
 to be used when lexing the input. The following code
 will interpret the "assert" as an identifier:
 
  InputAttributes attrs = new InputAttributes();
  attrs.setValue(JavaTokenId.language(), "version", "1.3", true);
  TokenHierarchy.create("assert", false, JavaTokenId.language(), null, attrs);
 
 
 The properties are attached to a concrete language path only
 or they may be applied globally to all of the occurrences
 of the given path as a sub-path of the target path.
 
 See the "global" argument of
 setValue(Language,Object,Object,boolean).
 
This class may safely be operated by multiple threads.
| Constructor Summary | |
|---|---|
InputAttributes()
 | 
|
| Method Summary | |
|---|---|
 Object | 
getValue(LanguagePath languagePath,
         Object attributeKey)
Get value for the given key for the particular language path.  | 
 void | 
setValue(Language<? extends TokenId> language,
         Object attributeKey,
         Object attributeValue,
         boolean global)
Assign a new value to a property for the language path constructed from the given language.  | 
 void | 
setValue(LanguagePath languagePath,
         Object attributeKey,
         Object attributeValue,
         boolean global)
Assign a new value to a property for the given language path.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public InputAttributes()
| Method Detail | 
|---|
public Object getValue(LanguagePath languagePath, Object attributeKey)
languagePath - non-null language path.attributeKey - non-null key of the attribute.
public void setValue(Language<? extends TokenId> language, Object attributeKey, Object attributeValue, boolean global)
public void setValue(LanguagePath languagePath, Object attributeKey, Object attributeValue, boolean global)
languagePath - non-null language path.attributeKey - non-null key of the attribute.attributeValue - value of the key for the given language path.global - if set to true then the value will be used not only for the given
  language path but also as a default value (if the value is not overwritten explicitly)
  for all the cases where the given path is embedded into the target language path.
  
  attrs.setValue(LanguagePath.get(JavaTokenId.language()),
      "version", Integer.valueOf(5), true);
  
  sets the version 5 (it means java 1.5) to all the java code snipets
  regardless of where they are embedded in the token hierarchy.
  | 
org.netbeans.modules.lexer/2 1.19.0 1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||