Add support for colorized comments
This commit is contained in:
@@ -134,6 +134,9 @@ public static unsafe class SlangExtensions
|
|||||||
case 7: // (punctuation)
|
case 7: // (punctuation)
|
||||||
return SlangFormatter.ColorDefault;
|
return SlangFormatter.ColorDefault;
|
||||||
|
|
||||||
|
case 8: // Comments
|
||||||
|
return SlangFormatter.ColorComment;
|
||||||
|
|
||||||
case 10: // (syscalls)
|
case 10: // (syscalls)
|
||||||
return SlangFormatter.ColorFunction;
|
return SlangFormatter.ColorFunction;
|
||||||
|
|
||||||
|
|||||||
41
rust_compiler/libs/compiler/test_files/script.slang
Normal file
41
rust_compiler/libs/compiler/test_files/script.slang
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
// Pressure numbers are in KPa
|
||||||
|
|
||||||
|
device self = "db";
|
||||||
|
device emergencyRelief = "d0";
|
||||||
|
device greenhouseSensor = "d1";
|
||||||
|
device recycleValve = "d2";
|
||||||
|
|
||||||
|
const MAX_INTERIOR_PRESSURE = 80;
|
||||||
|
const MAX_INTERIOR_TEMP = 28c;
|
||||||
|
const MIN_INTERIOR_PRESSURE = 75;
|
||||||
|
const MIN_INTERIOR_TEMP = 25c;
|
||||||
|
const daylightSensor = 1076425094;
|
||||||
|
const growLight = hash("StructureGrowLight");
|
||||||
|
const wallLight = hash("StructureLightLong");
|
||||||
|
const lightRound = hash("StructureLightRound");
|
||||||
|
|
||||||
|
let shouldPurge = false;
|
||||||
|
|
||||||
|
loop {
|
||||||
|
let interiorPress = greenhouseSensor.Pressure;
|
||||||
|
let interiorTemp = greenhouseSensor.Temperature;
|
||||||
|
|
||||||
|
shouldPurge = (
|
||||||
|
interiorPress > MAX_INTERIOR_PRESSURE ||
|
||||||
|
interiorTemp > MAX_INTERIOR_TEMP
|
||||||
|
) || shouldPurge;
|
||||||
|
|
||||||
|
emergencyRelief.On = shouldPurge;
|
||||||
|
recycleValve.On = !shouldPurge;
|
||||||
|
|
||||||
|
if (shouldPurge && (interiorPress < MIN_INTERIOR_PRESSURE && interiorTemp < MIN_INTERIOR_TEMP)) {
|
||||||
|
shouldPurge = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let solarAngle = lb(daylightSensor, "SolarAngle", "Average");
|
||||||
|
let isDaylight = solarAngle < 90;
|
||||||
|
|
||||||
|
sb(growLight, "On", isDaylight);
|
||||||
|
sb(wallLight, "On", !isDaylight);
|
||||||
|
sb(lightRound, "On", !isDaylight);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user