public abstract class Parser extends Object
ParserFactory
for some concrete
Snapshot
or collection of Snapshot
s.
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.Modifier and Type | Class and Description |
---|---|
static class |
Parser.CancelReason
|
static class |
Parser.Result
Represents result of parsing created for one specific
Task . |
Constructor and Description |
---|
Parser() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addChangeListener(ChangeListener changeListener)
Registers new listener.
|
void |
cancel()
|
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)
|
abstract void |
removeChangeListener(ChangeListener changeListener)
Unregisters listener.
|
public abstract void parse(Snapshot snapshot, Task task, SourceModificationEvent event) throws ParseException
snapshot
- A snapshot that should be parsed.task
- A task asking for parsing result.event
- A scheduler event.ParseException
public abstract Parser.Result getResult(Task task) throws ParseException
UserTask
, or
SchedulerTask
instance, that requests Parser.Result
.task
- A task asking for parsing result.ParseException
@Deprecated public void cancel()
Parser.cancel(CancelReason, org.netbeans.modules.parsing.spi.SourceModificationEvent)
public void cancel(@NonNull Parser.CancelReason reason, @NullAllowed SourceModificationEvent event)
reason
- of the cancel, see Parser.CancelReason
event
- an additional info if the reason is SOURCE_MODIFICATION_EVENT, otherwise nullpublic abstract void addChangeListener(ChangeListener changeListener)
changeListener
- A change listener to be registered.public abstract void removeChangeListener(ChangeListener changeListener)
changeListener
- A change listener to be unregistered.