1#ifndef TEXTMATELIB_RAW_GRAMMAR_H
2#define TEXTMATELIB_RAW_GRAMMAR_H
18 ILocation() : line(0), charPos(0) {}
19 ILocation(
const std::string& fname,
int l,
int c)
20 : filename(fname), line(l), charPos(c) {}
25 ILocation* tmlLocation;
27 ILocatable() : tmlLocation(nullptr) {}
39struct IRawCapturesMap {
40 std::map<std::string, IRawRule*> captures;
46struct IRawCaptures :
public IRawCapturesMap,
public ILocatable {
51struct IRawRule :
public ILocatable {
60 IRawCaptures* captures;
63 IRawCaptures* beginCaptures;
66 IRawCaptures* endCaptures;
69 IRawCaptures* whileCaptures;
71 std::vector<IRawRule*>* patterns;
73 IRawRepository* repository;
75 bool* applyEndPatternLast;
78 : id(nullptr), include(nullptr), name(nullptr), contentName(nullptr),
79 match(nullptr), captures(nullptr), begin(nullptr), beginCaptures(nullptr),
80 end(nullptr), endCaptures(nullptr), whilePattern(nullptr), whileCaptures(nullptr),
81 patterns(nullptr), repository(nullptr), applyEndPatternLast(nullptr) {}
87struct IRawRepositoryMap {
88 std::map<std::string, IRawRule*> rules;
92 IRawRepositoryMap() : selfRule(nullptr), baseRule(nullptr) {}
96 IRawRule* getRule(
const std::string& name)
const;
99struct IRawRepository :
public IRawRepositoryMap,
public ILocatable {
104struct IRawGrammar :
public IRawRule {
107 std::map<std::string, IRawRule*>* injections;
108 std::string* injectionSelector;
110 std::vector<std::string>* fileTypes;
112 std::string* firstLineMatch;
115 : IRawRule(), injections(nullptr), injectionSelector(nullptr),
116 fileTypes(nullptr), firstLineMatch(nullptr) {
124void deleteIfNotNull(T*& ptr) {
125 if (ptr !=
nullptr) {
std::string RegExpString
Regular expression pattern as a string.
std::string ScopeName
Semantic name identifying a scope (e.g., "source.javascript", "comment.line")
std::string IncludeString
String referencing another grammar to include (scope name or file path)
Core type definitions and interfaces for TextMateLib.