org.netbeans.modules.parsing.api/1 1.55.0 6

org.netbeans.modules.parsing.spi
Class Parser

java.lang.Object
  extended by org.netbeans.modules.parsing.spi.Parser

public abstract class Parser
extends Object

Represents implementation of parser for one language. Parser is always created by ParserFactory for some concrete Snapshot or collection of Snapshots. Parser fires change when some conditions are changed and sources should be reparsed. One instance of Parser can be reused for more Snapshots created from one Source.


Nested Class Summary
static class Parser.CancelReason
          The Parser.CancelReason is passed to cancel(org.netbeans.modules.parsing.spi.Parser.CancelReason, org.netbeans.modules.parsing.spi.SourceModificationEvent) as a hint.
static class Parser.Result
          Represents result of parsing created for one specific Task.
 
Constructor Summary
Parser()
           
 
Method Summary
abstract  void addChangeListener(ChangeListener changeListener)
          Registers new listener.
 void cancel()
          Deprecated. use cancel(CancelReason, org.netbeans.modules.parsing.spi.SourceModificationEvent)
 void cancel(Parser.CancelReason reason, SourceModificationEvent event)
          Called by the infrastructure to stop the parser operation.
abstract  Parser.Result getResult(Task task)
          Called when some task needs some result of parsing.
abstract  void parse(Snapshot snapshot, Task task, SourceModificationEvent event)
          Called by infrastructure when Source is changed, and a new Snapshot has been created for it.
abstract  void removeChangeListener(ChangeListener changeListener)
          Unregisters listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser()
Method Detail

parse

public abstract void parse(Snapshot snapshot,
                           Task task,
                           SourceModificationEvent event)
                    throws ParseException
Called by infrastructure when Source is changed, and a new Snapshot has been created for it.

Parameters:
snapshot - A snapshot that should be parsed.
task - A task asking for parsing result.
event - A scheduler event.
Throws:
ParseException

getResult

public abstract Parser.Result getResult(Task task)
                                 throws ParseException
Called when some task needs some result of parsing. Task parameter contains UserTask, or SchedulerTask instance, that requests Parser.Result.

Parameters:
task - A task asking for parsing result.
Returns:
Result of parsing or null.
Throws:
ParseException

cancel

@Deprecated
public void cancel()
Deprecated. use cancel(CancelReason, org.netbeans.modules.parsing.spi.SourceModificationEvent)

Called by the infrastructure to stop the parser operation.


cancel

public void cancel(@NonNull
                   Parser.CancelReason reason,
                   @NullAllowed
                   SourceModificationEvent event)
Called by the infrastructure to stop the parser operation.

Parameters:
reason - of the cancel, see Parser#CancelReason
event - an additional info if the reason is SOURCE_MODIFICATION_EVENT, otherwise null
Since:

addChangeListener

public abstract void addChangeListener(ChangeListener changeListener)
Registers new listener.

Parameters:
changeListener - A change listener to be registered.

removeChangeListener

public abstract void removeChangeListener(ChangeListener changeListener)
Unregisters listener.

Parameters:
changeListener - A change listener to be unregistered.

org.netbeans.modules.parsing.api/1 1.55.0 6

Built on May 24 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.