You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
notepad-plus-plus/lexilla/test/examples/matlab/ArgumentsBlock.m.matlab.styled

138 lines
4.2 KiB

{1}%% Correctly defined arguments block{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{1}% Some comment here{0}
{1}% And, maybe, here{0}
{4}arguments{0}
{7}x{0} {6}({3}1{6},{3}2{6}){0} {6}{{7}mustBeReal{6}({7}x{6})}{0}
{4}end{0}
{7}y{0} {6}={0} {7}x{6}*{3}2{6};{0}
{7}arguments{0} {6}={0} {3}1{6};{0}
{7}y{0} {6}={0} {7}y{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}%% No arguments block, "arguments" is used {0}
{1}% as a variable name (identifier){0}
{1}% Prevent arguments from folding with an identifier{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{1}% Some comment here{0}
{7}x{0} {6}={0} {7}x{0} {6}+{0} {3}1{6};{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% Prevent arguments from folding with a number{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{3}4{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% With a double quote string{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{8}"test"{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% With a string{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{5}'test'{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% With a keyword{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{4}if{0} {7}x{0} {6}=={0} {3}0{6};{0}
{4}return{0} {3}0{6};{0}
{4}end{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% With an operator (illegal syntax){0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{6}*{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {7}arguments{6};{0}
{4}end{0}
{1}% Semicolon is equivalent to a comment{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{6}({7}x{6}){0}
{6};;;;;;;{0}
{4}arguments{0}
{7}x{0}
{4}end{0}
{7}y{0} {6}={0} {7}x{0} {6}+{0} {3}2{6};{0}
{4}end{0}
{1}% Arguments block is illegal in nested functions,{0}
{1}% but lexer should process it anyway{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{4}arguments{0}
{7}x{0} {6}({3}1{6},{3}2{6}){0} {6}{{7}mustBeReal{6}({7}x{6})}{0}
{4}end{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{0} {6}({7}x{6}){0}
{4}arguments{0}
{7}x{0} {6}({3}1{6},{3}2{6}){0} {6}{{7}mustBeReal{6}({7}x{6})}{0}
{4}end{0}
{7}var{0} {6}={0} {3}0{6};{0}
{7}arguments{0} {6}={0} {3}5{6};{0}
{7}y{0} {6}={0} {7}arguments{0} {6}+{0} {7}x{6};{0}
{4}end{0}
{1}% Use as a variable, just in case{0}
{7}arguments{0} {6}={0} {3}10{6};{0}
{4}end{0}
{1}% Erroneous use of arguments block{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{6}({7}x{6}){0}
{1}% Some comment{0}
{7}x{0} {6}={0} {7}x{0} {6}+{0} {3}1{6};{0}
{7}arguments{0}
{7}x{0}
{4}end{0}
{7}y{0} {6}={0} {7}x{6};{0}
{4}end{0}
{1}% "arguments" is an argument name too{0}
{4}function{0} {7}r{0} {6}={0} {7}foo{6}({7}x{6},{0} {7}arguments{6}){0}
{4}arguments{0}
{7}x{0}
{7}arguments{0}
{4}end{0}
{7}r{0} {6}={0} {7}bar{6}({7}x{6},{0} {7}arguments{6}{:});{0}
{4}end{0}
{1}% Multiple arguments blocks{0}
{4}function{0} {6}[{7}a{6},{0} {7}b{6}]{0} {6}={0} {7}foo{6}({7}x{6},{0} {7}y{6},{0} {7}varargin{6}){0}
{4}arguments{6}({7}Input{6}){0}
{7}x{0} {6}({3}1{6},{3}4{6}){0} {6}{{7}mustBeReal{6}}{0}
{7}y{0} {6}({3}1{6},:){0} {6}{{7}mustBeInteger{6}}{0} {6}={0} {7}x{6}({3}2{6}:{3}end{6});{0}
{4}end{0}
{4}arguments{6}({7}Input{6},{0} {7}Repeating{6}){0}
{7}varargin{0}
{4}end{0}
{4}arguments{6}({7}Output{6}){0}
{7}a{0} {6}({3}1{6},{3}1{6}){0} {6}{{7}mustBeReal{6}}{0}
{7}b{0} {6}({3}1{6},{3}1{6}){0} {6}{{7}mustBeNonNegative{6}}{0}
{4}end{0}
{7}var{0} {6}={0} {3}10{6};{0}
{7}arguments{0} {6}={0} {6}{{8}"now"{6},{0} {8}"it's"{6},{0} {8}"variable"{6}};{0}
{6}[{7}a{6},{0} {7}b{6}]{0} {6}={0} {7}bar{6}({7}x{6},{0} {7}y{6},{0} {7}arguments{6});{0}
{4}end{0}
{1}% One line function with arguments block.{0}
{1}% This code style is rarely used (if at all), but the{0}
{1}% lexer shouldn't break{0}
{4}function{0} {7}y{0} {6}={0} {7}foo{6}({7}x{6});{0} {4}arguments{6};{0} {7}x{6};{0} {4}end{6};{0} {7}y{0} {6}={0} {7}bar{6}({7}x{6});{0} {4}end{0}