Workflowy selector parser

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

بۇ قوليازمىنى بىۋاسىتە قاچىلاشقا بولمايدۇ. بۇ باشقا قوليازمىلارنىڭ ئىشلىتىشى ئۈچۈن تەمىنلەنگەن ئامبار بولۇپ، ئىشلىتىش ئۈچۈن مېتا كۆرسەتمىسىگە قىستۇرىدىغان كود: // @require https://update.greasyfork.org/scripts/22247/141751/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!)

ئاپتورى
fiatjaf
نەشرى
0.0.1.20160814232256
قۇرۇلغان ۋاقتى
2016-08-12
يېڭىلانغان ۋاقتى
2016-08-14
Size
16.8 KB
ئىجازەتنامىسى
يوق

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: new RegExp(re[1].join(''))} }
  / name:("'" [^']i+ "'") { return {type: 'name', val: name[1].join('')} }
  / any:'*' { return {type: 'any'} }

connector
  = '>' { return 'directchild' }

_ = ' '*