[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/forth-mode c5e63e29f1 072/153: Basic indentation of contro
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/forth-mode c5e63e29f1 072/153: Basic indentation of control structures |
Date: |
Sat, 29 Jan 2022 08:02:18 -0500 (EST) |
branch: elpa/forth-mode
commit c5e63e29f18cc642d263c9c41cbb85969e221f40
Author: Helmut Eller <eller.helmut@gmail.com>
Commit: Lars Brinkhoff <lars@nocrew.org>
Basic indentation of control structures
---
forth-mode.el | 2 ++
forth-smie.el | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/forth-mode.el b/forth-mode.el
index 190ea925fd..abd8ace805 100644
--- a/forth-mode.el
+++ b/forth-mode.el
@@ -12,6 +12,7 @@
;;; Code:
(require 'cl)
+(require 'forth-smie)
(defvar forth-mode-map
(let ((map (make-sparse-keymap)))
@@ -142,6 +143,7 @@
(setq-local completion-at-point-functions '(forth-expand-symbol))
(setq-local syntax-propertize-function #'forth--syntax-propertize)
(setq-local parse-sexp-lookup-properties t)
+ (forth-smie-setup)
(setq ;; font-lock-defaults
comment-start-skip "\\((\\*?\\|\\\\\\) *"
comment-start "("
diff --git a/forth-smie.el b/forth-smie.el
new file mode 100644
index 0000000000..20bf06cad8
--- /dev/null
+++ b/forth-smie.el
@@ -0,0 +1,34 @@
+;; SMIE based indentation
+
+(require 'smie)
+
+(defvar forth-smie--grammar
+ (smie-prec2->grammar
+ (smie-bnf->prec2
+ '((control
+ ("if" words "else" words "then")
+ ("if" words "then")
+ ("begin" words "while" words "repeat")
+ ("begin" words "until")
+ ("begin" words "again")
+ ("of" words "endof")
+ ("case" words "endcase")
+ ("?do" words "loop")
+ ("do" words "loop")
+ ("do" words "+loop")
+ ("begin-structure" words "end-structure")
+ ("{:" words ":}"))
+ (words)))))
+
+(defvar forth-smie--basic-indent 2)
+
+(defun forth-smie--indentation-rules (kind token)
+ (pcase (cons kind token)
+ (`(:elem . basic) forth-smie--basic-indent)
+ (`(:elem . args) 0)
+ (`(:list-intro . ,_) forth-smie--basic-indent)))
+
+(defun forth-smie-setup ()
+ (smie-setup forth-smie--grammar #'forth-smie--indentation-rules))
+
+(provide 'forth-smie)
- [nongnu] elpa/forth-mode 5502816e37 134/153: Make it easier to emulate Open Firmware indentation style, (continued)
- [nongnu] elpa/forth-mode 5502816e37 134/153: Make it easier to emulate Open Firmware indentation style, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 5076a08abc 057/153: Make C-c C-k work in all Forth modes., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 7cbb60f1d7 143/153: Highlight +field and friends, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 5c1c928490 132/153: Make completion case insensitive, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 37da497572 144/153: Switch back from interaction mode to source buffer., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 05e8a02796 139/153: Highlight LEAVE, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 1f922f41f4 138/153: Declare forth-smie-basic-indent as safe local-variable., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 74c0e17c45 122/153: Improve beginning-of-defun, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode b40ffb3127 078/153: Fix building with Emacs 23., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 1d85344467 113/153: Add commands to browse description in Forth standards, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode c5e63e29f1 072/153: Basic indentation of control structures,
ELPA Syncer <=
- [nongnu] elpa/forth-mode 0d22cedbaf 133/153: Improve indentation of BEGIN-STRUCTURE/END-STRUCTURE, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 47f33ea62a 063/153: Move interaction functions to forth-interactive-mode., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 6fac263222 068/153: Automatic build with Wercker., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 9cf3d777ec 064/153: Fix for C-c C-s forth-see., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode d90c4a46e0 118/153: Use funny characters (→, ¹ and ²) to mark positions in test strings., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode c99ed046df 074/153: Remove debug message., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 64209f501c 108/153: Merge pull request #35 from ellerh/forward-sexp-tests, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode e6ee5ddf99 069/153: Handle ( ...) comments with syntax-propertize-function, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode e966275c2e 100/153: Add tests for indentation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode dc3f7fabed 131/153: Use -y with apt-get., ELPA Syncer, 2022/01/29