松尾です。

内部表現をS式に変更したtimeline specを実装してみました。

http://github.com/cvmat/twittering-mode/tree/new-timeline-spec

にcommitしてあります。S式の意味ははやみずさんご提案のままです。
retweet関係とmentions, homeを追加してます。

queryのエスケープをどうすべきかが判断できなかったのでsearchは
未実装です。direct-messages, direct-messages-sent, merge,
filterは内部表現としては実装済みですがtimelineの表示には対応
していません。
(direct-message関係はXMLタグが他のtimelineと違うので…)

ユーザ側の入力としては
"USER", "USER/LISTNAME", ":public", ":filter/\\(@hoge\\|@fuga\\)/:home",
"(USER+:replies+OTHER/LISTNAME+:filter/WORD/(hoge+fuga))"
等の書き方を許すようになっています。
`twittering-timeline-spec-to-string'でspecから文字列表現へ、
`twittering-string-to-timeline-spec'で文字列表現からspecへの
変換を行います。

Timeline spec as S-expression
- (user USER): timeline of the user whose name is USER. USER is a string.
- (list USER LIST):
    the list LIST of the user USER. LIST and USER are strings.
- (direct-messages): received direct messages.
- (direct-messages-sent): sent direct messages.
- (friends): friends timeline.
- (home): home timeline.
- (mentions): mentions timeline.
    mentions (status containing @username) for the authenticating user.
- (public): public timeline.
- (replies): replies.
- (retweeted_by_me): retweets posted by the authenticating user.
- (retweeted_to_me): retweets posted by the authenticating user's friends.
- (retweets_of_me):
    tweets of the authenticated user that have been retweeted by others.
- (search STRING): the result of searching with query STRING.
- (merge SPEC1 SPEC2 ...): result of merging timelines SPEC1 SPEC2 ...
- (filter REGEXP SPEC): timeline filtered with REGEXP.

文字列表現のルールは以下の通りです。

Timeline spec string
SPEC ::= PRIMARY | COMPOSITE
PRIMARY ::= USER | LIST | DIRECT-MESSSAGES | DIRECT-MESSSAGES-SENT
            | FRIENDS | HOME | MENTIONS | PUBLIC | REPLIES
            | RETWEETED_BY_ME | RETWEETED_TO_ME | RETWEETS_OF_ME
COMPOSITE ::= MERGE | FILTER
USER ::= /[a-zA-Z0-9_-]+/
LIST ::= USER "/" LISTNAME
LISTNAME ::= /[a-zA-Z0-9_-]+/
DIRECT-MESSSAGES ::= ":direct-messages"
DIRECT-MESSSAGES-SENT ::= ":direct-messages-sent"
FRIENDS ::= ":friends"
HOME ::= ":home" | "~"
MENTIONS ::= ":mentions"
PUBLIC ::= ":public"
REPLIES ::= ":replies" | "@"
RETWEETED_BY_ME ::= ":retweeted_by_me"
RETWEETED_TO_ME ::= ":retweeted_to_me"
RETWEETS_OF_ME ::= ":retweets_of_me"
MERGE ::= "(" MERGED_SPECS ")"
MERGED_SPECS ::= SPEC | SPEC "+" MERGED_SPECS
FILTER ::= ":filter/" REGEXP "/" SPEC

文字列表現時にfilterに与える正規表現内にslash "/"が現れるときは
backslash "\"でエスケープする必要があります。

例えば
":filter/ABC/user/mylist" <==> (filter "ABC" (list "user" "mylist"))
":filter/ABC\\/user/mylist" <==> (filter "ABC/user" (user "mylist"))
となります。

どうでしょうか。

---
松尾 直志 <t...@mymail.twin.jp>

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
twmode-users mailing list
twmode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/twmode-users

メールによる返信