rspc library

Classes

ArgInfo
Parse the information of the arguments.
Compiler
The RSP compiler
ControlTag
A skeletal class for implementing control tags, such as IfTag and WhileTag.
DartTag
The dart tag.
ElseTag
The else tag.
ForTag
The for tag. There are two formats:
ForwardTag
The forward tag. There are two formats:
HeaderTag
The header tag to generate HTTP response headers.
IfTag
The if tag.
IncludeTag
The include tag. There are two formats:
JsonJsTag
The json-js tag. It generates a JavaScript object by converting the given Dart expression into a JSON object.
JsonTag
The json tag. It generates a JavaScript object by converting the given Dart expression into a JSON object.
PageTag
The page tag.
SimpleTag
A tag simplifies the implementation of simple tags. For example,
Tag
A tag.
TagContext
The tag execution context.
VarTag
The var tag. It defines a variable or an argument passed to IncludeTag or ForwardTag
WhileTag
The while tag.

Properties

tags Map<String, Tag>
A map of tags that RSP compiler uses to handle the tags.
getter/setter pair

Functions

build(List<String> arguments, {String filenameMapper(String source)?, Encoding encoding = utf8, List<String>? imports}) Future
Compile changed RSP files. This method shall be called within build.dart, with the arguments passed to main() as its arguments.
compile(String source, IOSink out, {String? sourceName, String? destinationName, Encoding encoding = utf8, bool verbose = false, bool lineNumber = false, List<String>? imports}) → void
Compiles the given source RSP document to the given output stream out. Notice that the caller has to close the output stream by himself.
compileFile(String sourceName, {String? destinationName, bool verbose = false, bool newer = false, bool lineNumber = false, Encoding encoding = utf8, List<String>? imports, void onCompile(String source, {bool skipped})?}) Future<bool>
Compiles the RSP document of the given sourceName and write the result to the file of given destinationName.
isEL(String data) bool
Test if the given value is enclosed with [= ]. If null, false is returned.
isValidVarCharCode(int cc, bool firstChar) bool
Test if the given character can be used in a variable name.
main(List<String> arguments) Future
The entry point of RSP compiler.
outMap(TagContext tc, Map<String, String> map) → void
Output the given map to the generated Dart file. It will generate something like the following to the Dart file:
outText(TagContext tc, String text, [int? line]) → void
Output the given text to the generated Dart file. It will generate something like the following to the Dart file:
parseArgs(String data) Map<String, String>
Parses the given string into a map of arguments. It assumes the string is in the format of: arg0="value0" arg1="value1"
toEL(String? data, {bool direct = true}) String
Converts the given value to a valid Dart statement.

Exceptions / Errors

SyntaxError
Syntax error.