예제 #1
0
파일: Literals.cs 프로젝트: Seti-0/NSprak
        public static void GenerateCode(LiteralArrayGet literal, GeneratorContext builder)
        {
            foreach (Expression element in literal.Elements)
            {
                builder.AddCode(element);
            }

            builder.AddOp(new ArrayValue(literal.Elements.Count), literal.StartToken);
        }
예제 #2
0
 private Color GetColor(SprakExpression item)
 {
     return(item switch
     {
         Block block => GetColor(block.Header),
         Command _ => Colors.Blue,
         FunctionCall _ => Colors.Orange,
         FunctionHeader _ => Colors.Blue,
         IfHeader _ => Colors.DarkRed,
         LiteralArrayGet _ => Colors.Yellow,
         LiteralGet _ => Colors.Yellow,
         LoopHeader _ => Colors.Red,
         MainHeader _ => Colors.Orange,
         OperatorCall _ => Colors.Green,
         Return _ => Colors.Blue,
         VariableAssignment _ => Colors.Orange,
         VariableReference _ => Colors.Yellow,
         _ => Colors.Black
     });