|
2 | 2 |
|
3 | 3 | ;; Copyright (C) 2012-2013 Jon Oddie <[email protected]>
|
4 | 4 |
|
5 |
| -;; Author: Jon Oddie <[email protected]> |
6 |
| -;; URL: https://github.com/emacs-gnuplot/gnuplot |
| 5 | +;; Author: Jon Oddie <[email protected]> |
7 | 6 |
|
8 | 7 | ;; This file is not part of GNU Emacs.
|
9 | 8 |
|
|
62 | 61 | ;; features was to do a complete parse of the command line. So that's
|
63 | 62 | ;; what this package does. Instead of building a parse tree, it
|
64 | 63 | ;; matches up until the token at point, and then either makes a list
|
65 |
| -;; of possible completions, or sets the variables `gnuplot-context--eldoc' and |
66 |
| -;; `gnuplot-context--info-at-point' based on where it is in the grammar at that |
67 |
| -;; point. |
| 64 | +;; of possible completions, or sets the variables |
| 65 | +;; `gnuplot-context--eldoc' and `gnuplot-context--info-at-point' based |
| 66 | +;; on where it is in the grammar at that point. |
68 | 67 | ;;
|
69 | 68 | ;; The parsing/matching process happens in two phases: tokenizing
|
70 |
| -;; (`gnuplot-context--tokenize') and matching (`gnuplot-context--match-pattern'). In |
71 |
| -;; order to be able to construct a full list of possible completions |
72 |
| -;; via backtracking, the matching algorithm simulates a simple stack |
73 |
| -;; machine with continuations. At byte-compile time, the PEG-like |
74 |
| -;; grammar in S-expression notation (`gnuplot-grammar') is compiled |
75 |
| -;; down into a vector of "machine code" for the parsing machine (see |
76 |
| -;; `gnuplot-context--compile-pattern', `gnuplot-context--compile-grammar' and |
77 |
| -;; `gnuplot-context--compiled-grammar'). This is complicated, but it seems to |
78 |
| -;; work well enough, and it saves on the Emacs call stack. |
| 69 | +;; (`gnuplot-context--tokenize') and matching |
| 70 | +;; (`gnuplot-context--match-pattern'). In order to be able to |
| 71 | +;; construct a full list of possible completions via backtracking, the |
| 72 | +;; matching algorithm simulates a simple stack machine with |
| 73 | +;; continuations. At byte-compile time, the PEG-like grammar in |
| 74 | +;; S-expression notation (`gnuplot-grammar') is compiled down into a |
| 75 | +;; vector of "machine code" for the parsing machine (see |
| 76 | +;; `gnuplot-context--compile-pattern', |
| 77 | +;; `gnuplot-context--compile-grammar' and |
| 78 | +;; `gnuplot-context--compiled-grammar'). This is complicated, but it |
| 79 | +;; seems to work well enough, and it saves on the Emacs call stack. |
79 | 80 | ;;
|
80 | 81 | ;; Compiling the grammar does require increasing `max-lisp-eval-depth'
|
81 | 82 | ;; modestly. This shouldn't cause any problems on modern machines, and
|
|
88 | 89 | ;; The pattern-matching language
|
89 | 90 | ;; =============================
|
90 | 91 | ;;
|
91 |
| -;; The gnuplot-mode grammar (see `gnuplot-context--compiled-grammar') is a list |
92 |
| -;; of rules (RULE PATTERN), with each pattern written in S-expression |
93 |
| -;; notation as follows: |
| 92 | +;; The gnuplot-mode grammar (see `gnuplot-context--compiled-grammar') |
| 93 | +;; is a list of rules (RULE PATTERN), with each pattern written in |
| 94 | +;; S-expression notation as follows: |
94 | 95 | ;;
|
95 | 96 | ;; any
|
96 | 97 | ;; Match any token
|
|
0 commit comments