branch: externals/bnf-mode commit f00384e485052655042df8aabd6942bdcd8cbc6b Author: Serghei Iakovlev <serg...@phalconphp.com> Commit: Serghei Iakovlev <serg...@phalconphp.com>
Change comment syntax --- CHANGELOG.org | 3 +++ README.org | 10 ++++++++-- bnf-mode.el | 28 +++++++++++++--------------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index eabf01d..e68ace6 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [[http://keepachangelog.com][Keep a Changelog]] and this project adheres to [[http://semver.org][Semantic Versioning]]. ** [[https://github.com/sergeyklay/bnf-mode/compare/0.1.0...HEAD][Unreleased]] +*** Changed +- Changed comment syntax from ~#~ to ~;~ to follow [[https://tools.ietf.org/html/rfc822#section-2.8][RFC822#2.8]] . +- Comments no longer use syntax table. For more see `comment-use-syntax'. ** 0.1.0 - 2019-03-16 *** Added diff --git a/README.org b/README.org index 7f8f2d0..71d405c 100644 --- a/README.org +++ b/README.org @@ -8,9 +8,15 @@ A GNU Emacs major mode for editing BNF grammars. Currently provides basic syntax and font-locking for BNF files. EBNF and ABNF are in my plans for the near future. +When developing this mode, the following RFCs were taken into account: + +- [[https://www.ietf.org/rfc/rfc822.txt][RFC822]]: Standard for ARPA Internet Text Messages +- [[https://www.ietf.org/rfc/rfc5234.txt][RFC5234]]: Augmented BNF for Syntax Specifications: ABNF + ** Features -1. Syntax highlighting +- Basic syntax definition +- Syntax highlighting ** Installation @@ -74,8 +80,8 @@ To see what has changed in recent versions of BNF Mode, see the [[https://github ** External Links -- [[https://tools.ietf.org/html/rfc5234][RFC 5234: Augmented BNF for Syntax Specifications: ABNF]] - [[https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form][Wikipedia: Backus–Naur form]] +- [[https://www.ics.uci.edu/~pattis/ICS-33/lectures/ebnf.pdf][EBNF: A Notation to Describe Syntax]] ** License diff --git a/bnf-mode.el b/bnf-mode.el index 96c7ac2..0ebe02e 100644 --- a/bnf-mode.el +++ b/bnf-mode.el @@ -4,7 +4,7 @@ ;; Author: Serghei Iakovlev (concat "sadhooklay" "@" "gmail" ".com") ;; Maintainer: Serghei Iakovlev -;; Version: 0.1.0 +;; Version: 0.2.0 ;; URL: https://github.com/sergeyklay/bnf-mode ;; Keywords: languages ;; Package-Requires: ((cl-lib "0.5") (pkg-info "0.4") (emacs "24.3")) @@ -33,6 +33,14 @@ ;; GNU Emacs major mode for editing BNF grammars. Currently this mode ;; provides basic syntax and font-locking for "*.bnf" files. ;; +;; When developing this mode, the following RFCs were taken into account: +;; +;; - RFC822: Standard for ARPA Internet Text Messages [1] +;; - RFC5234: Augmented BNF for Syntax Specifications: ABNF [2] +;; +;; [1]: https://www.ietf.org/rfc/rfc822.txt +;; [2]: https://www.ietf.org/rfc/rfc5234.txt +;; ;; Usage: Put this file in your Emacs Lisp path (eg. site-lisp) and add to ;; your .emacs file: ;; @@ -47,15 +55,6 @@ ;;; Code: -;;; Compatibility - -;; Work around emacs bug#18845, cc-mode expects cl to be loaded -;; while bnf-mode only uses cl-lib (without compatibility aliases) -(eval-and-compile - (if (and (= emacs-major-version 24) (>= emacs-minor-version 4)) - (require 'cl))) - - ;;; Requirements ;; Tell the byte compiler about autoloaded functions from packages @@ -185,7 +184,7 @@ See `rx' documentation for more information about REGEXPS param." ;; Characters used to delimit string constants (modify-syntax-entry ?\" "\"" table) ;; Comments setup - (modify-syntax-entry ?# "<" table) + (modify-syntax-entry ?\; "<" table) (modify-syntax-entry ?\n ">" table) ;; Treat ::= as sequence of symbols (modify-syntax-entry ?\: "_" table) @@ -204,9 +203,8 @@ See `rx' documentation for more information about REGEXPS param." :syntax-table bnf-mode-syntax-table :group 'bnf-mode ;; Comment setup - (setq-local comment-use-syntax t) - (setq-local comment-auto-fill-only-comments t) - (setq-local comment-start "# ") + (setq-local comment-use-syntax nil) + (setq-local comment-start "; ") (setq-local comment-end "") (setq-local font-lock-keyword-face 'php-keyword) ;; Font locking @@ -215,7 +213,7 @@ See `rx' documentation for more information about REGEXPS param." bnf-font-lock-keywords ;; keywords-only nil - ;; Regarding RFC-5234 + ;; Regarding RFC5234 ;; The names <rulename>, <Rulename>, <RULENAME>, ;; and <rUlENamE> all refer to the same rule. t