-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
102 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
;;; leg-mode.el -- minor mode for editing leg parsers | ||
;;; | ||
;;; THIS SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK. | ||
;;; | ||
;;; Last edited: 2016-07-26 14:14:47 by piumarta on nas.local | ||
|
||
(defvar-local leg-mode-active? nil) | ||
(defvar-local leg-mode-timer nil) | ||
(defvar-local leg-mode-check? nil) | ||
|
||
(defun leg-mode-changed () | ||
(when leg-mode-timer (cancel-timer leg-mode-timer)) | ||
(setq leg-mode-timer (run-with-idle-timer 0.2 t 'leg-mode-check)) | ||
(add-hook 'post-command-hook 'leg-mode-enable-check nil t)) | ||
|
||
(defun leg-mode-enable-check () | ||
(setq leg-mode-check? t)) | ||
|
||
(defun leg-mode-check () | ||
(when (and leg-mode-check? (not (region-active-p))) | ||
(setq leg-mode-check? nil) | ||
(let (( active (save-excursion (setq active (or (search-backward "%}" nil t) -1)))) | ||
(inactive (save-excursion (setq inactive (or (search-backward "%%" nil t) -1)))) | ||
(active? (> active inactive))) | ||
(unless (eq active? leg-mode-active?) | ||
(funcall (if active? 'fundamental-mode 'c-mode)) | ||
(leg-mode-changed) | ||
(and font-lock-mode (not active?) (font-lock-fontify-buffer)) | ||
(setq leg-mode-active? active?))))) | ||
|
||
(defun leg-mode () | ||
"Minor mode for editing leg parsers." | ||
(interactive) | ||
(funcall 'c-mode) | ||
(unless (assq 'leg-mode-timer minor-mode-alist) | ||
(setq minor-mode-alist (cons '(leg-mode-timer " LEG") minor-mode-alist))) | ||
(leg-mode-changed)) | ||
|
||
(provide 'leg-mode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#define PEG_MAJOR 0 | ||
#define PEG_MINOR 1 | ||
#define PEG_LEVEL 18 | ||
#define PEG_LEVEL 19 |