Commit 90a6f8d0 authored by Stefan Monnier's avatar Stefan Monnier

* 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.
parent 1fea2f3b
This diff is collapsed.
## -*- mode: octave; coding: utf-8 -*-
0; # Don't make this a function file
function res = tcomp (fn)
global x y ...
z1 z2
persistent x y ...
z1 z2
global x y = 2 ...
z1 z2 # FIXME
do
something
until x = ...
y
%% res = tcomp (fn)
%% imports components and rearranges them.
......@@ -10,6 +23,15 @@
data = dlmread(fn, 3, 0);
enumeration
first (1)
second (2)
end
y = enumeration (x); #Beware: "enumeration" can also be a function!
y = foo(enumeration (x),
2); #Beware: "enumeration" can also be a function!
x = data(:,2:end);
y = 'hello';
z = y';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment