From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Shorter and more flexible implementation for parse-time.el Date: Sun, 25 Jul 2021 08:34:51 +0200 Message-ID: <87lf5uzyt0.fsf@gnus.org> References: <87mtqb3o7q.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10245"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: "Guu, Jin-Cheng" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jul 25 08:35:42 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m7Xji-0002Tk-9E for ged-emacs-devel@m.gmane-mx.org; Sun, 25 Jul 2021 08:35:42 +0200 Original-Received: from localhost ([::1]:49458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7Xjg-0005kP-Md for ged-emacs-devel@m.gmane-mx.org; Sun, 25 Jul 2021 02:35:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7Xj1-000545-6Z for emacs-devel@gnu.org; Sun, 25 Jul 2021 02:34:59 -0400 Original-Received: from quimby.gnus.org ([2a01:4f9:2b:f0f::2]:59232) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7Xiz-0006DV-KU for emacs-devel@gnu.org; Sun, 25 Jul 2021 02:34:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=LvhuKBAqvHgPUfcFiQyknDc33+EmLy5LKYOhdaOwkSo=; b=ty4LqcoQgZChuOV4zODWOIduaG U3P7ENy/O+fI+RkO+MrR0VdeHv6Ne6gK0gtSY1XzFdldlJ6YKDF1Gb1h1A4Kilsw7rIWrjja777nt YGBJ/qILwbqZtePrYba2pHvUlipAGp9DdZKFCDT1G+tnTSAL0JatFsibKXG8Oad8dwxw=; Original-Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m7Xit-00068D-Ma; Sun, 25 Jul 2021 08:34:54 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEWpYhtZLB7pohnu 0aH///80edrZAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+UHGQYaHcLKDiQAAAGVSURBVDjLVVOBkcMw CAN+AfwT8M4Gzf67vQQ2tX29pkWRABlE6ujAEZk8eIjKqCNis04gHgB4EJ+z4/mtQAMydsT5OxmU tx3GD+MT2jEaqDwqBhExda3csfIjCBUK4eOdhMDAu6hI9awKefl/rD4kmmIqTu0CXL6cBEYSL6mp JkvKbwAyXl6xhiu5/CagN8PwWjKUzZwmoiCfDkDY4bwQj18qjsPdQozeKqo642Vmmu4ScgEBH7Jc i5uCu0hLPC/nRhLA9ZJ/SMEvISEmtNTim4N+7ZLwTisRkMzEptL5FC2AHg7ebwGBEIZhVlnrezti 4cHb0hW3LlUScBrs3tOb9iaD+kOOsY5hkSKunFXfhiHYgJ/e0/fY+1GWNdIAOZ0jb36Pj+49Y+u5 IQkIut8eRt1O7pmWI6tBkJ7P3DnYUiE27ZkHIH/LEyi9JNJbmMKWZHb6txiSyyY7O4Sedw31SIZJ ZSclh4EgWvUCsKbTXuEgYnH9u+3ZxlszSrT3CsCDHD+i69ZHlcu7TUaNg/aCcint+fwD5Chalzzb s+IAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMDctMjVUMDY6MjY6MjkrMDA6MDDdxZBdAAAAJXRF WHRkYXRlOm1vZGlmeQAyMDIxLTA3LTI1VDA2OjI2OjI5KzAwOjAwrJgo4QAAAABJRU5ErkJggg== X-Now-Playing: Prince's _Sign 'O' the Times (2)_: "The Cross" In-Reply-To: (Jin-Cheng Guu's message of "Sat, 24 Jul 2021 10:03:40 -0500") Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:271583 Archived-At: "Guu, Jin-Cheng" writes: > Thanks for your response! I've done some research, and the formats I > have seen all have their rigid formats (with a fixed length in > particular) [1][2][3]. Would you mind pointing me to some exceptions? > I can try to accommodate. There's a million formats out there, like "3-NOV-94" etc in various permutations. > That said, I'd argue it is still useful. It is much shorter, is > flexible and customizable, and uses lisp sexprs instead of a > DSL. Please feel free to let me know what it lacks of, I will try to > work on it and present a final result. =) My experience is that there is no DSL that can cover date parsing that's handier than just writing some code, unfortunately. Your library covers the (encode-time (mapcar (lambda (bit) (if bit (string-to-number bit) 0)) (list nil nil nil (substring string 0 2) (substring string 2 4) (substring string 4 8)))) etc case, and that's not where the hard thing in date parsing is. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no