Module syntect::parsing [] [src]

Everything about parsing text into text annotated with scopes. The most important struct here is SyntaxSet, check out the docs for that.

Reexports

pub use self::syntax_definition::SyntaxDefinition;

Modules

syntax_definition

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

MatchPower

Wrapper to get around the fact Rust f64 doesn't implement Ord and there is no non-NaN float type

ParseState

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.

SCOPE_REPO

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.

Scope

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.

ScopeRepository

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()

ScopeStack

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.

SyntaxSet

A syntax set holds a bunch of syntaxes and manages loading them and the crucial operation of linking.

Enums

BasicScopeStackOp

Used for ScopeStack::apply_with_hook

ClearAmount
ParseScopeError

Not all strings are valid scopes

ParseSyntaxError
ScopeStackOp

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

ATOM_LEN_BITS

Multiplier on the power of 2 for MatchPower. Only useful if you compute your own MatchPower scores.