예제 #1
0
        public void VisitPreProcessorDirective(PreProcessorDirective preProcessorDirective)
        {
            JsonObject visit = new JsonObject();
            visit.Comment = "VisitPreProcessorDirective";
            var type = preProcessorDirective.Type;
            string typeStr = "#" + type.ToString().ToLowerInvariant();
            visit.AddJsonValue("preprocessordirective-type", new JsonElement(typeStr));
            if (!string.IsNullOrEmpty(preProcessorDirective.Argument))
            {
                visit.AddJsonValue("argument", new JsonElement(preProcessorDirective.Argument));
            }
            else
            {
                visit.AddJsonNull("argument");
            }

            Push(visit);
            throw new FirstTimeUseException();
        }
예제 #2
0
 public void VisitVariableInitializer(VariableInitializer variableInitializer)
 {
     JsonObject variable = new JsonObject();
     variable.Comment = "VisitVariableInitializer";
     variable.AddJsonValue("variable-name", GetIdentifier(variableInitializer.NameToken));
     if (!variableInitializer.Initializer.IsNull)
     {
         variable.AddJsonValue("initializer", GenExpression(variableInitializer.Initializer));
     }
     else
     {
         variable.AddJsonNull("initializer");
     }
     Push(variable);
 }