From: Christopher Genovese <genovese@cmu.edu>
To: emacs-orgmode@gnu.org
Subject: new tag query parser [5/5] -- a (very) brief guide to the code
Date: Thu, 16 Aug 2012 00:04:40 -0400 [thread overview]
Message-ID: <CAPum5FjOjQFUFwLs7L7gJkGM51pYCee=F8cciaO-zh4d+p5jAA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1832 bytes --]
A few comments that might help navigate the new parser code in
org-tag-query-parse.el. All diffs are relative to the 7.8.11 org.el.
Let me know if you have any questions.
* High Level Changes
Two existing org functions are altered:
1. org-make-tags-matcher
2. org-scan-tags
The changes to the latter are minor, only defining two new
let-bindings to capture information already grabbed, and a slightly
modified regex. A unified diff between the new and old org-scan-tags
is given in the comments preceding the function in the new code.
* Low Level Entry Points
1. org-tag-query-parse -- the workhorse function
2. org-todo-query-parse -- handles /!? style todo components
Tag style and /!? todo style queries are handled in a unified way;
org-tag-query-parse delegates the latter to org-todo-query-parse but
manages the overall parsing. Note that /!? style matches must either
end the query string or end the current parenthesized expression. For
instance, "-(foo+bar/!{^T}-TODO)|LEVEL==5" is a valid query.
* Utilities
1. org-match-cond
2. org-read-balanced-string
3. org-read-quoted-string-in-query
4. org-tquery-error
5. org-defhash-at-compile
The first is a macro that lets the parser be expressed in very
readable terms. It does much of its work at compile-time, and produces
code that is optimized in several ways. This makes it beneficial to
byte-compile org-tag-query-parse.el.
The second and third parse delimited strings, the first with
balanced delimiters and doubling for escape, the second using
standard string semantics.
The fourth handles errors, giving useful information in messages.
The fifth is a macro that makes it pleasant to define literal
hash tables that will be defined at both compile and load time.
See examples of use in the code.
[-- Attachment #2: Type: text/html, Size: 6106 bytes --]
reply other threads:[~2012-08-16 4:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPum5FjOjQFUFwLs7L7gJkGM51pYCee=F8cciaO-zh4d+p5jAA@mail.gmail.com' \
--to=genovese@cmu.edu \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).