edbee - Qt Editor Library
Public Member Functions | List of all members
edbee::TextScopeSelector Class Reference

Our first version of scope-selector only support a list of scopes Thus the Descendant (space) selector only. More...

#include <textdocumentscopes.h>

+ Collaboration diagram for edbee::TextScopeSelector:

Public Member Functions

 TextScopeSelector (const QString &selector)
 The textscope selector. More...
 
virtual ~TextScopeSelector ()
 The destructor. More...
 
double calculateMatchScore (const TextScopeList *scopeList)
 This method calculates the matching score of the scope with this selector Currently the scope-calculation is very 'basic'. Just enough to perform the most basic form of matching. More...
 
QString toString ()
 Converts the scope to a string. More...
 

Detailed Description

Our first version of scope-selector only support a list of scopes Thus the Descendant (space) selector only.

Todo:
: Implement full scope selectors see text below

Full Scope selectors: (FUTURE)

, = grouping (multiple seperate selectors) (space) = descendent (supported)

Extra From the textmate author: http://blog.macromates.com/2005/introduction-to-scopes/ discuession on: http://textmate.1073791.n5.nabble.com/formal-definition-of-scope-selector-syntax-td12109.html

Update: Starting with 1.1b17 it's also possible to AND, OR, and subtract scope selectors,

e.g.: (a | b) & c - d

would select the scope which is not matched by d, and matched by both c, and a or b.

OFFICIAL BNF: atom: «string» | '*' scope: «atom» ('.' «atom»)* path: '^'? «scope» ('>'? «scope»)* '$'? group: '(' «selector» ')' filter: ("L:"|"R:"|"B:") («group» | «path») expression: '-'? («filter» | «group» | «path») composite: «expression» ([|&-] «expression»)* selector: «composite» (',' «composite»)*

Constructor & Destructor Documentation

◆ TextScopeSelector()

edbee::TextScopeSelector::TextScopeSelector ( const QString &  selector)

The textscope selector.

Parameters
selectorthe selector to select a scope

◆ ~TextScopeSelector()

edbee::TextScopeSelector::~TextScopeSelector ( )
virtual

The destructor.

Member Function Documentation

◆ calculateMatchScore()

double edbee::TextScopeSelector::calculateMatchScore ( const TextScopeList scopeList)

This method calculates the matching score of the scope with this selector Currently the scope-calculation is very 'basic'. Just enough to perform the most basic form of matching.

The algorithm returns 1.0 on a full match...

Parameters
scopeListthe list of scopes
Returns
the matching score. -1 means no match found. >= 0 a match has been found

◆ toString()

QString edbee::TextScopeSelector::toString ( )

Converts the scope to a string.


The documentation for this class was generated from the following files: