diff options
| author | Stefan Monnier | 2015-09-29 15:13:44 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2015-09-29 15:13:44 -0400 |
| commit | 90a6f8d0741eb5391c204f059c845c361e615b49 (patch) | |
| tree | 30446e80abf227e60bc319a3c63bf79b260fc3d7 /test | |
| parent | 1fea2f3b743da1db666be7ce34904b74319d3f83 (diff) | |
| download | emacs-90a6f8d0741eb5391c204f059c845c361e615b49.tar.gz emacs-90a6f8d0741eb5391c204f059c845c361e615b49.zip | |
* lisp/progmodes/octave.el: Use grammar more; Handle enumeration fun
Remove redundant :group keyword args.
(octave-begin-keywords, octave-else-keywords, octave-end-keywords):
Remove variables.
(octave-operator-table, octave-smie-bnf-table): Use let-when-compile to
turn them into compile-time variables.
Auto-generate the "foo ... end" rules from the "foo ... endfoo" rules.
Add rules for break, continue, return, global, and persistent.
Refine the rule for "until".
(octave-smie--funcall-p, octave-smie--end-index-p)
(octave-smie--in-parens-p): New functions.
(octave-smie-backward-token, octave-smie-forward-token): Use them to
distinguish the "enumeration" function and the "end" index from
their corresponding keywords.
(octave--block-offset-keywords): New constant.
(octave-smie-rules): Use it. Adjust rules for new global/persistent parsing.
(octave-reserved-words): Redefine using octave-smie-grammar.
(octave-font-lock-keywords): Use octave-smie--funcall-p and
octave-smie--end-index-p.
Diffstat (limited to 'test')
| -rw-r--r-- | test/indent/octave.m | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/indent/octave.m b/test/indent/octave.m index a7041462f7f..4758f9933cb 100644 --- a/test/indent/octave.m +++ b/test/indent/octave.m | |||
| @@ -1,6 +1,19 @@ | |||
| 1 | ## -*- mode: octave; coding: utf-8 -*- | 1 | ## -*- mode: octave; coding: utf-8 -*- |
| 2 | 0; # Don't make this a function file | 2 | 0; # Don't make this a function file |
| 3 | function res = tcomp (fn) | 3 | function res = tcomp (fn) |
| 4 | |||
| 5 | global x y ... | ||
| 6 | z1 z2 | ||
| 7 | persistent x y ... | ||
| 8 | z1 z2 | ||
| 9 | global x y = 2 ... | ||
| 10 | z1 z2 # FIXME | ||
| 11 | |||
| 12 | do | ||
| 13 | something | ||
| 14 | until x = ... | ||
| 15 | y | ||
| 16 | |||
| 4 | %% res = tcomp (fn) | 17 | %% res = tcomp (fn) |
| 5 | %% imports components and rearranges them. | 18 | %% imports components and rearranges them. |
| 6 | 19 | ||
| @@ -10,6 +23,15 @@ function res = tcomp (fn) | |||
| 10 | 23 | ||
| 11 | data = dlmread(fn, 3, 0); | 24 | data = dlmread(fn, 3, 0); |
| 12 | 25 | ||
| 26 | enumeration | ||
| 27 | first (1) | ||
| 28 | second (2) | ||
| 29 | end | ||
| 30 | |||
| 31 | y = enumeration (x); #Beware: "enumeration" can also be a function! | ||
| 32 | y = foo(enumeration (x), | ||
| 33 | 2); #Beware: "enumeration" can also be a function! | ||
| 34 | |||
| 13 | x = data(:,2:end); | 35 | x = data(:,2:end); |
| 14 | y = 'hello'; | 36 | y = 'hello'; |
| 15 | z = y'; | 37 | z = y'; |