presentations/highlight-js/test/detect/lasso/default.txt

49 lines
1.6 KiB
Text
Raw Permalink Normal View History

2018-12-07 08:48:05 -06:00
<?LassoScript
/* Lasso 8 */
local('query' = 'SELECT * FROM `'+var:'table'+'` WHERE `id` > 10
ORDER BY `Name` LIMIT 30');
Inline: -Username=$DBuser, -Password=$DBpass, -Database=$DBname, -sql=#query;
var("class1.name" = (found_count != 0 ? "subtotal" | "nonefound"),
"total_amount" = found_count || "No results");
records;
output: "<tr>"loop_count"</tr>";
/records;
/Inline;
?><div class="[$class1.name]">[$total_amount]</div>
<?lasso
/* Lasso 9 */ ?>
[noprocess] causes [delimiters] to be <?=skipped?> until the next [/noprocess]
[
define strings.combine(value::string, ...other)::string => {
local(result = #value->append(#other->asString&trim))
return set(#result, not #other, \givenBlock)
}
/**! descriptive text */
define person => type {
parent entity
data name::string, protected nickname, birthdate :: date
data private ssn = null
private showAge() => frozen { return ..age }
protected fullName() => `"` + .nickname + `"` + .'name'
public ssnListed::boolean => .ssn() ? true | false
}
define person->name=(value) => {
.'name' = #value
return self->'name'
}
define bytes->+(rhs::bytes) => bytes(self)->append(#rhs)&
] <!-- an HTML comment <?=disables delimiters?> as well -->
[no_square_brackets] disables [square brackets] for the rest of the file
<?=
// query expression
with n in array((:-12, 0xABCD, 3.14159e14), (:NaN, -infinity, .57721))
let swapped = pair(#n->\second, #n->first)
group #swapped by #n->first into t
let key = #t->key
order by #key
select pair(#key, #1)
do {^
#n->upperCase
^}
?>