Curl-cинтаксис
Сергей Шишкин• The Curl® Runtime Environment displays any text that appears in the top level of a Curl language source file.
• Whitespace is collapsed.
• A line with no text causes subsequent text to be displayed in a new paragraph.
Reserved Character:
{ - Left curly brace (Unicode 007B)
} - Right curly brace (Unicode 007D)
\ - Backslash (Unicode 005C)
| - Vertical bar (Unicode 007C)
Escape Sequence:
\uXXXX - Special character, where XXXX is the Unicode hexadecimal value of the character. Values greater than 0xFFFF cannot be represented using this sequence.
\UXXXXXXXX - Special character, where XXXXXXXX is the Unicode hexadecimal value of the character
\n - Newline character
\r - Carriage return character
\t - Tab character
\' - Single quote character
\" - Double quote character
\\ - Backslash (escape) character
\{ - Left curly brace
\} - Right curly brace
\| - Vertical bar
\ - Non-breaking space
\= - Equal sign
\[ - Left square bracket
\] - Right square bracket
\( = Left parenthesis
\) - Right parenthesis
The Curl language provides four types of comments:
• End-of-line comments: All text between || and the end of the line is treated as a single-line comment.
• Multi-line comments: All text between |# and #| is treated as a comment.
• Tagged comments: All text between |tag-name# and #tag-name| is treated as a comment.
• Length-specified comments: The number of characters in a comment can be used in place of a tag-name to enclose a sequence of totally arbitrary characters.
Expressions
• Expressions are essentially the Curl language commands.
• Most expressions are surrounded by { and }.
• When the runtime encounters an expression, it evaluates the expression.
• The RTE evaluates all subexpressions in the expression in order, from left to right.
• Most expressions produce a value.
• The value produced by a top-level expression is displayed in the browser.
Using Variables
• Use a let expression to create a variable and assign an initial value to it.
• Use a set expression to assign a new value to an existing variable.
• let and set expressions do not produce values.
Using value and do Expressions
• value executes one or more Curl language expressions and produces the value of the last expression, if any.
• do executes one or more of Curl language expressions, but does not produce a value.
• let and set expressions within value and do expressions do not need curly braces around them.
Operator Expressions
• The usual arithmetic operators, including parentheses, can be used in Curl language source code.
• Operator expressions always produce a value.
• Operator expressions are never enclosed in curly braces.
• The value of an operator expression can be displayed in top-level text by including it in a value expression.
Verbatim Strings
• Use verbatim strings for text that the runtime does not interpret.
• Within top-level code, the runtime displays the contents of the verbatim string without interpretation.
• Within a text format, the runtime displays the contents of the verbatim string without interpretation and applies the text format.
• Within code, the runtime treats the verbatim string as a string of characters.
Regular Verbatim Strings
|" text "|
Tagged Verbatim Strings
|tag-name" text "tag-name|
Length-specified Verbatim Strings
|num-chars" text "num-chars|
Literals
- A literal is a constant value.
• The Curl® language supports numeric, Boolean, character, string, and quantity literals, as well as the null literal.
... Операторы, Отношения между операторами, Блоки кода, Условия и циклы, Процедуры и аргументы, Глобальные процедуры, Анонимные процедуры, Выражения, Исключения, Макросы, Динамическое выделение памяти, Сборка мусора, Указатели ... Типы, Библиотеки, ...