# Multiline comment closes

%{
  Test multiline comment
%}
"Not a comment"

==>
 
Script(MultilineComment,String)

# Invalid multiline comment delimiters give line comments

%{ Invalid as followed by non-whitespace.
"Not a comment"
%} Invalid as followed by non-whitespace.
"Not a comment"
ver %{ Invalid as preceded by non-whitespace.
"Not a comment"
%{
  Test valid multiline comment
%}

==>
 
Script(LineComment,String,LineComment,String,Identifier,LineComment,String,MultilineComment)

# Transpose is not a string delimiter

A1' + A2' + B1

==>

Script(Identifier,Symbol,Identifier,Symbol,Identifier)

# Character vectors can be preceded by non whitespace

A1" + A2" + B1

==>

Script(Identifier,String,Symbol,Identifier)

# Transposed transpose

A'' + B'

==>

Script(Identifier,Symbol,Identifier)

# System command with no preceding whitespace

test!test

==>

Script(Identifier,SystemCommand)

# Magic command after a Line Comment is treated as a Line Comment

%%magic command
% A comment
%%magic now treated as comment

==>

Script(Magic, LineComment, LineComment)

# Magic command after a MultilineComment is treated as a LineComment

%{
A MultilineComment
%}
%%magic now treated as comment

==>

Script(MultilineComment, LineComment)

# Magic command after a MATLAB Code should be treated as a Line Comment

%%magic command1
peaks
%%magic command2

==>

Script(Magic, Identifier, LineComment)