MATLAB lexer: functions without return values generate an error

Issue #419 resolved
Former user created an issue

A function definition without return arguments generates an error.

The following patch works for me:



Index: pygments/lexers/

--- pygments/lexers/ 2009-06-25 17:37:55.000000000 +0200
+++ pygments/lexers/ 2009-06-25 17:27:15.000000000 +0200
@@ -184,7 +184,7 @@
(r'[^\']\'', String, '#pop')
'deffunc': [
- (r'(\s
+ (r'(\s)(?:(.+)(\s)(=)(\s))?(.+)(\()(.)(\))(\s*)',
bygroups(Text.Whitespace, Text, Text.Whitespace, Punctuation,
Text.Whitespace, Name.Function, Punctuation, Text,
Punctuation, Text.Whitespace), '#pop'),

Reported by fmarc

Comments (6)

  1. Anonymous

    Replying to [comment:1 thatch]:

    Patch looks okay. Can you provide an example of what it fixes though, so I can add it to the test suite?

    Sure: This piece of code generates an error without the patch, but not with it:

    function myfunc(s)
        a = 1;
  2. Log in to comment