Workflowy selector parser

A parser for a DSL used to select specific items in a Workflowy hierarchy.

As of 12. 08. 2016. See the latest version.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/22247/141330/Workflowy%20selector%20parser.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Autor
fiatjaf
Verzija
0.0.1.20160812143603
Napravljeno
12. 08. 2016
Ažurirano
12. 08. 2016
Size
16,8 КБ
Licenca
Nije dostupno

Intended to be required by Workflowy userscripts.

pegjs source:

expr
  = s:selector _ ch:(connector? _ selector _)* {
    return [[null, s]].concat(ch.map(s => [s[0], s[2]]))
  }

selector
  = id:('#' [a-z0-9-]i+) { return {type: 'id', val: id[1].join('')} }
  / re:('/' [^/]+ '/') { return {type: 'regex', val: re[1].join('')} }
  / name:("'" [^']i+ "'") { return {type: 'name', val: name[1].join('')} }
  / any:'*' { return {type: 'any'} }

connector
  = '>' { return 'directchild' }

_ = ' '*