Expand description
Everything about parsing text into text annotated with scopes.
The most important struct here is SyntaxSet
, check out the docs for that.
Re-exports
pub use self::syntax_definition::SyntaxDefinition;
Modules
This module contains data structures for representing syntax definitions.
Everything is public because I want this library to be useful in super
integrated cases like text editors and I have no idea what kind of monkeying
you might want to do with the data. Perhaps parsing your own syntax format
into this data structure?
Structs
Wrapper to get around the fact Rust f64 doesn’t implement Ord
and there is no non-NaN float type
Keeps the current parser state (the internal syntax interpreter stack) between lines of parsing.
If you are parsing an entire file you create one of these at the start and use it
all the way to the end.
The global scope repo, exposed in case you want to minimize locking and unlocking.
Shouldn’t be necessary for you to use. See the
ScopeRepository
docs.A hierarchy of atoms with semi-standardized names
used to accord semantic information to a specific piece of text.
Generally written with the atoms separated by dots.
By convention atoms are all lowercase alphanumeric.
The structure used to keep track of the mapping between scope atom numbers
and their string names. It is only exposed in case you want to lock
SCOPE_REPO
and then allocate a whole bunch of scopes at once
without thrashing the lock. It is recommended you just use Scope::new()
A stack/sequence of scopes. This is used both to represent hierarchies for a given
token of text, as well as in
ScopeSelectors
. Press ctrl+shift+p
in Sublime Text
to see the scope stack at a given point.
Also see the TextMate docs.A syntax set holds multiple syntaxes that have been linked together.
A syntax set builder is used for loading syntax definitions from the file
system or by adding
SyntaxDefinition
objects.Enums
Used for
ScopeStack::apply_with_hook
Not all strings are valid scopes
A change to a scope stack. Generally
Noop
is only used internally and you don’t have
to worry about ever getting one back from a public function.
Use ScopeStack#apply
to apply this change.Constants
Multiplier on the power of 2 for MatchPower.
Only useful if you compute your own MatchPower scores.