GitXplorerGitXplorer
k

pest-mode

public
19 stars
4 forks
1 issues

Commits

List of commits on branch master.
Unverified
8023a92ce59c34dcd1587cbd85ed144f206ddb89

Fix paren-start-pos. (#15)

kksqsf committed 2 years ago
Unverified
4a367a0fb9f9ac9cff8b1798335f6248d4cb3467

Improve indentation calculation.

kksqsf committed 2 years ago
Unverified
a4ffbb3f2ae8acbcd42868dc89c9e244583ac5be

allow blank character in rule regexp

ttaquangtrung committed 2 years ago
Unverified
af677327f185113442e95b00986097b30cab650c

Bump generic-array from 0.12.3 to 0.12.4 in /pesta

ddependabot[bot] committed 3 years ago
Unverified
43447a2c70f98edd1139005e32f437d3f142442b

Bump version to 0.1.

kksqsf committed 5 years ago
Unverified
4ae88a9c81d499bbe99978ff0216b645fed70023

update readme

kksqsf committed 5 years ago

README

The README file for this repository.

Pest mode

Pest mode provides a major mode for editing Pest files. It also contains a few advanced features.

Current stable version: 0.1.

Pest-mode features:

  • Syntax highlighting
  • Indentation
  • Imenu integration
  • xref integration
  • Eldoc integration (requires pesta)
  • Flymake/flycheck integration for syntax checking (requires pesta)
  • Language studio, where you can experiment the grammar (requires pesta)

Installation

pest-mode, flymake-pest, and flycheck-pest are now on MELPA.

  • Just M-x package-install both pest-mode and flymake-pest.
  • Install pesta (see below).

pest-mode

To manually install pest-mode, download the file and put it in your load-path, and write in your config file:

(autoload 'pest-mode "pest-mode")
(add-to-list #'auto-mode-alist '("\\.pest\\'" . pest-mode))

If you use use-package and quelpa, life is easier:

(use-package pest-mode
  :quelpa (pest-mode :fetcher github :repo "ksqsf/pest-mode")
  :mode "\\.pest\\'"
  :hook (pest-mode . flymake-mode))

pesta

To use the more advanced features, you must have pesta installed.

pesta is now on crates.io, so just do

  • cargo install pesta --force

Or, if you prefer the manual way,

  1. Install the Rust toolchain.
  2. cd pesta && cargo build --release
  3. Find the executable pesta under target/release, and (optionally) put it in your PATH.

Note: you have to customize pest-pesta-executable if pesta is not in your PATH.

Usage

If you have added pest-mode to auto-mode-alist, then it should be enabled automatically on any .pest file.

In a .pest file,

  • pest-test-input (default keybinding C-c C-t): open a buffer to test the current grammar
  • flymake-mode: enable syntax checking

In a testing buffer,

  • pest-select-rule (default keybinding C-c C-r): select the start rule for all other purposes
  • pest-analyze-input (default keybinding C-c C-c): analyze the input and report the structure
  • flymake-mode (enabled by default): enable syntax checking
  • eldoc-mode (enabled by default): enable displaying the parse tree path

Demo

All of the following require pesta.

Pest-mode supports flymake!

pest-mode flymake

The testing buffer supports both flymake and eldoc!

pest-input-mode flymake and eldoc

Analyze

pest-input-mode analyze