Navigation
Synopsis Markup for a code listing.
Syntax
  1. <listing> RascalCode </listing>
  2. <listing FileName>
Description A listing shows Rascal code without executing it. A listing can be of the following kinds:
  1. inline: the Rascal code appears between the <listing> and </listing> brackets.
  2. file: the Rascal code is copied from a named file. To avoid that lengthy legal information, contributor lists, and the like appear in the listings in the course, all lines occuring before a line containing //START are removed before inclusion. If such a line is missing, the complete file is included.
Examples The input:
<listing>
x = 3;
</listing>

will produce:
x = 3;
The input:
<listing demo/Hello.rsc>

will produce.
module demo::basic::Hello

import IO;

public void hello() {
   println("Hello world, this is my first Rascal program");
}
Compared with the source file, all lines before //START have been removed.
Pitfalls Do not make the lines in a listing too long since they will not be wrapped. Not more than 60 characters is a rule of thumb.
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.